@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
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Height of the divider
|
|
4
|
-
*/
|
|
5
|
-
export let height: string = '1px';
|
|
6
|
-
/**
|
|
7
|
-
* Width of the divider
|
|
8
|
-
*/
|
|
9
|
-
export let width: string = '100%';
|
|
10
|
-
/**
|
|
11
|
-
* Background color of the divider
|
|
12
|
-
*/
|
|
13
|
-
export let background: string = 'var(--border1)';
|
|
14
|
-
/**
|
|
15
|
-
* Orientation of the divider
|
|
16
|
-
*/
|
|
17
|
-
export let rotate = false;
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
class="divider"
|
|
22
|
-
style="height:{height}; width:{width};
|
|
23
|
-
background: {background};
|
|
24
|
-
{rotate ? 'transform: rotate(0deg)' : ''}"
|
|
25
|
-
></div>
|
|
26
|
-
|
|
27
|
-
<style>
|
|
28
|
-
.divider {
|
|
29
|
-
align-self: stretch;
|
|
30
|
-
}
|
|
31
|
-
</style>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
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> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Divider: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
/**
|
|
16
|
-
* Height of the divider
|
|
17
|
-
*/ height?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Width of the divider
|
|
20
|
-
*/ width?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Background color of the divider
|
|
23
|
-
*/ background?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Orientation of the divider
|
|
26
|
-
*/ rotate?: boolean;
|
|
27
|
-
}, {
|
|
28
|
-
[evt: string]: CustomEvent<any>;
|
|
29
|
-
}, {}, {}, string>;
|
|
30
|
-
type Divider = InstanceType<typeof Divider>;
|
|
31
|
-
export default Divider;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { TriangleDownIcon } from '../icons';
|
|
3
|
-
export let title = 'Header';
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<div class="header">
|
|
7
|
-
<TriangleDownIcon />
|
|
8
|
-
<span class="title">
|
|
9
|
-
{title}
|
|
10
|
-
</span>
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
<style>
|
|
14
|
-
.header {
|
|
15
|
-
display: flex;
|
|
16
|
-
padding: 6px 10px;
|
|
17
|
-
align-items: center;
|
|
18
|
-
gap: 8px;
|
|
19
|
-
border-bottom: 1px solid var(--border1, rgba(255, 255, 255, 0.13));
|
|
20
|
-
background: var(--background1, #1e1e1e);
|
|
21
|
-
}
|
|
22
|
-
.title {
|
|
23
|
-
color: var(--text-text-1, #d9d9d9);
|
|
24
|
-
font-family: Inter;
|
|
25
|
-
font-size: 12px;
|
|
26
|
-
font-style: normal;
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
line-height: 16px;
|
|
29
|
-
}
|
|
30
|
-
</style>
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { FINSWEET_REVERSE_PROXY_URL } from '../../utils';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The URL of the iframe
|
|
6
|
-
*/
|
|
7
|
-
export let src: string;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The ID of the iframe
|
|
11
|
-
*/
|
|
12
|
-
export let id: string;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The width of the iframe
|
|
16
|
-
*/
|
|
17
|
-
export let width: string = '100%';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The height of the iframe
|
|
21
|
-
*/
|
|
22
|
-
export let height: string = '100%';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The title of the iframe
|
|
26
|
-
*/
|
|
27
|
-
export let title: string = 'Iframe';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Event handler for successful iframe load
|
|
31
|
-
*/
|
|
32
|
-
export let onLoadSuccess: () => void = () => {};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Event handler for failed iframe load
|
|
36
|
-
*/
|
|
37
|
-
export let onLoadError: () => void = () => {};
|
|
38
|
-
|
|
39
|
-
let iframeElement: HTMLIFrameElement;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Handle the iframe load event
|
|
43
|
-
*/
|
|
44
|
-
const handleIframeLoad = () => {
|
|
45
|
-
const iframe = iframeElement;
|
|
46
|
-
|
|
47
|
-
if (iframe?.contentDocument) {
|
|
48
|
-
const iframeTitle = iframe.contentDocument.title;
|
|
49
|
-
const { body } = iframe.contentDocument;
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
body.childNodes.length === 0 ||
|
|
53
|
-
iframeTitle.indexOf('404') >= 0 ||
|
|
54
|
-
body.outerHTML.includes('<span>404</span>')
|
|
55
|
-
) {
|
|
56
|
-
// Notify parent of the error
|
|
57
|
-
onLoadError();
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Notify parent of successful load
|
|
62
|
-
onLoadSuccess();
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Notify parent of the error
|
|
68
|
-
onLoadError();
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<iframe
|
|
73
|
-
{id}
|
|
74
|
-
bind:this={iframeElement}
|
|
75
|
-
{title}
|
|
76
|
-
src={`${FINSWEET_REVERSE_PROXY_URL}${src}`}
|
|
77
|
-
on:load={handleIframeLoad}
|
|
78
|
-
class="iframe"
|
|
79
|
-
{width}
|
|
80
|
-
{height}
|
|
81
|
-
></iframe>
|
|
82
|
-
|
|
83
|
-
<style>
|
|
84
|
-
.iframe {
|
|
85
|
-
border: none;
|
|
86
|
-
border-radius: 4px;
|
|
87
|
-
background: var(--text2);
|
|
88
|
-
}
|
|
89
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
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> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const Iframe: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
/**
|
|
16
|
-
* The URL of the iframe
|
|
17
|
-
*/ src: string;
|
|
18
|
-
/**
|
|
19
|
-
* The ID of the iframe
|
|
20
|
-
*/ id: string;
|
|
21
|
-
/**
|
|
22
|
-
* The width of the iframe
|
|
23
|
-
*/ width?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The height of the iframe
|
|
26
|
-
*/ height?: string;
|
|
27
|
-
/**
|
|
28
|
-
* The title of the iframe
|
|
29
|
-
*/ title?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Event handler for successful iframe load
|
|
32
|
-
*/ onLoadSuccess?: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* Event handler for failed iframe load
|
|
35
|
-
*/ onLoadError?: () => void;
|
|
36
|
-
}, {
|
|
37
|
-
[evt: string]: CustomEvent<any>;
|
|
38
|
-
}, {}, {}, string>;
|
|
39
|
-
type Iframe = InstanceType<typeof Iframe>;
|
|
40
|
-
export default Iframe;
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
-
import { writable } from 'svelte/store';
|
|
4
|
-
|
|
5
|
-
import { componentInjectErrors } from '../../stores';
|
|
6
|
-
import { FINSWEET_REVERSE_PROXY_URL } from '../../utils';
|
|
7
|
-
|
|
8
|
-
import LoadingScreen from './LoadingScreen.svelte';
|
|
9
|
-
|
|
10
|
-
export let sourceUrl: string;
|
|
11
|
-
export let elementId: string;
|
|
12
|
-
const targetId = 'target-content';
|
|
13
|
-
|
|
14
|
-
const loadingStore = writable(true);
|
|
15
|
-
const dispatch = createEventDispatcher<{
|
|
16
|
-
error: { message: string; error: unknown };
|
|
17
|
-
ready: boolean;
|
|
18
|
-
}>();
|
|
19
|
-
|
|
20
|
-
let errorMessage = '';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Handle errors when injecting a component
|
|
24
|
-
*/
|
|
25
|
-
function handleError(message: string, error: unknown, consoleDetails?: unknown) {
|
|
26
|
-
componentInjectErrors.set(true);
|
|
27
|
-
|
|
28
|
-
dispatch('error', {
|
|
29
|
-
message,
|
|
30
|
-
error
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// Update local state
|
|
34
|
-
errorMessage = message;
|
|
35
|
-
loadingStore.set(false);
|
|
36
|
-
|
|
37
|
-
// Dispatch ready event with false to indicate error state
|
|
38
|
-
dispatch('ready', false);
|
|
39
|
-
|
|
40
|
-
throw new Error('Failed to load Component preview, please try again or contact support');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Imports and renders a component from Webflow
|
|
45
|
-
*/
|
|
46
|
-
async function importFromWebflow() {
|
|
47
|
-
try {
|
|
48
|
-
const url = `${FINSWEET_REVERSE_PROXY_URL}${sourceUrl}`;
|
|
49
|
-
const response = await fetch(url);
|
|
50
|
-
if (!response.ok) {
|
|
51
|
-
handleError(
|
|
52
|
-
`Failed to fetch: ${response.statusText}`,
|
|
53
|
-
new Error(`Failed to fetch: ${response.statusText}`),
|
|
54
|
-
response
|
|
55
|
-
);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const html = await response.text();
|
|
59
|
-
|
|
60
|
-
const parser = new DOMParser();
|
|
61
|
-
const doc = parser.parseFromString(html, 'text/html');
|
|
62
|
-
|
|
63
|
-
const sourceElement = doc.getElementById(elementId);
|
|
64
|
-
if (!sourceElement) {
|
|
65
|
-
handleError(
|
|
66
|
-
`Element with ID "${elementId}" not found`,
|
|
67
|
-
new Error(`Element with ID "${elementId}" not found`)
|
|
68
|
-
);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const styles = Array.from(doc.querySelectorAll('style, link[rel="stylesheet"]'))
|
|
73
|
-
.map((el) => el.outerHTML)
|
|
74
|
-
.join('\n');
|
|
75
|
-
|
|
76
|
-
const headScripts = Array.from(doc.head.querySelectorAll('script'))
|
|
77
|
-
.map((el) => el.outerHTML)
|
|
78
|
-
.join('\n');
|
|
79
|
-
|
|
80
|
-
const bodyScripts = Array.from(doc.body.querySelectorAll('script'))
|
|
81
|
-
.map((el) => el.outerHTML)
|
|
82
|
-
.join('\n');
|
|
83
|
-
|
|
84
|
-
const targetElement = document.getElementById(targetId);
|
|
85
|
-
if (!targetElement) {
|
|
86
|
-
handleError(
|
|
87
|
-
`Target element with ID "${targetId}" not found`,
|
|
88
|
-
new Error(`Target element with ID "${targetId}" not found`)
|
|
89
|
-
);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
targetElement.innerHTML = '';
|
|
94
|
-
|
|
95
|
-
const shadowContainer = document.createElement('div');
|
|
96
|
-
shadowContainer.style.display = 'contents';
|
|
97
|
-
const shadowRoot = shadowContainer.attachShadow({ mode: 'open' });
|
|
98
|
-
|
|
99
|
-
const iframe = document.createElement('iframe');
|
|
100
|
-
iframe.style.width = '1280px';
|
|
101
|
-
iframe.style.height = '720px';
|
|
102
|
-
iframe.style.border = 'none';
|
|
103
|
-
iframe.style.display = 'block';
|
|
104
|
-
iframe.style.transform = 'scale(calc(100% / 1280))';
|
|
105
|
-
iframe.style.transformOrigin = 'top left';
|
|
106
|
-
iframe.setAttribute('scrolling', 'no');
|
|
107
|
-
|
|
108
|
-
const iframeWrapper = document.createElement('div');
|
|
109
|
-
iframeWrapper.style.width = '100%';
|
|
110
|
-
iframeWrapper.style.height = '100%';
|
|
111
|
-
iframeWrapper.style.overflow = 'hidden';
|
|
112
|
-
iframeWrapper.style.position = 'relative';
|
|
113
|
-
iframeWrapper.appendChild(iframe);
|
|
114
|
-
|
|
115
|
-
shadowRoot.appendChild(iframeWrapper);
|
|
116
|
-
|
|
117
|
-
let lastWidth = 0;
|
|
118
|
-
const updateIframeScale = () => {
|
|
119
|
-
const containerWidth = iframeWrapper.clientWidth;
|
|
120
|
-
if (containerWidth === lastWidth || containerWidth === 0) return;
|
|
121
|
-
lastWidth = containerWidth;
|
|
122
|
-
|
|
123
|
-
const scale = containerWidth / 1280;
|
|
124
|
-
iframe.style.transform = `scale(${scale})`;
|
|
125
|
-
|
|
126
|
-
const scaledHeight = Math.ceil(720 * scale);
|
|
127
|
-
iframeWrapper.style.height = `${scaledHeight}px`;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
window.addEventListener('resize', () => {
|
|
131
|
-
requestAnimationFrame(updateIframeScale);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
setTimeout(updateIframeScale, 100);
|
|
135
|
-
|
|
136
|
-
const htmlAttrs = Array.from(doc.documentElement.attributes)
|
|
137
|
-
.map((attr) => `${attr.name}="${attr.value}"`)
|
|
138
|
-
.join(' ');
|
|
139
|
-
|
|
140
|
-
const bodyAttrs = Array.from(doc.body.attributes)
|
|
141
|
-
.map((attr) => `${attr.name}="${attr.value}"`)
|
|
142
|
-
.join(' ');
|
|
143
|
-
|
|
144
|
-
const iframeContent = `
|
|
145
|
-
<!DOCTYPE html>
|
|
146
|
-
<html ${htmlAttrs}>
|
|
147
|
-
<head>
|
|
148
|
-
<meta charset="UTF-8">
|
|
149
|
-
<meta name="viewport" content="width=1280, height=720, initial-scale=1.0">
|
|
150
|
-
<base href="${new URL('/', sourceUrl).href}">
|
|
151
|
-
${styles}
|
|
152
|
-
${headScripts}
|
|
153
|
-
<style>
|
|
154
|
-
html, body {
|
|
155
|
-
width: 1280px;
|
|
156
|
-
height: 720px;
|
|
157
|
-
margin: 0;
|
|
158
|
-
padding: 0;
|
|
159
|
-
border-radius: 4px;
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
background-color: #353535;
|
|
162
|
-
}
|
|
163
|
-
</style>
|
|
164
|
-
</head>
|
|
165
|
-
<body ${bodyAttrs} data-source-url="${sourceUrl}" data-element-id="${elementId}">
|
|
166
|
-
${sourceElement.outerHTML}
|
|
167
|
-
${bodyScripts}
|
|
168
|
-
</body>
|
|
169
|
-
</html>
|
|
170
|
-
`;
|
|
171
|
-
|
|
172
|
-
iframe.srcdoc = iframeContent;
|
|
173
|
-
|
|
174
|
-
iframe.onload = () => {
|
|
175
|
-
updateIframeScale();
|
|
176
|
-
|
|
177
|
-
try {
|
|
178
|
-
const iframeDoc = iframe.contentDocument || iframe.contentWindow?.document;
|
|
179
|
-
|
|
180
|
-
if (!iframeDoc) return;
|
|
181
|
-
|
|
182
|
-
const existingBadges = iframeDoc.querySelectorAll('a.w-webflow-badge');
|
|
183
|
-
existingBadges.forEach((badge) => badge.remove());
|
|
184
|
-
|
|
185
|
-
const script = iframeDoc.createElement('script');
|
|
186
|
-
script.textContent = `
|
|
187
|
-
(function() {
|
|
188
|
-
|
|
189
|
-
function removeBadge() {
|
|
190
|
-
const badges = document.querySelectorAll('a.w-webflow-badge');
|
|
191
|
-
if (badges.length > 0) {
|
|
192
|
-
badges.forEach(badge => badge.remove());
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
removeBadge();
|
|
197
|
-
|
|
198
|
-
const observer = new MutationObserver(mutations => {
|
|
199
|
-
mutations.forEach(mutation => {
|
|
200
|
-
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
|
|
201
|
-
for (let i = 0; i < mutation.addedNodes.length; i++) {
|
|
202
|
-
const node = mutation.addedNodes[i];
|
|
203
|
-
|
|
204
|
-
if (node.nodeType === 1) {
|
|
205
|
-
if (node.matches && node.matches('a.w-webflow-badge')) {
|
|
206
|
-
node.remove();
|
|
207
|
-
} else if (node.querySelectorAll) {
|
|
208
|
-
const badges = node.querySelectorAll('a.w-webflow-badge');
|
|
209
|
-
badges.forEach(badge => badge.remove());
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
observer.observe(document.body, {
|
|
218
|
-
childList: true,
|
|
219
|
-
subtree: true
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
setInterval(removeBadge, 1000);
|
|
223
|
-
})();
|
|
224
|
-
`;
|
|
225
|
-
|
|
226
|
-
iframeDoc.body.appendChild(script);
|
|
227
|
-
} catch (err) {
|
|
228
|
-
handleError('Failed to inject badge removal script', err);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
targetElement.appendChild(shadowContainer);
|
|
233
|
-
|
|
234
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
235
|
-
|
|
236
|
-
loadingStore.set(false);
|
|
237
|
-
|
|
238
|
-
// Dispatch ready event with true to indicate successful loading
|
|
239
|
-
dispatch('ready', true);
|
|
240
|
-
} catch (error) {
|
|
241
|
-
const message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
242
|
-
handleError(`Import failed: ${message}`, error);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
onMount(() => {
|
|
247
|
-
importFromWebflow();
|
|
248
|
-
});
|
|
249
|
-
</script>
|
|
250
|
-
|
|
251
|
-
<div class="inject-wrapper">
|
|
252
|
-
<LoadingScreen
|
|
253
|
-
backgroundColor="var(--background1)"
|
|
254
|
-
active={$loadingStore || !!errorMessage}
|
|
255
|
-
spinnerSize={30}
|
|
256
|
-
message={errorMessage ? errorMessage : 'Loading Component preview...'}
|
|
257
|
-
position="absolute"
|
|
258
|
-
error={!!errorMessage}
|
|
259
|
-
/>
|
|
260
|
-
|
|
261
|
-
<div
|
|
262
|
-
class="inject-target"
|
|
263
|
-
id={targetId}
|
|
264
|
-
data-target-href={sourceUrl}
|
|
265
|
-
data-target-id={elementId}
|
|
266
|
-
></div>
|
|
267
|
-
</div>
|
|
268
|
-
|
|
269
|
-
<style>
|
|
270
|
-
.inject-wrapper {
|
|
271
|
-
width: 100%;
|
|
272
|
-
position: relative;
|
|
273
|
-
overflow: hidden;
|
|
274
|
-
height: 420px;
|
|
275
|
-
background-color: var(--background1);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
.inject-target {
|
|
279
|
-
height: 420px;
|
|
280
|
-
background-color: var(--background1);
|
|
281
|
-
width: 100%;
|
|
282
|
-
border-radius: 4px;
|
|
283
|
-
overflow: hidden;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#target-content {
|
|
287
|
-
width: 100%;
|
|
288
|
-
height: 100%;
|
|
289
|
-
transition: all 0.3s ease;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
@keyframes spin {
|
|
293
|
-
to {
|
|
294
|
-
transform: rotate(360deg);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
</style>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
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> {
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const InjectComponent: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
sourceUrl: string;
|
|
16
|
-
elementId: string;
|
|
17
|
-
}, {
|
|
18
|
-
error: CustomEvent<{
|
|
19
|
-
message: string;
|
|
20
|
-
error: unknown;
|
|
21
|
-
}>;
|
|
22
|
-
ready: CustomEvent<boolean>;
|
|
23
|
-
} & {
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
}, {}, {}, string>;
|
|
26
|
-
type InjectComponent = InstanceType<typeof InjectComponent>;
|
|
27
|
-
export default InjectComponent;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
NOTE: There is a custom Modal that uses DIVs only, checkout ./CustomModal.svelte
|
|
3
|
-
This CustomModal was made with the purpose of overcoming the z-index property of dialog element
|
|
4
|
-
It uses the same APIs made available as this
|
|
5
|
-
-->
|
|
6
|
-
<script lang="ts">
|
|
7
|
-
import { onMount } from 'svelte';
|
|
8
|
-
|
|
9
|
-
import { CloseIcon } from '../icons';
|
|
10
|
-
|
|
11
|
-
// Example Use: https://svelte.dev/examples/modal
|
|
12
|
-
export let showModal: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* If true, the header bar will not be shown.
|
|
15
|
-
*/
|
|
16
|
-
export let showHeader: boolean = true;
|
|
17
|
-
export let padding: string = 'var(--padding-regular)';
|
|
18
|
-
let dialog: HTMLDialogElement;
|
|
19
|
-
let button: HTMLButtonElement;
|
|
20
|
-
|
|
21
|
-
onMount(() => {
|
|
22
|
-
button.focus();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
$: {
|
|
26
|
-
if (dialog) {
|
|
27
|
-
if (showModal) {
|
|
28
|
-
dialog.showModal();
|
|
29
|
-
} else {
|
|
30
|
-
dialog.close();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Handles the keydown event on the dialog element.
|
|
37
|
-
* @param event
|
|
38
|
-
*/
|
|
39
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
40
|
-
if (e.key === 'Escape') dialog.close();
|
|
41
|
-
};
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<dialog
|
|
45
|
-
bind:this={dialog}
|
|
46
|
-
on:close={() => {
|
|
47
|
-
showModal = false;
|
|
48
|
-
}}
|
|
49
|
-
on:click|self={() => dialog.close()}
|
|
50
|
-
on:keydown|self={handleKeyDown}
|
|
51
|
-
>
|
|
52
|
-
<div
|
|
53
|
-
on:click|stopPropagation
|
|
54
|
-
on:keydown|stopPropagation
|
|
55
|
-
tabindex="0"
|
|
56
|
-
role="button"
|
|
57
|
-
style="padding:{padding};"
|
|
58
|
-
>
|
|
59
|
-
<div class="header-bar" style="display: {showHeader ? 'flex' : 'none'}">
|
|
60
|
-
<slot class="flex-grow" name="header" />
|
|
61
|
-
<button on:click={() => dialog.close()} bind:this={button}><CloseIcon /></button>
|
|
62
|
-
</div>
|
|
63
|
-
<slot />
|
|
64
|
-
</div>
|
|
65
|
-
</dialog>
|
|
66
|
-
|
|
67
|
-
<style>
|
|
68
|
-
dialog {
|
|
69
|
-
max-width: 42em;
|
|
70
|
-
border-radius: var(--border-radius);
|
|
71
|
-
border: none;
|
|
72
|
-
padding: 0;
|
|
73
|
-
background: var(--background1);
|
|
74
|
-
color: var(--text1);
|
|
75
|
-
}
|
|
76
|
-
dialog::backdrop {
|
|
77
|
-
z-index: 9999990;
|
|
78
|
-
background: rgba(0, 0, 0, 0.4);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
dialog[open] {
|
|
82
|
-
animation: zoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
83
|
-
}
|
|
84
|
-
@keyframes zoom {
|
|
85
|
-
from {
|
|
86
|
-
transform: scale(0.95);
|
|
87
|
-
}
|
|
88
|
-
to {
|
|
89
|
-
transform: scale(1);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
dialog[open]::backdrop {
|
|
93
|
-
animation: fade 0.2s ease-out;
|
|
94
|
-
}
|
|
95
|
-
@keyframes fade {
|
|
96
|
-
from {
|
|
97
|
-
opacity: 0;
|
|
98
|
-
}
|
|
99
|
-
to {
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
button {
|
|
104
|
-
border: none;
|
|
105
|
-
cursor: default;
|
|
106
|
-
user-select: none;
|
|
107
|
-
width: 24px;
|
|
108
|
-
padding: 0px 4px;
|
|
109
|
-
font-family: inherit;
|
|
110
|
-
font-size: inherit;
|
|
111
|
-
position: relative;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
height: 24px;
|
|
116
|
-
border-radius: 4px;
|
|
117
|
-
color: rgb(171, 171, 171);
|
|
118
|
-
background: transparent;
|
|
119
|
-
box-sizing: border-box;
|
|
120
|
-
box-shadow: none;
|
|
121
|
-
align-self: center;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
button:hover {
|
|
125
|
-
color: var(--text1);
|
|
126
|
-
background: var(--hoverColor);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.header-bar {
|
|
130
|
-
display: flex;
|
|
131
|
-
align-items: center;
|
|
132
|
-
justify-content: space-between;
|
|
133
|
-
padding-bottom: var(--padding-small);
|
|
134
|
-
border-bottom: 1px solid var(--border1);
|
|
135
|
-
gap: 4px;
|
|
136
|
-
width: 100%;
|
|
137
|
-
margin-bottom: var(--padding-regular);
|
|
138
|
-
}
|
|
139
|
-
</style>
|