@plasmicapp/react-web 0.2.136 → 0.2.138

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 (36) hide show
  1. package/dist/all.d.ts +49 -46
  2. package/dist/auth/PlasmicPageGuard.d.ts +7 -0
  3. package/dist/index-common.d.ts +2 -3
  4. package/dist/react-web.cjs.development.js +708 -1087
  5. package/dist/react-web.cjs.development.js.map +1 -1
  6. package/dist/react-web.cjs.production.min.js +1 -1
  7. package/dist/react-web.cjs.production.min.js.map +1 -1
  8. package/dist/react-web.esm.js +710 -1086
  9. package/dist/react-web.esm.js.map +1 -1
  10. package/dist/render/translation.d.ts +2 -1
  11. package/dist/states/graph.d.ts +23 -2
  12. package/dist/states/helpers.d.ts +7 -6
  13. package/dist/states/index.d.ts +4 -24
  14. package/dist/states/types.d.ts +24 -0
  15. package/dist/states/valtio.d.ts +2 -3
  16. package/dist/stories/UseDollarState.stories.d.ts +1 -0
  17. package/package.json +5 -6
  18. package/skinny/dist/auth/PlasmicPageGuard.d.ts +7 -0
  19. package/skinny/dist/index-common.d.ts +2 -3
  20. package/skinny/dist/index.js +393 -319
  21. package/skinny/dist/index.js.map +1 -1
  22. package/skinny/dist/plume/checkbox/index.js +1 -1
  23. package/skinny/dist/plume/menu/index.js +1 -1
  24. package/skinny/dist/plume/menu-button/index.js +1 -1
  25. package/skinny/dist/plume/select/index.js +1 -1
  26. package/skinny/dist/plume/switch/index.js +1 -1
  27. package/skinny/dist/render/translation.d.ts +2 -1
  28. package/skinny/dist/{ssr-b16a1854.js → ssr-f6caec06.js} +7 -6
  29. package/skinny/dist/ssr-f6caec06.js.map +1 -0
  30. package/skinny/dist/states/graph.d.ts +23 -2
  31. package/skinny/dist/states/helpers.d.ts +7 -6
  32. package/skinny/dist/states/index.d.ts +4 -24
  33. package/skinny/dist/states/types.d.ts +24 -0
  34. package/skinny/dist/states/valtio.d.ts +2 -3
  35. package/skinny/dist/stories/UseDollarState.stories.d.ts +1 -0
  36. package/skinny/dist/ssr-b16a1854.js.map +0 -1
package/dist/all.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, Key, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent, useLayoutEffect } from 'react';
2
+ import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties, Key, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
3
3
 
4
4
  // LICENSE is MIT
5
5
  //
@@ -17,12 +17,40 @@ type Argument = Value | Mapping | Argument[];
17
17
 
18
18
  declare function classNames$1(...args: Argument[]): string;
19
19
 
20
+ interface PlasmicDataSourceContextValue {
21
+ userAuthToken?: string;
22
+ isUserLoading?: boolean;
23
+ user?: {
24
+ id: string;
25
+ email: string;
26
+ roleId: string;
27
+ properties: Record<string, unknown> | null;
28
+ };
29
+ }
30
+ declare function useCurrentUser(): {
31
+ id: string;
32
+ email: string;
33
+ roleId: string;
34
+ properties: Record<string, unknown> | null;
35
+ } | undefined;
36
+ declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
37
+
38
+ declare function PlasmicPageGuard(props: {
39
+ children: React__default.ReactNode;
40
+ dataSourceCtxValue: PlasmicDataSourceContextValue | undefined;
41
+ validRoles: string[];
42
+ }): {} | null | undefined;
43
+
20
44
  declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
21
45
  declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
22
46
 
23
47
  declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
24
48
  declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
25
49
 
50
+ // Type definitions for dlv 1.1
51
+
52
+ declare function dlv(object: object, key: string | Array<string | number>, defaultValue?: any): any;
53
+
26
54
  declare type InitFunc<T> = ($props: Record<string, any>, $state: $State, $ctx: Record<string, any>, indexes?: number[]) => T;
27
55
  interface $StateSpec<T> {
28
56
  path: string;
@@ -35,9 +63,25 @@ interface $StateSpec<T> {
35
63
  }
36
64
  interface $State {
37
65
  [key: string]: any;
38
- registerInitFunc?: (path: string, f: InitFunc<any>) => any;
66
+ registerInitFunc?: (path: string, f: InitFunc<any>, repetitonIndex?: number[]) => any;
39
67
  }
40
68
 
69
+ declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void;
70
+ /**
71
+ * This function generate the state value prop for repeated states
72
+ * Example:
73
+ * - parent[][].counter[].count
74
+ * We need to pass `parent[index1][index2].counter to the child component
75
+ */
76
+ declare function generateStateValueProp($state: $State, path: (string | number)[]): any;
77
+ /**
78
+ * Forked from https://github.com/lukeed/dset
79
+ * Changes: fixed setting a deep value to a proxy object
80
+ */
81
+ declare function set(obj: any, keys: any, val: any): void;
82
+
83
+ declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): $State;
84
+
41
85
  interface Variants {
42
86
  [vg: string]: any;
43
87
  }
@@ -254,6 +298,7 @@ declare type PlasmicTranslator = (str: string, opts?: {
254
298
  };
255
299
  }) => React__default.ReactNode;
256
300
  interface TransProps {
301
+ transKey?: string;
257
302
  children?: React__default.ReactNode;
258
303
  }
259
304
  declare function genTranslatableString(elt: React__default.ReactNode): {
@@ -263,24 +308,7 @@ declare function genTranslatableString(elt: React__default.ReactNode): {
263
308
  };
264
309
  componentsCount: number;
265
310
  };
266
- declare function Trans({ children }: TransProps): React__default.ReactNode;
267
-
268
- interface PlasmicDataSourceContextValue {
269
- userAuthToken?: string;
270
- user?: {
271
- userId: string;
272
- email: string;
273
- roles: string[];
274
- properties: Record<string, unknown> | null;
275
- };
276
- }
277
- declare function useCurrentUser(): {
278
- userId: string;
279
- email: string;
280
- roles: string[];
281
- properties: Record<string, unknown> | null;
282
- } | undefined;
283
- declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
311
+ declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
284
312
 
285
313
  interface PlasmicRootProviderProps {
286
314
  platform?: "nextjs" | "gatsby";
@@ -652,31 +680,6 @@ interface TriggerOpts {
652
680
  */
653
681
  declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React.HTMLAttributes<HTMLElement>];
654
682
 
655
- // Type definitions for dlv 1.1
656
-
657
- declare function dlv(object: object, key: string | Array<string | number>, defaultValue?: any): any;
658
-
659
- declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void;
660
- /**
661
- * This function generate the state value prop for repeated states
662
- * Example:
663
- * - parent[][].counter[].count
664
- * We need to pass `parent[index1][index2].counter to the child component
665
- */
666
- declare function generateStateValueProp($state: $State, path: (string | number)[]): any;
667
- /**
668
- * Forked from https://github.com/lukeed/dset
669
- * Changes: fixed setting a deep value to a proxy object
670
- */
671
- declare function set(obj: any, keys: any, val: any): void;
672
- declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
673
- declare function shallowEqual<T>(a1: T[], a2: T[]): boolean;
674
- declare function isNum(value: string | number | symbol): value is number;
675
-
676
- declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): any;
677
-
678
- declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>, $ctx?: Record<string, any>): {};
679
-
680
683
  declare const classNames: typeof classNames$1;
681
684
 
682
685
  declare function setPlumeStrictMode(mode: boolean): void;
@@ -1635,4 +1638,4 @@ interface TriggeredOverlayContextValue {
1635
1638
  }
1636
1639
  declare const TriggeredOverlayContext: React.Context<TriggeredOverlayContextValue | undefined>;
1637
1640
 
1638
- export { $State, BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, PlasmicDataSourceContextProvider, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, dlv as get, getDataProps, hasVariant, isNum, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, shallowEqual, useButton, useCanvasDollarState, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useIsomorphicLayoutEffect, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
1641
+ export { $State, BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, PlasmicDataSourceContextProvider, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateValueProp, dlv as get, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
@@ -0,0 +1,7 @@
1
+ import { PlasmicDataSourceContextValue } from "@plasmicapp/data-sources-context";
2
+ import React from "react";
3
+ export declare function PlasmicPageGuard(props: {
4
+ children: React.ReactNode;
5
+ dataSourceCtxValue: PlasmicDataSourceContextValue | undefined;
6
+ validRoles: string[];
7
+ }): {} | null | undefined;
@@ -1,4 +1,5 @@
1
1
  import _classNames from "classnames";
2
+ export { PlasmicPageGuard } from "./auth/PlasmicPageGuard";
2
3
  export { omit, pick } from "./common";
3
4
  export { HTMLElementRefOf, StrictProps } from "./react-utils";
4
5
  export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, mergeVariantsWithStates, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
@@ -13,7 +14,5 @@ export { PlasmicDataSourceContextProvider, PlasmicRootProvider, useCurrentUser,
13
14
  export { Stack } from "./render/Stack";
14
15
  export { genTranslatableString, Trans } from "./render/translation";
15
16
  export { useTrigger } from "./render/triggers";
16
- export { $State } from "./states";
17
- export * from "./states/helpers";
18
- export { default as useDollarState, useCanvasDollarState, } from "./states/valtio";
17
+ export * from "./states";
19
18
  export declare const classNames: typeof _classNames;