@finsweet/webflow-apps-utils 1.0.2 → 1.0.4
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 +2 -1
- package/dist/index.js +2 -1
- 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/Router.mdx +958 -0
- package/dist/router/Router.stories.d.ts +6 -0
- package/dist/router/Router.stories.js +47 -0
- package/dist/router/examples/RouterExample.svelte +271 -0
- package/dist/{ui/components/NoSettingsNeeded.svelte.d.ts → router/examples/RouterExample.svelte.d.ts} +3 -3
- package/dist/router/examples/index.d.ts +4 -0
- package/dist/router/examples/index.js +4 -0
- package/dist/router/examples/pages/AboutPage.svelte +568 -0
- package/dist/router/examples/pages/AboutPage.svelte.d.ts +13 -0
- package/dist/router/examples/pages/HomePage.svelte +200 -0
- package/dist/router/examples/pages/HomePage.svelte.d.ts +14 -0
- package/dist/router/examples/pages/NotFoundPage.svelte +307 -0
- package/dist/router/examples/pages/NotFoundPage.svelte.d.ts +17 -0
- package/dist/router/hooks.svelte.d.ts +2 -2
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.js +3 -0
- package/dist/router/{Link.svelte → providers/Link.svelte} +1 -1
- package/dist/router/{Route.svelte → providers/Route.svelte} +1 -1
- package/dist/router/{Route.svelte.d.ts → providers/Route.svelte.d.ts} +1 -1
- package/dist/router/{Router.svelte → providers/RouterProvider.svelte} +22 -5
- package/dist/router/{Router.svelte.d.ts → providers/RouterProvider.svelte.d.ts} +8 -4
- package/dist/router/providers/index.d.ts +3 -0
- package/dist/router/providers/index.js +3 -0
- package/dist/router/{index.svelte.d.ts → router.svelte.d.ts} +1 -3
- package/dist/router/{index.svelte.js → router.svelte.js} +1 -4
- package/dist/stores/docs/Form.mdx +542 -0
- package/dist/stores/forms.d.ts +41 -4
- package/dist/stores/forms.js +86 -32
- package/dist/stores/index.d.ts +0 -1
- package/dist/stores/index.js +0 -1
- package/dist/types/customCode.d.ts +1 -1
- package/dist/types/webflow.d.ts +31 -47
- package/dist/types/window.d.ts +1 -0
- package/dist/ui/components/LoadingScreen.svelte +2 -1
- package/dist/ui/components/button/Button.svelte +1 -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/copy-text/CopyText.stories.d.ts +70 -0
- package/dist/ui/components/copy-text/CopyText.stories.js +241 -0
- package/dist/ui/components/copy-text/CopyText.svelte +249 -0
- package/dist/ui/components/copy-text/CopyText.svelte.d.ts +4 -0
- package/dist/ui/components/copy-text/index.d.ts +2 -0
- package/dist/ui/components/copy-text/index.js +1 -0
- package/dist/ui/components/copy-text/types.d.ts +52 -0
- package/dist/ui/components/copy-text/types.js +1 -0
- 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 +13 -39
- package/dist/ui/components/index.js +13 -39
- package/dist/ui/components/input/Input.stories.d.ts +33 -0
- package/dist/ui/components/input/Input.stories.js +176 -0
- package/dist/ui/components/input/Input.svelte +358 -81
- package/dist/ui/components/input/types.d.ts +33 -1
- package/dist/ui/components/layout/Layout.stories.svelte +3 -3
- package/dist/ui/components/layout/Layout.svelte +10 -64
- package/dist/ui/components/layout/Layout.svelte.d.ts +2 -2
- package/dist/ui/components/layout/common/EditModeMessage.svelte +24 -12
- package/dist/ui/components/layout/{ExampleLayout.svelte → examples/ExampleLayout.svelte} +56 -39
- package/dist/ui/components/layout/examples/Wrapper.svelte +9 -0
- package/dist/ui/components/{Header.svelte.d.ts → layout/examples/Wrapper.svelte.d.ts} +4 -6
- 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 +3 -2
- package/dist/ui/components/layout/index.js +2 -1
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte +20 -0
- package/dist/ui/components/layout/test-helpers/TestLayoutWithFooter.svelte.d.ts +7 -0
- package/dist/ui/components/layout/types.d.ts +1 -10
- 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 +239 -0
- package/dist/ui/components/{ToggleList.svelte.d.ts → notification/Notification.stories.svelte.d.ts} +9 -21
- package/dist/ui/components/notification/Notification.svelte +294 -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 +326 -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 +114 -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/components/text/Text.stories.svelte +67 -1
- package/dist/ui/components/text/Text.svelte +209 -8
- package/dist/ui/components/text/types.d.ts +4 -0
- package/dist/ui/index.css +33 -5
- package/dist/utils/animations/factory.d.ts +7 -0
- package/dist/utils/animations/factory.js +101 -0
- package/dist/utils/animations/index.d.ts +7 -0
- package/dist/utils/animations/index.js +62 -0
- package/dist/utils/animations/types.d.ts +39 -0
- package/dist/utils/animations/types.js +1 -0
- 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/custom-code/configs.d.ts +22 -0
- package/dist/utils/custom-code/configs.js +40 -0
- package/dist/utils/custom-code/index.d.ts +1 -0
- package/dist/utils/custom-code/index.js +1 -0
- package/dist/utils/helpers/capitalizeFirstLetter.d.ts +4 -0
- package/dist/utils/helpers/capitalizeFirstLetter.js +9 -0
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +1 -2
- package/dist/utils/helpers/cleanupTooltipMessage.js +1 -2
- package/dist/utils/helpers/getTimeNow.d.ts +4 -0
- package/dist/utils/helpers/getTimeNow.js +8 -0
- package/dist/utils/helpers/goto.d.ts +1 -4
- package/dist/utils/helpers/goto.js +2 -7
- package/dist/utils/helpers/index.d.ts +5 -0
- package/dist/utils/helpers/index.js +5 -0
- package/dist/utils/helpers/minifyCode.d.ts +10 -0
- package/dist/utils/helpers/minifyCode.js +73 -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 +2 -4
- package/dist/utils/helpers/objectsToModuleExports.js +2 -3
- package/dist/utils/helpers/toHumanReadableList.d.ts +4 -0
- package/dist/utils/helpers/toHumanReadableList.js +11 -0
- package/dist/utils/helpers/trimText.d.ts +1 -8
- package/dist/utils/helpers/trimText.js +1 -8
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +5 -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/getAllChildren.d.ts +16 -0
- package/dist/utils/webflow-canvas/getAllChildren.js +65 -0
- package/dist/utils/webflow-canvas/getAllPages.d.ts +3 -10
- package/dist/utils/webflow-canvas/getAllPages.js +3 -10
- package/dist/utils/webflow-canvas/getElementClassList.d.ts +9 -0
- package/dist/utils/webflow-canvas/getElementClassList.js +19 -0
- 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 +3 -0
- package/dist/utils/webflow-canvas/index.js +3 -0
- package/package.json +14 -2
- package/dist/router/README.md +0 -397
- 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/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/router/{Link.svelte.d.ts → providers/Link.svelte.d.ts} +0 -0
- /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
|
@@ -28,7 +28,8 @@ export interface InputProps extends Omit<HTMLInputAttributes, 'onblur' | 'onfocu
|
|
|
28
28
|
*/
|
|
29
29
|
color?: string;
|
|
30
30
|
/**
|
|
31
|
-
* Optional: If set it will add an element to the right of the input field and show the unit
|
|
31
|
+
* Optional: If set it will add an element to the right of the input field and show the unit.
|
|
32
|
+
* Cannot be used together with showSteppers
|
|
32
33
|
*/
|
|
33
34
|
units?: string;
|
|
34
35
|
/**
|
|
@@ -76,6 +77,29 @@ export interface InputProps extends Omit<HTMLInputAttributes, 'onblur' | 'onfocu
|
|
|
76
77
|
* Possible values: 'blue', 'gray', or null/undefined for no pill
|
|
77
78
|
*/
|
|
78
79
|
pill?: PillVariant;
|
|
80
|
+
/**
|
|
81
|
+
* Shows increment/decrement buttons for number inputs.
|
|
82
|
+
* Only available when type="number"
|
|
83
|
+
*/
|
|
84
|
+
showSteppers?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Step value for increment/decrement buttons.
|
|
87
|
+
*/
|
|
88
|
+
step?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Minimum value for number input.
|
|
91
|
+
*/
|
|
92
|
+
min?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Maximum value for number input.
|
|
95
|
+
*/
|
|
96
|
+
max?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Debounce delay in milliseconds for input events.
|
|
99
|
+
* When set, oninput will be debounced by this amount.
|
|
100
|
+
* Default is no debouncing (0).
|
|
101
|
+
*/
|
|
102
|
+
debounce?: number;
|
|
79
103
|
/**
|
|
80
104
|
* Event handler for input changes - receives the trimmed string value
|
|
81
105
|
*/
|
|
@@ -92,6 +116,11 @@ export interface InputProps extends Omit<HTMLInputAttributes, 'onblur' | 'onfocu
|
|
|
92
116
|
* Event handler for keydown events - receives the standard KeyboardEvent
|
|
93
117
|
*/
|
|
94
118
|
onkeydown?: (event: KeyboardEvent) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Event handler for numeric value changes - receives the numeric value
|
|
121
|
+
* Only called when showSteppers is true and value is a valid number
|
|
122
|
+
*/
|
|
123
|
+
onValueChange?: (value: number) => void;
|
|
95
124
|
/**
|
|
96
125
|
* Additional CSS classes
|
|
97
126
|
*/
|
|
@@ -107,3 +136,6 @@ export interface InputEvent {
|
|
|
107
136
|
export interface BlurEvent {
|
|
108
137
|
value: string;
|
|
109
138
|
}
|
|
139
|
+
export interface NumericValueChangeEvent {
|
|
140
|
+
value: number;
|
|
141
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { Wrapper } from './examples';
|
|
5
5
|
|
|
6
6
|
const { Story } = defineMeta({
|
|
7
7
|
title: 'UI/Layout',
|
|
8
|
-
component:
|
|
8
|
+
component: Wrapper,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
10
|
parameters: {
|
|
11
11
|
layout: 'centered',
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<Story name="Default">
|
|
23
|
-
<
|
|
23
|
+
<Wrapper />
|
|
24
24
|
</Story>
|
|
@@ -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,
|
|
@@ -11,13 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
import { Tooltip } from '../tooltip';
|
|
13
13
|
import { EditModeMessage } from './common';
|
|
14
|
-
import type {
|
|
14
|
+
import type { LayoutTab } from './types';
|
|
15
15
|
|
|
16
16
|
interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
17
17
|
activeTab: string;
|
|
18
18
|
tabs: LayoutTab[];
|
|
19
19
|
switchTab: (tab: string) => void;
|
|
20
|
-
footer?: LayoutFooter;
|
|
21
20
|
formKey: string;
|
|
22
21
|
editMode?: boolean;
|
|
23
22
|
showFooter?: boolean;
|
|
@@ -36,13 +35,13 @@
|
|
|
36
35
|
sidebar?: Snippet;
|
|
37
36
|
main?: Snippet;
|
|
38
37
|
previewBar?: Snippet;
|
|
38
|
+
footer?: Snippet;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
let {
|
|
42
42
|
activeTab,
|
|
43
43
|
tabs,
|
|
44
44
|
switchTab,
|
|
45
|
-
footer = { buttons: [] },
|
|
46
45
|
formKey,
|
|
47
46
|
editMode = false,
|
|
48
47
|
showFooter = true,
|
|
@@ -56,12 +55,12 @@
|
|
|
56
55
|
sidebar,
|
|
57
56
|
main,
|
|
58
57
|
previewBar,
|
|
58
|
+
footer,
|
|
59
59
|
class: className = '',
|
|
60
60
|
...restProps
|
|
61
61
|
}: LayoutProps = $props();
|
|
62
62
|
|
|
63
63
|
// Derived states
|
|
64
|
-
let hasFooterButtons = $derived(footer?.buttons && footer.buttons.length > 0);
|
|
65
64
|
let containerStyles = $derived(
|
|
66
65
|
containerMode ? 'height: 100%; width: 100%;' : 'height: 100vh; width: 100vw;'
|
|
67
66
|
);
|
|
@@ -93,7 +92,7 @@
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
// Handle footer row
|
|
96
|
-
if (showFooter &&
|
|
95
|
+
if (showFooter && footer) {
|
|
97
96
|
if (showSidebar) {
|
|
98
97
|
areas.push('"sidebar footer"');
|
|
99
98
|
} else {
|
|
@@ -118,7 +117,7 @@
|
|
|
118
117
|
|
|
119
118
|
rows.push('1fr'); // main content area takes remaining space
|
|
120
119
|
|
|
121
|
-
if (showFooter &&
|
|
120
|
+
if (showFooter && footer) {
|
|
122
121
|
rows.push(footerHeight);
|
|
123
122
|
}
|
|
124
123
|
|
|
@@ -198,7 +197,7 @@
|
|
|
198
197
|
|
|
199
198
|
<!-- Sidebar -->
|
|
200
199
|
{#if showSidebar}
|
|
201
|
-
<div class="sidebar" data-area="sidebar"
|
|
200
|
+
<div class="sidebar" data-area="sidebar">
|
|
202
201
|
{#if sidebar}
|
|
203
202
|
{@render sidebar()}
|
|
204
203
|
{:else}
|
|
@@ -217,9 +216,7 @@
|
|
|
217
216
|
<div class="main-content" data-area="main">
|
|
218
217
|
{#if main}
|
|
219
218
|
<div class="main-content-container">
|
|
220
|
-
|
|
221
|
-
<EditModeMessage />
|
|
222
|
-
{/if}
|
|
219
|
+
<EditModeMessage />
|
|
223
220
|
{@render main()}
|
|
224
221
|
</div>
|
|
225
222
|
{:else}
|
|
@@ -242,21 +239,9 @@
|
|
|
242
239
|
</div>
|
|
243
240
|
|
|
244
241
|
<!-- Footer -->
|
|
245
|
-
{#if showFooter &&
|
|
242
|
+
{#if showFooter && footer}
|
|
246
243
|
<div class="footer" data-area="footer">
|
|
247
|
-
{
|
|
248
|
-
<button
|
|
249
|
-
class="footer-button footer-button--{button.variant}"
|
|
250
|
-
disabled={editMode}
|
|
251
|
-
onclick={button.onClick}
|
|
252
|
-
>
|
|
253
|
-
{#if button.icon}
|
|
254
|
-
{@const Icon = button.icon}
|
|
255
|
-
<Icon />
|
|
256
|
-
{/if}
|
|
257
|
-
{button.text}
|
|
258
|
-
</button>
|
|
259
|
-
{/each}
|
|
244
|
+
{@render footer()}
|
|
260
245
|
</div>
|
|
261
246
|
{/if}
|
|
262
247
|
</div>
|
|
@@ -509,43 +494,4 @@
|
|
|
509
494
|
height: 100%;
|
|
510
495
|
overflow: hidden;
|
|
511
496
|
}
|
|
512
|
-
|
|
513
|
-
.footer-button {
|
|
514
|
-
display: flex;
|
|
515
|
-
padding: 4px 8px;
|
|
516
|
-
justify-content: center;
|
|
517
|
-
align-items: center;
|
|
518
|
-
gap: 2px;
|
|
519
|
-
border-radius: 4px;
|
|
520
|
-
border: 1px solid var(--border-border-1, #363636);
|
|
521
|
-
background: var(--background2);
|
|
522
|
-
color: var(--text1);
|
|
523
|
-
text-align: center;
|
|
524
|
-
font-family: Inter;
|
|
525
|
-
font-size: 11px;
|
|
526
|
-
font-style: normal;
|
|
527
|
-
font-weight: 400;
|
|
528
|
-
line-height: 16px;
|
|
529
|
-
cursor: pointer;
|
|
530
|
-
transition: all 0.2s ease-in-out;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
.footer-button--primary {
|
|
534
|
-
background: var(--action-action-primary-background-hover, #1280ee);
|
|
535
|
-
color: var(--actionPrimaryText);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.footer-button--secondary {
|
|
539
|
-
background: var(--background2);
|
|
540
|
-
color: var(--text1);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
.footer-button:hover:not(:disabled) {
|
|
544
|
-
opacity: 0.8;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
.footer-button:disabled {
|
|
548
|
-
opacity: 0.5;
|
|
549
|
-
cursor: not-allowed;
|
|
550
|
-
}
|
|
551
497
|
</style>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
import type {
|
|
3
|
+
import type { LayoutTab } from './types';
|
|
4
4
|
interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
activeTab: string;
|
|
6
6
|
tabs: LayoutTab[];
|
|
7
7
|
switchTab: (tab: string) => void;
|
|
8
|
-
footer?: LayoutFooter;
|
|
9
8
|
formKey: string;
|
|
10
9
|
editMode?: boolean;
|
|
11
10
|
showFooter?: boolean;
|
|
@@ -24,6 +23,7 @@ interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
24
23
|
sidebar?: Snippet;
|
|
25
24
|
main?: Snippet;
|
|
26
25
|
previewBar?: Snippet;
|
|
26
|
+
footer?: Snippet;
|
|
27
27
|
}
|
|
28
28
|
declare const Layout: import("svelte").Component<LayoutProps, {}, "">;
|
|
29
29
|
type Layout = ReturnType<typeof Layout>;
|
|
@@ -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,28 +25,30 @@
|
|
|
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 },
|
|
31
41
|
{ path: 'code', name: 'Code', icon: CodeIcon, isActive: false }
|
|
32
42
|
];
|
|
33
43
|
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 'main' as const,
|
|
45
|
-
text: 'Apply Settings',
|
|
46
|
-
variant: 'primary' as const,
|
|
47
|
-
onClick: () => console.log('Apply clicked')
|
|
48
|
-
}
|
|
49
|
-
];
|
|
44
|
+
// Footer button handlers
|
|
45
|
+
function handleSaveClick() {
|
|
46
|
+
console.log('Save clicked');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function handleApplyClick() {
|
|
50
|
+
console.log('Apply clicked');
|
|
51
|
+
}
|
|
50
52
|
|
|
51
53
|
// Create tabs with active state
|
|
52
54
|
let tabs = $derived(
|
|
@@ -79,17 +81,19 @@
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
onMount(() => {
|
|
82
|
-
|
|
84
|
+
appContext.set({
|
|
83
85
|
editMode: true,
|
|
84
|
-
componentKey: 'dummy-layout',
|
|
85
86
|
repairMode: false,
|
|
86
|
-
formKey: 'dummy-layout',
|
|
87
|
-
formUpdateKey: 'dummy-layout-update',
|
|
88
87
|
title: 'Example',
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
configurator: {
|
|
89
|
+
configurator: null,
|
|
90
|
+
configuratorCache: null,
|
|
91
|
+
hasChanged: false,
|
|
92
|
+
watchOptions: { watchAll: true, debounceMs: 50 }
|
|
91
93
|
}
|
|
92
94
|
});
|
|
95
|
+
// Initialize local editMode state
|
|
96
|
+
editMode = true;
|
|
93
97
|
});
|
|
94
98
|
</script>
|
|
95
99
|
|
|
@@ -181,9 +185,9 @@
|
|
|
181
185
|
bind:checked={editMode}
|
|
182
186
|
id="edit-mode"
|
|
183
187
|
class="checkbox-input"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
188
|
+
onchange={() => {
|
|
189
|
+
const current = appContext.get();
|
|
190
|
+
appContext.set({ ...current, editMode });
|
|
187
191
|
}}
|
|
188
192
|
/>
|
|
189
193
|
<label for="edit-mode" class="checkbox-label">Edit Mode</label>
|
|
@@ -222,7 +226,6 @@
|
|
|
222
226
|
{activeTab}
|
|
223
227
|
{tabs}
|
|
224
228
|
{switchTab}
|
|
225
|
-
footer={{ buttons: dummyFooterButtons }}
|
|
226
229
|
formKey="dummy-layout"
|
|
227
230
|
{editMode}
|
|
228
231
|
{showFooter}
|
|
@@ -306,12 +309,12 @@
|
|
|
306
309
|
width="130px"
|
|
307
310
|
/>
|
|
308
311
|
</div>
|
|
309
|
-
<
|
|
312
|
+
<Section clickable disabled>
|
|
310
313
|
<Text fontSize="md" fontWeight="normal">Clickable disabled</Text>
|
|
311
|
-
</
|
|
312
|
-
<
|
|
314
|
+
</Section>
|
|
315
|
+
<Section clickable>
|
|
313
316
|
<Text fontSize="md" fontWeight="normal">Clickable enabled</Text>
|
|
314
|
-
</
|
|
317
|
+
</Section>
|
|
315
318
|
{:else if activeTab === 'code'}
|
|
316
319
|
<Text fontSize="xl" fontWeight="normal">Code Editor Tab content</Text>
|
|
317
320
|
{/if}
|
|
@@ -320,6 +323,20 @@
|
|
|
320
323
|
{#snippet previewBar()}
|
|
321
324
|
<Text fontSize="md" fontWeight="normal">Preview bar content</Text>
|
|
322
325
|
{/snippet}
|
|
326
|
+
|
|
327
|
+
{#snippet footer()}
|
|
328
|
+
<Button
|
|
329
|
+
variant="secondary"
|
|
330
|
+
icon={CheckCircleIcon}
|
|
331
|
+
onclick={handleSaveClick}
|
|
332
|
+
disabled={editMode}
|
|
333
|
+
>
|
|
334
|
+
Save Changes
|
|
335
|
+
</Button>
|
|
336
|
+
<Button variant="primary" onclick={handleApplyClick} disabled={editMode}>
|
|
337
|
+
Apply Settings
|
|
338
|
+
</Button>
|
|
339
|
+
{/snippet}
|
|
323
340
|
</Layout>
|
|
324
341
|
</div>
|
|
325
342
|
</div>
|
|
@@ -2,7 +2,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
2
2
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
3
|
$$bindings?: Bindings;
|
|
4
4
|
} & Exports;
|
|
5
|
-
(internal: unknown, props:
|
|
5
|
+
(internal: unknown, props: {
|
|
6
6
|
$$events?: Events;
|
|
7
7
|
$$slots?: Slots;
|
|
8
8
|
}): Exports & {
|
|
@@ -11,10 +11,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
11
11
|
};
|
|
12
12
|
z_$$bindings?: Bindings;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
15
|
-
title?: string;
|
|
16
|
-
}, {
|
|
14
|
+
declare const Wrapper: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
17
15
|
[evt: string]: CustomEvent<any>;
|
|
18
16
|
}, {}, {}, string>;
|
|
19
|
-
type
|
|
20
|
-
export default
|
|
17
|
+
type Wrapper = InstanceType<typeof Wrapper>;
|
|
18
|
+
export default Wrapper;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as Layout } from './Layout.svelte';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export * from './examples';
|
|
3
|
+
export * from './common';
|
|
4
|
+
export type { LayoutProps, LayoutTab } from './types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CodeIcon, SettingsIcon } from '../../../icons';
|
|
3
|
+
import { Button } from '../../button';
|
|
4
|
+
import Layout from '../Layout.svelte';
|
|
5
|
+
import type { LayoutProps } from '../types';
|
|
6
|
+
|
|
7
|
+
interface TestLayoutWithFooterProps extends Omit<LayoutProps, 'footer'> {
|
|
8
|
+
footerText?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { footerText = 'Test Button', ...layoutProps }: TestLayoutWithFooterProps = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Layout {...layoutProps}>
|
|
15
|
+
{#snippet footer()}
|
|
16
|
+
<Button variant="primary" onclick={() => {}}>
|
|
17
|
+
{footerText}
|
|
18
|
+
</Button>
|
|
19
|
+
{/snippet}
|
|
20
|
+
</Layout>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LayoutProps } from '../types';
|
|
2
|
+
interface TestLayoutWithFooterProps extends Omit<LayoutProps, 'footer'> {
|
|
3
|
+
footerText?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const TestLayoutWithFooter: import("svelte").Component<TestLayoutWithFooterProps, {}, "">;
|
|
6
|
+
type TestLayoutWithFooter = ReturnType<typeof TestLayoutWithFooter>;
|
|
7
|
+
export default TestLayoutWithFooter;
|
|
@@ -7,15 +7,6 @@ export interface LayoutTab {
|
|
|
7
7
|
isActive: boolean;
|
|
8
8
|
hidden?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export interface LayoutFooter {
|
|
11
|
-
buttons: Array<{
|
|
12
|
-
id: string;
|
|
13
|
-
text: string;
|
|
14
|
-
variant: 'primary' | 'secondary';
|
|
15
|
-
icon?: Component;
|
|
16
|
-
onClick?: () => void;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
10
|
export interface LayoutNotification {
|
|
20
11
|
path: string;
|
|
21
12
|
success: boolean;
|
|
@@ -29,7 +20,7 @@ export interface LayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
29
20
|
main?: Snippet;
|
|
30
21
|
sidebar?: Snippet;
|
|
31
22
|
previewBar?: Snippet;
|
|
32
|
-
footer?:
|
|
23
|
+
footer?: Snippet;
|
|
33
24
|
formKey: string;
|
|
34
25
|
editMode?: boolean;
|
|
35
26
|
showFooter?: boolean;
|