@finsweet/webflow-apps-utils 1.0.7 → 1.0.9

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.
Files changed (141) hide show
  1. package/dist/index.d.ts +0 -3
  2. package/dist/index.js +0 -3
  3. package/dist/types/customCode.d.ts +1 -1
  4. package/dist/ui/components/Loader.svelte +0 -2
  5. package/dist/ui/components/button/Button.stories.svelte +0 -8
  6. package/dist/ui/components/button/Button.svelte +68 -76
  7. package/dist/ui/components/button/index.d.ts +1 -1
  8. package/dist/ui/components/button/index.js +1 -0
  9. package/dist/ui/components/controlled-buttons/ControlledButtons.svelte +17 -7
  10. package/dist/ui/components/copy-text/CopyText.svelte +48 -39
  11. package/dist/ui/components/divider/Divider.stories.svelte +0 -4
  12. package/dist/ui/components/input/index.d.ts +1 -1
  13. package/dist/ui/components/input/index.js +1 -0
  14. package/dist/ui/components/layout/Layout.svelte +0 -6
  15. package/dist/ui/components/layout/common/EditModeMessage.svelte +1 -1
  16. package/dist/ui/components/layout/examples/ExampleLayout.svelte +2 -9
  17. package/dist/ui/components/layout/examples/Wrapper.svelte +1 -1
  18. package/dist/ui/components/modal/Example.svelte +0 -7
  19. package/dist/ui/components/modal/Modal.stories.svelte +0 -2
  20. package/dist/ui/components/modal/Modal.svelte +1 -1
  21. package/dist/ui/components/notification/Notification.stories.svelte +0 -8
  22. package/dist/ui/components/section/Section.stories.svelte +0 -1
  23. package/dist/ui/components/text/README.md +0 -2
  24. package/dist/ui/components/text/Text.stories.svelte +0 -6
  25. package/dist/ui/components/text/Text.svelte +0 -19
  26. package/dist/ui/components/tooltip/Tooltip.svelte +9 -4
  27. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte +17 -0
  28. package/dist/ui/icons/FinsweetLogoOutlineIcon.svelte.d.ts +26 -0
  29. package/dist/ui/icons/TriangleDownIconToggle.svelte +0 -1
  30. package/dist/ui/icons/index.d.ts +2 -1
  31. package/dist/ui/icons/index.js +2 -1
  32. package/dist/ui/index.css +1 -1
  33. package/dist/ui/index.d.ts +4 -0
  34. package/dist/ui/index.js +4 -0
  35. package/dist/{providers → ui/providers}/GlobalProvider.stories.js +7 -7
  36. package/dist/{providers → ui/providers}/GlobalProvider.svelte +1 -1
  37. package/dist/{providers → ui/providers}/GlobalProviderDemo.svelte +0 -2
  38. package/dist/{router → ui/router}/Router.stories.js +7 -7
  39. package/dist/{router → ui/router}/examples/RouterExample.svelte +0 -9
  40. package/dist/{router → ui/router}/examples/pages/AboutPage.svelte +0 -4
  41. package/dist/{router → ui/router}/providers/Link.svelte +0 -2
  42. package/dist/{router → ui/router}/providers/Route.svelte +0 -3
  43. package/dist/{router → ui/router}/providers/RouterProvider.svelte +1 -1
  44. package/dist/{router → ui/router}/router.svelte.d.ts +0 -1
  45. package/dist/{router → ui/router}/router.svelte.js +3 -2
  46. package/dist/ui/stores/form.d.ts +280 -0
  47. package/dist/{stores/forms.js → ui/stores/form.js} +310 -2
  48. package/dist/{stores → ui/stores}/forms/Form.stories.js +5 -5
  49. package/dist/{stores → ui/stores}/forms/FormDemo.svelte +1 -1
  50. package/dist/{stores → ui/stores}/index.d.ts +1 -3
  51. package/dist/{stores → ui/stores}/index.js +1 -3
  52. package/dist/ui/utils/api/checkIfAppModeIsDesign.d.ts +4 -0
  53. package/dist/ui/utils/api/checkIfAppModeIsDesign.js +19 -0
  54. package/dist/ui/utils/api/clipboard/handlePaste.d.ts +15 -0
  55. package/dist/ui/utils/api/clipboard/handlePaste.js +49 -0
  56. package/dist/ui/utils/api/clipboard/index.d.ts +1 -0
  57. package/dist/ui/utils/api/clipboard/index.js +1 -0
  58. package/dist/ui/utils/api/getAllAssets.d.ts +11 -0
  59. package/dist/ui/utils/api/getAllAssets.js +20 -0
  60. package/dist/ui/utils/api/getFinsweetComponentsEnvironment.d.ts +8 -0
  61. package/dist/ui/utils/api/getFinsweetComponentsEnvironment.js +66 -0
  62. package/dist/ui/utils/api/index.d.ts +5 -0
  63. package/dist/ui/utils/api/index.js +5 -0
  64. package/dist/ui/utils/api/insertWithXSCP.d.ts +4 -0
  65. package/dist/ui/utils/api/insertWithXSCP.js +12 -0
  66. package/dist/{utils → ui/utils}/auth/crossWindowLogin.d.ts +1 -1
  67. package/dist/{utils → ui/utils}/auth/crossWindowLogin.js +1 -1
  68. package/dist/{utils → ui/utils}/auth/index.d.ts +1 -1
  69. package/dist/{utils → ui/utils}/auth/index.js +4 -6
  70. package/dist/{utils → ui/utils}/diff-mapper/DiffMapper.stories.js +2 -2
  71. package/dist/{utils → ui/utils}/diff-mapper/DiffMapperDemo.svelte +1 -1
  72. package/dist/{utils → ui/utils}/helpers/goto.js +2 -4
  73. package/dist/ui/utils/helpers/index.d.ts +1 -0
  74. package/dist/ui/utils/helpers/index.js +1 -0
  75. package/dist/ui/utils/index.d.ts +3 -0
  76. package/dist/ui/utils/index.js +3 -0
  77. package/dist/utils/custom-code/api.d.ts +1 -1
  78. package/dist/utils/custom-code/api.js +4 -6
  79. package/dist/utils/custom-code/configs.d.ts +3 -2
  80. package/dist/utils/custom-code/configs.js +5 -8
  81. package/dist/utils/custom-code/index.d.ts +1 -1
  82. package/dist/utils/custom-code/index.js +1 -1
  83. package/dist/utils/helpers/index.d.ts +0 -1
  84. package/dist/utils/helpers/index.js +0 -1
  85. package/dist/utils/index.d.ts +2 -3
  86. package/dist/utils/index.js +1 -3
  87. package/dist/utils/logger/index.d.ts +1 -2
  88. package/dist/utils/stores/index.d.ts +2 -0
  89. package/dist/utils/stores/index.js +2 -0
  90. package/package.json +13 -4
  91. package/dist/stores/forms.d.ts +0 -147
  92. /package/dist/{providers → ui/providers}/GlobalProvider.stories.d.ts +0 -0
  93. /package/dist/{providers → ui/providers}/GlobalProvider.svelte.d.ts +0 -0
  94. /package/dist/{providers → ui/providers}/GlobalProviderDemo.svelte.d.ts +0 -0
  95. /package/dist/{providers → ui/providers}/configuratorUtils.d.ts +0 -0
  96. /package/dist/{providers → ui/providers}/configuratorUtils.js +0 -0
  97. /package/dist/{providers → ui/providers}/globalContext.svelte.d.ts +0 -0
  98. /package/dist/{providers → ui/providers}/globalContext.svelte.js +0 -0
  99. /package/dist/{providers → ui/providers}/index.d.ts +0 -0
  100. /package/dist/{providers → ui/providers}/index.js +0 -0
  101. /package/dist/{providers → ui/providers}/types.d.ts +0 -0
  102. /package/dist/{providers → ui/providers}/types.js +0 -0
  103. /package/dist/{router → ui/router}/Router.stories.d.ts +0 -0
  104. /package/dist/{router → ui/router}/examples/RouterExample.svelte.d.ts +0 -0
  105. /package/dist/{router → ui/router}/examples/index.d.ts +0 -0
  106. /package/dist/{router → ui/router}/examples/index.js +0 -0
  107. /package/dist/{router → ui/router}/examples/pages/AboutPage.svelte.d.ts +0 -0
  108. /package/dist/{router → ui/router}/examples/pages/HomePage.svelte +0 -0
  109. /package/dist/{router → ui/router}/examples/pages/HomePage.svelte.d.ts +0 -0
  110. /package/dist/{router → ui/router}/examples/pages/NotFoundPage.svelte +0 -0
  111. /package/dist/{router → ui/router}/examples/pages/NotFoundPage.svelte.d.ts +0 -0
  112. /package/dist/{router → ui/router}/hooks.svelte.d.ts +0 -0
  113. /package/dist/{router → ui/router}/hooks.svelte.js +0 -0
  114. /package/dist/{router → ui/router}/index.d.ts +0 -0
  115. /package/dist/{router → ui/router}/index.js +0 -0
  116. /package/dist/{router → ui/router}/providers/Link.svelte.d.ts +0 -0
  117. /package/dist/{router → ui/router}/providers/Route.svelte.d.ts +0 -0
  118. /package/dist/{router → ui/router}/providers/RouterProvider.svelte.d.ts +0 -0
  119. /package/dist/{router → ui/router}/providers/index.d.ts +0 -0
  120. /package/dist/{router → ui/router}/providers/index.js +0 -0
  121. /package/dist/{stores → ui/stores}/breakpoints.d.ts +0 -0
  122. /package/dist/{stores → ui/stores}/breakpoints.js +0 -0
  123. /package/dist/{stores → ui/stores}/componentInjectErrors.d.ts +0 -0
  124. /package/dist/{stores → ui/stores}/componentInjectErrors.js +0 -0
  125. /package/dist/{stores → ui/stores}/forms/Form.stories.d.ts +0 -0
  126. /package/dist/{stores → ui/stores}/forms/FormDemo.svelte.d.ts +0 -0
  127. /package/dist/{stores → ui/stores}/showConfirmActionModal.d.ts +0 -0
  128. /package/dist/{stores → ui/stores}/showConfirmActionModal.js +0 -0
  129. /package/dist/{stores → ui/stores}/siteInfo.d.ts +0 -0
  130. /package/dist/{stores → ui/stores}/siteInfo.js +0 -0
  131. /package/dist/{utils → ui/utils}/diff-mapper/DiffMapper.stories.d.ts +0 -0
  132. /package/dist/{utils → ui/utils}/diff-mapper/DiffMapperDemo.svelte.d.ts +0 -0
  133. /package/dist/{utils → ui/utils}/diff-mapper/deepDiffMapper.d.ts +0 -0
  134. /package/dist/{utils → ui/utils}/diff-mapper/deepDiffMapper.js +0 -0
  135. /package/dist/{utils → ui/utils}/diff-mapper/index.d.ts +0 -0
  136. /package/dist/{utils → ui/utils}/diff-mapper/index.js +0 -0
  137. /package/dist/{utils → ui/utils}/helpers/goto.d.ts +0 -0
  138. /package/dist/{stores → utils/stores}/isPreviewMode.d.ts +0 -0
  139. /package/dist/{stores → utils/stores}/isPreviewMode.js +0 -0
  140. /package/dist/{stores → utils/stores}/router.d.ts +0 -0
  141. /package/dist/{stores → utils/stores}/router.js +0 -0
@@ -1,12 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import Cookies from 'js-cookie';
3
3
  import { get, writable } from 'svelte/store';
4
+ import { getLocalStorage, removeLocalStorage, setLocalStorage } from '../../../utils';
5
+ import { FINSWEET_SUBSCRIPTIONS_ENDPOINT, FINSWEET_SUBSCRIPTIONS_ENDPOINT_STAGING } from '../../../utils/constants';
4
6
  import { getFinsweetComponentsEnvironment } from '../api';
5
- import { getLocalStorage, removeLocalStorage, setLocalStorage } from '../browser-storage';
6
- import { FINSWEET_SUBSCRIPTIONS_ENDPOINT, FINSWEET_SUBSCRIPTIONS_ENDPOINT_STAGING } from '../constants';
7
- import { getLogger } from '../logger';
8
7
  import { crossWindowLogin } from './crossWindowLogin';
9
- const logger = getLogger('webflow-apps-ui-utils');
10
8
  /**
11
9
  * Store for the Finsweet user data.
12
10
  */
@@ -51,7 +49,7 @@ export const getSubscriptions = async (token) => {
51
49
  return data;
52
50
  }
53
51
  catch (error) {
54
- logger.error({}, 'Failed to fetch subscriptions', error);
52
+ console.error('Failed to fetch subscriptions', error);
55
53
  return [];
56
54
  }
57
55
  };
@@ -95,7 +93,7 @@ export const handleLogin = async () => {
95
93
  }
96
94
  catch (error) {
97
95
  const err = error;
98
- logger.error({}, 'Login failed:', err.message);
96
+ console.error('Login failed:', err.message);
99
97
  finsweetUser.set(null);
100
98
  webflow.notify({
101
99
  type: 'Error',
@@ -131,7 +131,7 @@ Automatic cache cleanup when size exceeds 100 entries or TTL expires.
131
131
  The diff mapper is seamlessly integrated with the GlobalProvider system:
132
132
 
133
133
  \`\`\`typescript
134
- import { useConfiguratorContext } from '../../providers';
134
+ import { useConfiguratorContext } from '../../../providers';
135
135
 
136
136
  const configurator = useConfiguratorContext<MyConfigType>();
137
137
 
@@ -155,7 +155,7 @@ import {
155
155
  validateWatchOptions,
156
156
  extractKeys,
157
157
  createDebouncedUpdate
158
- } from '../../providers';
158
+ } from '../../../providers';
159
159
 
160
160
  // Create default configurator state
161
161
  const defaultState = createDefaultConfiguratorState<MyConfigType>();
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { getDetailedDiff, hasChangesViaDiff } from '../../providers/configuratorUtils';
2
+ import { getDetailedDiff, hasChangesViaDiff } from '../../providers';
3
3
 
4
4
  let output = '';
5
5
  let coercionExamples = '';
@@ -1,8 +1,6 @@
1
1
  import { get } from 'svelte/store';
2
2
  import { navigate } from 'svelte-routing';
3
- import { routerStore } from '../../stores';
4
- import { getLogger } from '../logger';
5
- const logger = getLogger('webflow-apps-ui-utils');
3
+ import { routerStore } from '../../../utils/stores';
6
4
  /**
7
5
  * Normalizes a URL path to ensure proper formatting.
8
6
  */
@@ -21,7 +19,7 @@ const normalizeUrlPath = (path, hash) => {
21
19
  export const goto = (path = '/', state = {}) => {
22
20
  const { hash = '' } = get(routerStore);
23
21
  if (!hash) {
24
- logger.error({}, 'goto method found no router hash in the router store. Contact Finsweet support.');
22
+ console.error('goto method found no router hash in the router store. Contact Finsweet support.');
25
23
  return;
26
24
  }
27
25
  const url = normalizeUrlPath(`/${hash}/${path}`, hash);
@@ -0,0 +1 @@
1
+ export * from './goto';
@@ -0,0 +1 @@
1
+ export * from './goto';
@@ -0,0 +1,3 @@
1
+ export * from './auth';
2
+ export * from './diff-mapper';
3
+ export * from './helpers';
@@ -0,0 +1,3 @@
1
+ export * from './auth';
2
+ export * from './diff-mapper';
3
+ export * from './helpers';
@@ -2,7 +2,7 @@ import type { CustomCodeBlock } from '../../types';
2
2
  /**
3
3
  * Gets stored Custom Code blocks by ID or returns all if no ID provided.
4
4
  */
5
- export declare const getCustomCode: (id?: string) => Promise<Array<CustomCodeBlock>>;
5
+ export declare const getCustomCode: (displayName?: string) => Promise<Array<CustomCodeBlock>>;
6
6
  /**
7
7
  * Sets custom code blocks in the site.
8
8
  */
@@ -1,17 +1,15 @@
1
- import { getLogger } from '../logger';
2
- const logger = getLogger('webflow-apps-ui-utils');
3
1
  /**
4
2
  * Gets stored Custom Code blocks by ID or returns all if no ID provided.
5
3
  */
6
- export const getCustomCode = async (id) => {
4
+ export const getCustomCode = async (displayName) => {
7
5
  //TODO: update this when typings are available plus any other place we have disabled this warning.
8
6
  //@ts-expect-error - not available in typings for now
9
7
  const customCodeBlock = (await webflow.getSiteCustomCode());
10
8
  if (!customCodeBlock || customCodeBlock.length === 0)
11
9
  return [];
12
- if (!id)
10
+ if (!displayName)
13
11
  return customCodeBlock;
14
- const storedConfigs = customCodeBlock.filter((block) => block.id === id);
12
+ const storedConfigs = customCodeBlock.filter((block) => block.id === displayName);
15
13
  if (storedConfigs)
16
14
  return storedConfigs;
17
15
  return [];
@@ -25,7 +23,7 @@ export const setCustomCode = async (customCodeBlock) => {
25
23
  await webflow.setSiteCustomCode(customCodeBlock);
26
24
  }
27
25
  catch (error) {
28
- logger.error({}, 'Failed to save custom code block', error, customCodeBlock);
26
+ console.error('Failed to save custom code block', error, customCodeBlock);
29
27
  }
30
28
  };
31
29
  /**
@@ -12,11 +12,12 @@ export type CustomCodeConfigsStore = {
12
12
  export declare const customCodeConfigsStore: import("svelte/store").Writable<CustomCodeConfigsStore>;
13
13
  /**
14
14
  * Get configs from custom code.
15
+ * @param displayName - The name of the custom code block to get configs from.
15
16
  */
16
- export declare const getProjectConfigs: () => Promise<any>;
17
+ export declare const getProjectConfigs: (displayName: string) => Promise<any>;
17
18
  /**
18
19
  * Fetches configs stored in custom code for a given component.
19
20
  * @param component
20
21
  * @returns
21
22
  */
22
- export declare const getComponentConfigs: (component: string) => Promise<any>;
23
+ export declare const getComponentConfigs: (component: string, displayName: string) => Promise<any>;
@@ -1,8 +1,5 @@
1
1
  import { writable } from 'svelte/store';
2
- import { getLogger } from '../logger';
3
2
  import { getCustomCode } from './api';
4
- const logger = getLogger('utils');
5
- const DISPLAY_NAME = 'finsweetcomponentsconfig';
6
3
  /**
7
4
  * Store for Custom Code stored Component configs
8
5
  */
@@ -13,9 +10,10 @@ export const componentConfigsStore = writable(null);
13
10
  export const customCodeConfigsStore = writable([]);
14
11
  /**
15
12
  * Get configs from custom code.
13
+ * @param displayName - The name of the custom code block to get configs from.
16
14
  */
17
- export const getProjectConfigs = async () => {
18
- const [customCodeBlock] = await getCustomCode(DISPLAY_NAME);
15
+ export const getProjectConfigs = async (displayName) => {
16
+ const [customCodeBlock] = await getCustomCode(displayName);
19
17
  if (!customCodeBlock || !customCodeBlock.hostedLocation) {
20
18
  return null;
21
19
  }
@@ -24,7 +22,6 @@ export const getProjectConfigs = async () => {
24
22
  const configs = await import(/* @vite-ignore */ customCodeBlock.hostedLocation);
25
23
  window.isLoadingCustomCodeConfigs = false;
26
24
  customCodeConfigsStore.set(configs);
27
- logger.log({}, 'Project custom code configs', configs);
28
25
  return configs;
29
26
  };
30
27
  /**
@@ -32,8 +29,8 @@ export const getProjectConfigs = async () => {
32
29
  * @param component
33
30
  * @returns
34
31
  */
35
- export const getComponentConfigs = async (component) => {
36
- const customCodeBlock = await getProjectConfigs();
32
+ export const getComponentConfigs = async (component, displayName) => {
33
+ const customCodeBlock = await getProjectConfigs(displayName);
37
34
  if (!customCodeBlock || Object.keys(customCodeBlock[component]).length === 0)
38
35
  return null;
39
36
  return customCodeBlock[component];
@@ -1,2 +1,2 @@
1
- export * from './api';
2
1
  export * from './configs';
2
+ export * from './api';
@@ -1,2 +1,2 @@
1
- export * from './api';
2
1
  export * from './configs';
2
+ export * from './api';
@@ -1,7 +1,6 @@
1
1
  export * from './capitalizeFirstLetter';
2
2
  export * from './cleanupTooltipMessage';
3
3
  export * from './encodeDecodeConfigs';
4
- export * from './goto';
5
4
  export * from './dom';
6
5
  export * from './events';
7
6
  export * from './forms';
@@ -1,7 +1,6 @@
1
1
  export * from './capitalizeFirstLetter';
2
2
  export * from './cleanupTooltipMessage';
3
3
  export * from './encodeDecodeConfigs';
4
- export * from './goto';
5
4
  export * from './dom';
6
5
  export * from './events';
7
6
  export * from './forms';
@@ -1,11 +1,10 @@
1
1
  export * from './animations';
2
2
  export * from './api';
3
- export * from './auth';
4
3
  export * from './browser-storage';
5
- export * from './constants';
6
4
  export * from './custom-code';
7
- export * from './diff-mapper';
5
+ export * from './constants';
8
6
  export * from './helpers';
9
7
  export * from './logger';
10
8
  export * from './webflow';
11
9
  export * from './webflow-canvas';
10
+ export type * from '../types';
@@ -1,10 +1,8 @@
1
1
  export * from './animations';
2
2
  export * from './api';
3
- export * from './auth';
4
3
  export * from './browser-storage';
5
- export * from './constants';
6
4
  export * from './custom-code';
7
- export * from './diff-mapper';
5
+ export * from './constants';
8
6
  export * from './helpers';
9
7
  export * from './logger';
10
8
  export * from './webflow';
@@ -1,5 +1,4 @@
1
- export type PredefinedLoggerContext = 'finsweet-components' | 'webflow-apps-ui-utils' | 'fast-search' | 'fs-cmp';
2
- export type LoggerContext = PredefinedLoggerContext | (string & Record<never, never>);
1
+ export type LoggerContext = string & Record<never, never>;
3
2
  export interface LogData {
4
3
  [key: string]: any;
5
4
  }
@@ -0,0 +1,2 @@
1
+ export * from './isPreviewMode';
2
+ export * from './router';
@@ -0,0 +1,2 @@
1
+ export * from './isPreviewMode';
2
+ export * from './router';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsweet/webflow-apps-utils",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Shared utilities for Webflow apps",
5
5
  "homepage": "https://github.com/finsweet/webflow-apps-utils",
6
6
  "repository": {
@@ -18,9 +18,18 @@
18
18
  "type": "module",
19
19
  "exports": {
20
20
  ".": {
21
- "types": "./dist/index.d.ts",
22
- "svelte": "./dist/index.js",
23
- "default": "./dist/index.js"
21
+ "types": "./dist/ui/index.d.ts",
22
+ "svelte": "./dist/ui/index.js",
23
+ "default": "./dist/ui/index.js"
24
+ },
25
+ "./utils": {
26
+ "types": "./dist/utils/index.d.ts",
27
+ "default": "./dist/utils/index.js"
28
+ },
29
+ "./ui": {
30
+ "types": "./dist/ui/index.d.ts",
31
+ "svelte": "./dist/ui/index.js",
32
+ "default": "./dist/ui/index.js"
24
33
  },
25
34
  "./index.css": "./dist/ui/index.css"
26
35
  },
@@ -1,147 +0,0 @@
1
- import { derived } from 'svelte/store';
2
- interface FormState<T> {
3
- values: T;
4
- errors: Record<keyof T, string[]>;
5
- touched: Record<keyof T, boolean>;
6
- isValid: boolean;
7
- isDirty: boolean;
8
- isSubmitting: boolean;
9
- }
10
- /**
11
- * Creates a form validation utility with Svelte 5 reactive stores
12
- * @param identifier - Unique identifier for the form
13
- * @param options - Configuration options
14
- */
15
- export declare class FormValidator<T extends {
16
- name: string;
17
- instance: string;
18
- class: string;
19
- }> {
20
- private schema;
21
- private _store;
22
- private instancesSet;
23
- private initialValues;
24
- private identifier;
25
- private currentInstanceToIgnore;
26
- private classValidationEnabled;
27
- readonly values: ReturnType<typeof derived<typeof this._store, T>>;
28
- readonly errors: ReturnType<typeof derived<typeof this._store, Record<keyof T, string[]>>>;
29
- readonly touched: ReturnType<typeof derived<typeof this._store, Record<keyof T, boolean>>>;
30
- readonly isValid: ReturnType<typeof derived<typeof this._store, boolean>>;
31
- readonly isDirty: ReturnType<typeof derived<typeof this._store, boolean>>;
32
- readonly isSubmitting: ReturnType<typeof derived<typeof this._store, boolean>>;
33
- /**
34
- * Generates unique name, instance, and class based on solution name and existing instances
35
- * @param existingInstances - Array of existing instance names
36
- * @param solution - The base solution name
37
- * @returns Object containing name, instance, and class values
38
- */
39
- static generateNames(existingInstances: string[], solution: string, name: string): {
40
- name: string;
41
- instance: string;
42
- class: string;
43
- };
44
- /**
45
- * Cleans up the class name to ensure it's valid
46
- * @param className - The class name to clean up
47
- * @returns The cleaned up class name
48
- */
49
- static sanitizeClassName(className: string): string;
50
- constructor(identifier: string, initialValues: T, options?: {
51
- existingInstances?: string[];
52
- });
53
- /**
54
- * Set a specific instance to ignore during validation
55
- * Used in edit mode to prevent the current instance from being flagged as invalid
56
- */
57
- ignoreInstanceValidation(instanceValue: string, existingInstances: string[]): void;
58
- /**
59
- * Set the value of a specific field
60
- */
61
- setField<K extends keyof T>(field: K, value: T[K]): void;
62
- /**
63
- * Set multiple field values at once
64
- */
65
- setFields(values: Partial<T>): void;
66
- /**
67
- * Handle instance field validation with uniqueness check
68
- */
69
- validateWithInstances(existingInstances: string[]): void;
70
- /**
71
- * Reset the form to initial values
72
- */
73
- reset(): void;
74
- /**
75
- * Enable or disable class name validation
76
- * @param enabled - Whether to enable class validation
77
- */
78
- enableClassValidation(enabled: boolean): void;
79
- /**
80
- * Validate the form values
81
- */
82
- private validate;
83
- /**
84
- * Set the form as submitting
85
- */
86
- setSubmitting(isSubmitting: boolean): void;
87
- /**
88
- * Get the current state of the form (for legacy compatibility)
89
- */
90
- getState(): FormState<T>;
91
- }
92
- /**
93
- * Setup form hook
94
- */
95
- export declare function createForm<T extends {
96
- name: string;
97
- instance: string;
98
- class: string;
99
- }>(identifier: string, initialValues: T, options?: {
100
- existingInstances?: string[];
101
- enableClassValidation?: boolean;
102
- }): {
103
- values: import("svelte/store").Readable<T>;
104
- errors: import("svelte/store").Readable<Record<keyof T, string[]>>;
105
- touched: import("svelte/store").Readable<Record<keyof T, boolean>>;
106
- isValid: import("svelte/store").Readable<boolean>;
107
- isDirty: import("svelte/store").Readable<boolean>;
108
- isSubmitting: import("svelte/store").Readable<boolean>;
109
- setField: <K extends keyof T>(field: K, value: T[K]) => void;
110
- setFields: (values: Partial<T>) => void;
111
- reset: () => void;
112
- enableClassValidation: (enabled: boolean) => void;
113
- ignoreInstanceValidation: (instanceValue: string, existingInstances: string[]) => void;
114
- setSubmitting: (isSubmitting: boolean) => void;
115
- validate: () => void;
116
- getState: () => FormState<T>;
117
- };
118
- /**
119
- * Get a form by its identifier
120
- */
121
- export declare function getFormById(identifier: string): FormValidator<any> | undefined;
122
- /**
123
- * Check if a form with a specific identifier is valid
124
- */
125
- export declare function isFormValid(identifier: string): boolean;
126
- /**
127
- * Get error messages for a specific form
128
- */
129
- export declare function getFormErrors(identifier: string): Record<string, string[]> | null;
130
- /**
131
- * Reset a form by its identifier
132
- */
133
- export declare function resetForm(identifier: string): boolean;
134
- export declare function createFormSubscription(identifier: string): import("svelte/store").Writable<{
135
- isValid: boolean;
136
- errors: {};
137
- values: {};
138
- }> | {
139
- subscribe: (this: void, run: import("svelte/store").Subscriber<FormState<any>>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
140
- destroy: () => void;
141
- };
142
- /**
143
- * Store to track if the form is adding or updating to the Canvas
144
- */
145
- export declare const isAddingOrUpdating: import("svelte/store").Writable<boolean>;
146
- export declare const loadingSelectedElement: import("svelte/store").Writable<boolean>;
147
- export {};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes