@ws-ui/shared 0.3.11 → 1.1.0

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 (60) hide show
  1. package/README.md +4 -24
  2. package/dist/components/AppLoader.d.ts +5 -5
  3. package/dist/components/ControlledSwitch.d.ts +2 -2
  4. package/dist/components/Dialog.d.ts +2 -1
  5. package/dist/components/Incase/index.d.ts +2 -1
  6. package/dist/components/Modal/Button.d.ts +1 -0
  7. package/dist/components/Modal/Icon.d.ts +1 -0
  8. package/dist/components/Modal/index.d.ts +1 -0
  9. package/dist/components/Portal.d.ts +1 -0
  10. package/dist/components/Tips/components/CarouselTip.d.ts +1 -0
  11. package/dist/components/Tips/components/TextTip.d.ts +2 -1
  12. package/dist/components/Tips/components/VideoTip.d.ts +1 -0
  13. package/dist/components/Tips/components/index.d.ts +2 -1
  14. package/dist/components/Tips/index.d.ts +1 -0
  15. package/dist/components/Tips/provider.d.ts +1 -0
  16. package/dist/components/Toast.d.ts +2 -1
  17. package/dist/components/Tooltip.d.ts +2 -1
  18. package/dist/components/Tree/components/IndentLines.d.ts +1 -0
  19. package/dist/components/Tree/components/Switcher.d.ts +1 -0
  20. package/dist/components/Tree/components/Tree.d.ts +1 -0
  21. package/dist/components/Tree/components/TreeNode.d.ts +1 -0
  22. package/dist/components/Tree/index.d.ts +5 -4
  23. package/dist/components/Tree/interfaces.d.ts +1 -0
  24. package/dist/components/Tree/styled.d.ts +1 -0
  25. package/dist/constants.d.ts +1 -0
  26. package/dist/datasource-themes.d.ts +1 -0
  27. package/dist/declarations/datasources/datasource.d.ts +13 -6
  28. package/dist/declarations/webform/webform.d.ts +1 -0
  29. package/dist/hooks/use-didmounteffect.d.ts +1 -0
  30. package/dist/hooks/use-forwarded-ref.d.ts +2 -1
  31. package/dist/hooks/use-hotkeys.d.ts +1 -0
  32. package/dist/hooks/use-outside-click.d.ts +1 -1
  33. package/dist/hooks/use-state-ref.d.ts +1 -1
  34. package/dist/hooks/useDoubleClick.d.ts +2 -1
  35. package/dist/hooks/useIdentity.d.ts +2 -1
  36. package/dist/hooks/useStateObject.d.ts +1 -0
  37. package/dist/index.cjs.js +75 -125
  38. package/dist/index.cjs.js.map +1 -1
  39. package/dist/index.es.js +6957 -8365
  40. package/dist/index.es.js.map +1 -1
  41. package/dist/package.json +70 -0
  42. package/dist/services/api.d.ts +1 -0
  43. package/dist/services/explorer.d.ts +2 -1
  44. package/dist/services/tracking.d.ts +2 -2
  45. package/dist/style.css +1 -1
  46. package/dist/tailwind.preset.js +1 -2
  47. package/dist/types/api.d.ts +4 -6
  48. package/dist/types/modal.d.ts +4 -4
  49. package/dist/types/shared.d.ts +2 -0
  50. package/dist/types/webform-editor.d.ts +1 -0
  51. package/dist/utils/code.d.ts +1 -0
  52. package/dist/utils/common.d.ts +6 -6
  53. package/dist/utils/datasources.d.ts +1 -1
  54. package/dist/utils/explorer.d.ts +1 -0
  55. package/dist/utils/subjects.d.ts +1 -0
  56. package/package.json +6 -12
  57. package/dist/utils/parser.spec.d.ts +0 -1
  58. package/dist/utils/validation.test.d.ts +0 -1
  59. package/dist/utils/waiter/waiter.test.d.ts +0 -1
  60. package/dist/vite.svg +0 -1
package/README.md CHANGED
@@ -1,27 +1,7 @@
1
- # React + TypeScript + Vite
1
+ # shared
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ This library was generated with [Nx](https://nx.dev).
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Running unit tests
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13
-
14
- - Configure the top-level `parserOptions` property like this:
15
-
16
- ```js
17
- parserOptions: {
18
- ecmaVersion: 'latest',
19
- sourceType: 'module',
20
- project: ['./tsconfig.json', './tsconfig.node.json'],
21
- tsconfigRootDir: __dirname,
22
- },
23
- ```
24
-
25
- - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
26
- - Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
27
- - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
7
+ Run `nx test shared` to execute the unit tests via [Vitest](https://vitest.dev/).
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
- export declare const LogoSVG: import("@emotion/styled").StyledComponent<{
3
- theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
5
- }, import("react").SVGProps<SVGSVGElement>, {}>;
2
+ export declare const LogoSVG: import('@emotion/styled').StyledComponent<{
3
+ theme?: import('@emotion/react').Theme | undefined;
4
+ as?: import('react').ElementType<any> | undefined;
5
+ }, import('react').SVGProps<SVGSVGElement>, {}>;
6
6
  export interface StudioProps {
7
7
  }
8
8
  export declare const AppLoader: ({ message, version, }: {
9
9
  message: string;
10
10
  version: string;
11
- }) => JSX.Element;
11
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { SwitchProps } from '@headlessui/react';
2
+
3
3
  export type SwitchSize = 'xs' | 'sm' | 'md' | 'lg';
4
4
  interface IControlledSwitchProps extends Omit<SwitchProps<'button'>, 'value' | 'size'> {
5
5
  onChange: (val: boolean) => void;
@@ -7,5 +7,5 @@ interface IControlledSwitchProps extends Omit<SwitchProps<'button'>, 'value' | '
7
7
  size?: SwitchSize;
8
8
  className?: string;
9
9
  }
10
- export declare const ControlledSwitch: import("react").ForwardRefExoticComponent<IControlledSwitchProps & import("react").RefAttributes<HTMLButtonElement>>;
10
+ export declare const ControlledSwitch: import('react').ForwardRefExoticComponent<IControlledSwitchProps & import('react').RefAttributes<HTMLButtonElement>>;
11
11
  export default ControlledSwitch;
@@ -1,5 +1,6 @@
1
1
  import { Placement, VirtualElement } from '@popperjs/core';
2
- import React, { CSSProperties, FC } from 'react';
2
+ import { default as React, CSSProperties, FC } from 'react';
3
+
3
4
  interface IOverlayProps {
4
5
  onClick: (ev: React.MouseEvent) => void;
5
6
  }
@@ -1,4 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
+
2
3
  export declare function Incase(props: PropsWithChildren<{
3
4
  of: any;
4
- }>): JSX.Element | null;
5
+ }>): import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { ModalColor } from '../../types/modal';
3
+
3
4
  interface IButtonProps {
4
5
  color?: ModalColor;
5
6
  variant?: 'solid' | 'outlined';
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { ModalColor, ModalIcon } from '../../types/modal';
3
+
3
4
  interface IProps {
4
5
  name: ModalIcon;
5
6
  color?: ModalColor;
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { IModal, ModalCloseReason } from '../../types/modal';
3
+
3
4
  interface ICloseModalParams {
4
5
  id: string;
5
6
  reason?: ModalCloseReason;
@@ -1,2 +1,3 @@
1
1
  import { FC } from 'react';
2
+
2
3
  export declare const Portal: FC;
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { TTip } from '../interfaces';
3
+
3
4
  declare const CarouselTip: FC<{
4
5
  pages?: TTip[];
5
6
  }>;
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
+
2
3
  interface ITextTipProps {
3
4
  body: string;
4
5
  isInsideCarousel?: boolean;
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  import { IVideoTip } from '../interfaces';
3
+
3
4
  declare const VideoTip: FC<Partial<Omit<IVideoTip, 'type'>>>;
4
5
  export default VideoTip;
@@ -1,3 +1,4 @@
1
1
  import { TTip } from '../interfaces';
2
- declare const renderTip: (tip: TTip, isInsideCarousel?: boolean) => JSX.Element;
2
+
3
+ declare const renderTip: (tip: TTip, isInsideCarousel?: boolean) => import("react/jsx-runtime").JSX.Element;
3
4
  export default renderTip;
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
+
2
3
  export declare const Tip: FC<{
3
4
  tipKey: string;
4
5
  side?: 'left' | 'right';
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { TTip } from './interfaces';
3
+
3
4
  export declare const TipsProvider: FC<{
4
5
  enabled?: boolean;
5
6
  baseUrl?: string;
@@ -1,4 +1,5 @@
1
- import React, { FC } from 'react';
1
+ import { default as React, FC } from 'react';
2
+
2
3
  export type ToastKind = 'warning' | 'info' | 'danger' | 'message' | 'error' | 'multi';
3
4
  export type ToastCustomIcon = FC<{
4
5
  className?: string;
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  import { Placement } from '@popperjs/core';
3
+
3
4
  interface ITooltip {
4
5
  label: string;
5
6
  placement?: Placement;
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
+
2
3
  declare const IndentLines: FC<{
3
4
  showLines?: boolean;
4
5
  depth: number;
@@ -1,4 +1,5 @@
1
1
  import { FC, MouseEventHandler } from 'react';
2
+
2
3
  declare const Switcher: FC<{
3
4
  show: boolean;
4
5
  expanded: boolean;
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  import { ITreeProps } from '../interfaces';
3
+
3
4
  declare const Tree: FC<ITreeProps>;
4
5
  export default Tree;
@@ -1,4 +1,5 @@
1
1
  import { FC } from 'react';
2
2
  import { TreeNodeProps } from '../interfaces';
3
+
3
4
  declare const TreeNode: FC<TreeNodeProps>;
4
5
  export default TreeNode;
@@ -1,7 +1,8 @@
1
- import Tree from './components/Tree';
2
- import TreeNode from './components/TreeNode';
3
- import IndentLines from './components/IndentLines';
4
- import Switcher from './components/Switcher';
1
+ import { default as Tree } from './components/Tree';
2
+ import { default as TreeNode } from './components/TreeNode';
3
+ import { default as IndentLines } from './components/IndentLines';
4
+ import { default as Switcher } from './components/Switcher';
5
+
5
6
  export { TreeNode, Tree, IndentLines, Switcher };
6
7
  export * from './interfaces';
7
8
  export * from './styled';
@@ -1,4 +1,5 @@
1
1
  import { MouseEvent, ReactElement } from 'react';
2
+
2
3
  export type RenderNodeHandler<T = any> = (node: ITreeNodeData<T>, depth: number, state: NodeState, actions: TreeActions, searchQuery: string) => JSX.Element;
3
4
  export type NodeHandler = (node?: ITreeNodeData) => void;
4
5
  export type NodeState = {
@@ -1,3 +1,4 @@
1
1
  import { FC } from 'react';
2
2
  import { ITreeIcon } from './interfaces';
3
+
3
4
  export declare const TreeIcon: FC<ITreeIcon>;
@@ -1,4 +1,5 @@
1
1
  import { IEditor } from './types';
2
+
2
3
  interface IEditorList {
3
4
  Code: IEditor;
4
5
  WebForm: IEditor;
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
+
2
3
  export declare const DATASOURCE_THEMES: {
3
4
  [key: string]: CSSProperties;
4
5
  };
@@ -1,5 +1,6 @@
1
1
  declare namespace datasources {
2
- type TEventData = import('~/hooks/use-events/interfaces').webforms.WEvent;
2
+ type TEventData =
3
+ import('~shared/hooks/use-events/interfaces').webforms.WEvent;
3
4
  type TDatasourceType =
4
5
  | 'auto'
5
6
  | 'entity'
@@ -203,11 +204,15 @@ declare namespace datasources {
203
204
  namespace: string;
204
205
  }
205
206
 
206
- interface ICreateDataSourceScalar extends ICreateDataSourceCommon {
207
- type: 'scalar';
208
- initialValue?: string | boolean | number | any[] | object | null;
209
- dataType: TJSType;
210
- from?: string;
207
+ interface ICreateDataSourceCommon {
208
+ id: string;
209
+ initialValue: any;
210
+ events?: webforms.WEvent[];
211
+ namespace: string;
212
+ schema?: {
213
+ type: string;
214
+ properties: { name: string; type: string; initialValue: any }[];
215
+ };
211
216
  }
212
217
 
213
218
  interface ICreateDataSourceArray extends ICreateDataSourceCommon {
@@ -286,6 +291,7 @@ declare namespace datasources {
286
291
  object: 'object';
287
292
  date: 'date';
288
293
  };
294
+ static removeSource(id: string, namespace?: string): void;
289
295
  static getOrBuildNameSpace(namespace?: string): INameSpace;
290
296
  static getNameSpace(namespace: string): INameSpace;
291
297
  static buildSource(
@@ -327,6 +333,7 @@ declare namespace datasources {
327
333
  propertyStr: string,
328
334
  ): Promise<T[]>;
329
335
  orderBy(attrs: string, settings?: any): Promise<null>;
336
+ query(queryStr: string, settings?: any): Promise<null>;
330
337
  getValueAsParam(property?: string, settings?: any): Promise<null>;
331
338
  getDataType(): null;
332
339
  setValue<T = any>(
@@ -170,6 +170,7 @@ declare namespace webforms {
170
170
  variadicType: string;
171
171
  methodType?: 'dataclass' | 'singleton';
172
172
  openIn: string;
173
+ allowedOnHTTPGET?: boolean;
173
174
  }>;
174
175
 
175
176
  type WebformStateActionType = 'add' | 'delete' | 'clear';
@@ -1,2 +1,3 @@
1
1
  import { EffectCallback, DependencyList } from 'react';
2
+
2
3
  export declare function useDidMountEffect(effect: EffectCallback, deps?: DependencyList): void;
@@ -1,2 +1,3 @@
1
1
  import { ForwardedRef } from 'react';
2
- export declare function useForwardedRef<T>(ref: ForwardedRef<T>): import("react").MutableRefObject<T | null>;
2
+
3
+ export declare function useForwardedRef<T>(ref: ForwardedRef<T>): import('react').MutableRefObject<T | null>;
@@ -1,5 +1,6 @@
1
1
  import { DependencyList } from 'react';
2
2
  import { KeyHandler } from 'hotkeys-js';
3
+
3
4
  type Options = {
4
5
  scope?: string;
5
6
  element?: HTMLElement | null;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const useOutsideClick: <T extends HTMLElement, R = void>(callback: (event: MouseEvent) => R) => import("react").MutableRefObject<T | null>;
2
+ export declare const useOutsideClick: <T extends HTMLElement, R = void>(callback: (event: MouseEvent) => R) => import('react').MutableRefObject<T | null>;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare function useStateRef<T>(state: T): import("react").MutableRefObject<T>;
2
+ export declare function useStateRef<T>(state: T): import('react').MutableRefObject<T>;
@@ -1,7 +1,8 @@
1
1
  import { MouseEvent } from 'react';
2
+
2
3
  type EventHandler<T = any> = (event: MouseEvent, ...params: T[]) => void;
3
4
  interface IOptions {
4
5
  timeout?: number;
5
6
  }
6
- export declare const useDoubleClick: <T = any>(doubleClick: EventHandler<T>, click?: EventHandler<T> | undefined, options?: IOptions) => (event: MouseEvent, ...params: T[]) => void;
7
+ export declare const useDoubleClick: <T = any>(doubleClick: EventHandler<T>, click?: EventHandler<T>, options?: IOptions) => (event: MouseEvent, ...params: T[]) => void;
7
8
  export {};
@@ -1,5 +1,6 @@
1
1
  import { PropsWithChildren } from 'react';
2
+
2
3
  export declare const IdentityProvider: (props: PropsWithChildren<{
3
4
  value: string;
4
- }>) => JSX.Element;
5
+ }>) => import("react/jsx-runtime").JSX.Element;
5
6
  export declare const useIdentity: () => string;
@@ -1,4 +1,5 @@
1
1
  import { SetStateAction } from 'react';
2
+
2
3
  export declare function useStateObject<T extends object>(initialState: T): {
3
4
  state: T;
4
5
  actions: InternalActions<T> & {