@plasmicapp/react-web 0.2.110 → 0.2.113

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 (92) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/all.d.ts +65 -28
  3. package/dist/common.d.ts +3 -3
  4. package/dist/index-common.d.ts +4 -3
  5. package/dist/index.d.ts +1 -1
  6. package/dist/react-web.cjs.development.js +415 -370
  7. package/dist/react-web.cjs.development.js.map +1 -1
  8. package/dist/react-web.cjs.production.min.js +1 -1
  9. package/dist/react-web.cjs.production.min.js.map +1 -1
  10. package/dist/react-web.esm.js +401 -370
  11. package/dist/react-web.esm.js.map +1 -1
  12. package/dist/render/elements.d.ts +5 -0
  13. package/dist/render/ssr.d.ts +1 -0
  14. package/dist/states/helpers.d.ts +5 -0
  15. package/dist/states/index.d.ts +1 -1
  16. package/dist/states/valtio.d.ts +16 -0
  17. package/dist/stories/UseDollarState.stories.d.ts +11 -0
  18. package/package.json +8 -3
  19. package/skinny/dist/{collection-utils-57c273dc.js → collection-utils-43f97262.js} +14 -13
  20. package/skinny/dist/collection-utils-43f97262.js.map +1 -0
  21. package/skinny/dist/{common-182a0b0c.js → common-9ebe374e.js} +1 -1
  22. package/skinny/dist/common-9ebe374e.js.map +1 -0
  23. package/skinny/dist/common.d.ts +3 -3
  24. package/skinny/dist/index-common.d.ts +4 -3
  25. package/skinny/dist/index.d.ts +1 -1
  26. package/skinny/dist/index.js +53 -42
  27. package/skinny/dist/index.js.map +1 -1
  28. package/skinny/dist/plume/button/index.js +7 -7
  29. package/skinny/dist/plume/button/index.js.map +1 -1
  30. package/skinny/dist/plume/checkbox/index.js +18 -17
  31. package/skinny/dist/plume/checkbox/index.js.map +1 -1
  32. package/skinny/dist/plume/menu/index.js +39 -39
  33. package/skinny/dist/plume/menu/index.js.map +1 -1
  34. package/skinny/dist/plume/menu-button/index.js +23 -22
  35. package/skinny/dist/plume/menu-button/index.js.map +1 -1
  36. package/skinny/dist/plume/select/index.js +42 -43
  37. package/skinny/dist/plume/select/index.js.map +1 -1
  38. package/skinny/dist/plume/switch/index.js +17 -16
  39. package/skinny/dist/plume/switch/index.js.map +1 -1
  40. package/skinny/dist/plume/text-input/index.js +10 -10
  41. package/skinny/dist/plume/text-input/index.js.map +1 -1
  42. package/skinny/dist/plume/triggered-overlay/index.js +14 -14
  43. package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
  44. package/skinny/dist/{plume-utils-623b91cc.js → plume-utils-d9811bf3.js} +2 -2
  45. package/skinny/dist/{plume-utils-27cd384f.js.map → plume-utils-d9811bf3.js.map} +1 -1
  46. package/skinny/dist/{props-utils-b2ad4997.js → props-utils-228208e6.js} +2 -2
  47. package/skinny/dist/{props-utils-7c02c0a8.js.map → props-utils-228208e6.js.map} +1 -1
  48. package/skinny/dist/{react-utils-35cb2a4e.js → react-utils-7bc53870.js} +6 -6
  49. package/skinny/dist/{react-utils-35cb2a4e.js.map → react-utils-7bc53870.js.map} +1 -1
  50. package/skinny/dist/render/PlasmicHead/index.js +6 -6
  51. package/skinny/dist/render/PlasmicImg/index.js +27 -27
  52. package/skinny/dist/render/PlasmicImg/index.js.map +1 -1
  53. package/skinny/dist/render/elements.d.ts +5 -0
  54. package/skinny/dist/render/ssr.d.ts +1 -0
  55. package/skinny/dist/{ssr-b1615b80.js → ssr-b16a1854.js} +16 -10
  56. package/skinny/dist/ssr-b16a1854.js.map +1 -0
  57. package/skinny/dist/states/helpers.d.ts +5 -0
  58. package/skinny/dist/states/index.d.ts +1 -1
  59. package/skinny/dist/states/valtio.d.ts +16 -0
  60. package/skinny/dist/stories/UseDollarState.stories.d.ts +11 -0
  61. package/skinny/dist/collection-utils-2745acd4.js +0 -238
  62. package/skinny/dist/collection-utils-2745acd4.js.map +0 -1
  63. package/skinny/dist/collection-utils-3487dd27.js +0 -238
  64. package/skinny/dist/collection-utils-3487dd27.js.map +0 -1
  65. package/skinny/dist/collection-utils-57c273dc.js.map +0 -1
  66. package/skinny/dist/common-182a0b0c.js.map +0 -1
  67. package/skinny/dist/plume-utils-27cd384f.js +0 -35
  68. package/skinny/dist/plume-utils-623b91cc.js.map +0 -1
  69. package/skinny/dist/props-utils-7c02c0a8.js +0 -8
  70. package/skinny/dist/props-utils-b2ad4997.js.map +0 -1
  71. package/skinny/dist/react-utils-7c01e440.js +0 -172
  72. package/skinny/dist/react-utils-7c01e440.js.map +0 -1
  73. package/skinny/dist/render/PlasmicHead.d.ts +0 -35
  74. package/skinny/dist/ssr-14264281.js +0 -158
  75. package/skinny/dist/ssr-14264281.js.map +0 -1
  76. package/skinny/dist/ssr-5141fc77.js +0 -158
  77. package/skinny/dist/ssr-5141fc77.js.map +0 -1
  78. package/skinny/dist/ssr-579df58f.js +0 -158
  79. package/skinny/dist/ssr-579df58f.js.map +0 -1
  80. package/skinny/dist/ssr-84e27ffb.js +0 -110
  81. package/skinny/dist/ssr-84e27ffb.js.map +0 -1
  82. package/skinny/dist/ssr-9ebd98ed.js +0 -158
  83. package/skinny/dist/ssr-9ebd98ed.js.map +0 -1
  84. package/skinny/dist/ssr-b1615b80.js.map +0 -1
  85. package/skinny/dist/ssr-d2fd94f2.js +0 -31
  86. package/skinny/dist/ssr-d2fd94f2.js.map +0 -1
  87. package/skinny/dist/ssr-f4053cdd.js +0 -110
  88. package/skinny/dist/ssr-f4053cdd.js.map +0 -1
  89. package/skinny/dist/ssr-fbf922f6.js +0 -108
  90. package/skinny/dist/ssr-fbf922f6.js.map +0 -1
  91. package/skinny/dist/tslib.es6-d26ffe68.js +0 -132
  92. package/skinny/dist/tslib.es6-d26ffe68.js.map +0 -1
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Plasmic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/dist/all.d.ts CHANGED
@@ -1,26 +1,45 @@
1
1
  import * as React from 'react';
2
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
- // This is the only way I found to break circular references between ClassArray and ClassValue
5
- // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
6
- interface ClassArray extends Array<ClassValue> {} // tslint:disable-line no-empty-interface
4
+ // LICENSE is MIT
5
+ //
6
+ // Copyright (c) 2018
7
+ // Dave Keen <http://www.keendevelopment.ch>
8
+ // Adi Dahiya <https://github.com/adidahiya>
9
+ // Jason Killian <https://github.com/JKillian>
10
+ // Sean Kelley <https://github.com/seansfkelley>
11
+ // Michal Adamczyk <https://github.com/mradamczyk>
12
+ // Marvin Hagemeister <https://github.com/marvinhagemeister>
7
13
 
8
- interface ClassDictionary {
9
- [id: string]: any;
10
- }
11
-
12
- type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
14
+ type Value = string | number | boolean | undefined | null;
15
+ type Mapping = { [key: string]: any };
16
+ type Argument = Value | Mapping | Argument[];
13
17
 
14
- type ClassNamesFn = (...classes: ClassValue[]) => string;
18
+ declare function classNames$1(...args: Argument[]): string;
15
19
 
16
- type ClassNamesExport = ClassNamesFn & { default: ClassNamesFn };
17
-
18
- declare function pick<T>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
19
- declare function omit<T>(obj: T, ...keys: (keyof T)[]): Partial<T>;
20
+ declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
21
+ declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
20
22
 
21
23
  declare type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
22
24
  declare type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
23
25
 
26
+ declare type InitFunc$1<T> = ($props: Record<string, any>, $state: $State$1, indexes: number[]) => T;
27
+ interface $State$1 {
28
+ [key: string]: any;
29
+ registerInitFunc?: (path: string, f: InitFunc$1<any>) => any;
30
+ }
31
+ interface $StateSpec<T> {
32
+ path: string;
33
+ initFunc?: InitFunc$1<T>;
34
+ initVal?: T;
35
+ type: "private" | "readonly" | "writable";
36
+ valueProp?: string;
37
+ onChangeProp?: string;
38
+ }
39
+ declare function useDollarState(specs: $StateSpec<any>[], props: Record<string, any>): any;
40
+
41
+ declare function useCanvasDollarState(specs: $StateSpec<any>[], props: Record<string, any>): any;
42
+
24
43
  interface Variants {
25
44
  [vg: string]: any;
26
45
  }
@@ -69,6 +88,10 @@ declare function wrapWithClassName(element: React.ReactNode, className: string):
69
88
  display: "grid";
70
89
  };
71
90
  }, HTMLElement>;
91
+ declare function mergeVariantsWithStates(variants: Variants, $state: $State$1, linkedStates: {
92
+ variantGroup: string;
93
+ statePath: (string | number)[];
94
+ }[]): Variants;
72
95
  declare function deriveRenderOpts(props: Record<string, any>, config: {
73
96
  name: string;
74
97
  descendantNames: string[];
@@ -244,6 +267,23 @@ declare function genTranslatableString(elt: React__default.ReactNode): {
244
267
  };
245
268
  declare function Trans({ children }: TransProps): React__default.ReactNode;
246
269
 
270
+ interface PlasmicDataSourceContextValue {
271
+ userAuthToken?: string;
272
+ user?: {
273
+ userId: string;
274
+ email: string;
275
+ roles: string[];
276
+ properties: Record<string, unknown> | null;
277
+ };
278
+ }
279
+ declare function useCurrentUser(): {
280
+ userId: string;
281
+ email: string;
282
+ roles: string[];
283
+ properties: Record<string, unknown> | null;
284
+ } | undefined;
285
+ declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
286
+
247
287
  interface PlasmicRootProviderProps {
248
288
  platform?: "nextjs" | "gatsby";
249
289
  children?: React.ReactNode;
@@ -374,7 +414,8 @@ interface DOMAttributes<T = FocusableElement> extends AriaAttributes, DOMAttribu
374
414
  id?: string | undefined,
375
415
  role?: AriaRole | undefined,
376
416
  tabIndex?: number | undefined,
377
- style?: CSSProperties | undefined
417
+ style?: CSSProperties | undefined,
418
+ className?: string | undefined
378
419
  }
379
420
 
380
421
  /*
@@ -613,7 +654,7 @@ interface TriggerOpts {
613
654
  */
614
655
  declare function useTrigger(trigger: TriggerType, opts: TriggerOpts): [boolean, React.HTMLAttributes<HTMLElement>];
615
656
 
616
- declare const classNames: ClassNamesExport;
657
+ declare const classNames: typeof classNames$1;
617
658
 
618
659
  declare function setPlumeStrictMode(mode: boolean): void;
619
660
  declare type VariantArgChoices<T> = T extends (infer M)[] ? M : T extends SingleChoiceArg<infer M> ? M : never;
@@ -1574,17 +1615,8 @@ declare const TriggeredOverlayContext: React.Context<TriggeredOverlayContextValu
1574
1615
  declare type InitFunc<T> = ($props: Record<string, any>, $state: $State) => T;
1575
1616
  interface $State {
1576
1617
  [key: string]: any;
1577
- registerInitFunc: (path: string, f: InitFunc<any>) => any;
1578
- }
1579
- interface $StateSpec<T> {
1580
- path: string;
1581
- initFunc?: InitFunc<T>;
1582
- initVal?: T;
1583
- type: "private" | "readonly" | "writable";
1584
- valueProp?: string;
1585
- onChangeProp?: string;
1586
- }
1587
- declare function useVanillaDollarState(_specs: $StateSpec<any>[], props: Record<string, any>): $State;
1618
+ registerInitFunc?: (path: string, f: InitFunc<any>) => any;
1619
+ }
1588
1620
 
1589
1621
  declare function generateStateOnChangeProp($state: $State, stateName: string, dataReps: number[]): (val: any, path: (string | number)[]) => void;
1590
1622
  /**
@@ -1593,6 +1625,11 @@ declare function generateStateOnChangeProp($state: $State, stateName: string, da
1593
1625
  * - parent[][].counter[].count
1594
1626
  * We need to pass `parent[index1][index2].counter to the child component
1595
1627
  */
1596
- declare function generateStateValueProp($state: $State, path: (string | number)[]): any;
1628
+ declare function generateStateValueProp($state: $State, path: (string | number)[]): any;
1629
+ /**
1630
+ * Forked from https://github.com/lukeed/dset
1631
+ * Changes: fixed setting a deep value to a proxy object
1632
+ */
1633
+ declare function set(obj: any, keys: any, val: any): void;
1597
1634
 
1598
- export { BaseButtonProps, BaseMenuButtonProps, BaseMenuGroupProps, BaseMenuItemProps, BaseMenuProps, BaseSelectOptionGroupProps, BaseSelectOptionProps, BaseSelectProps, BaseTextInputProps, BaseTriggeredOverlayProps, ButtonRef, CheckboxProps, CheckboxRef, CheckboxRefValue, DropdownMenu, Flex, HTMLElementRefOf, HtmlAnchorOnlyProps, HtmlButtonOnlyProps, MenuButtonRef, MenuButtonRefValue, MenuRef, MenuRefValue, MultiChoiceArg, 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, getDataProps, hasVariant, makeFragment, omit, pick, plasmicHeadMeta, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useVanillaDollarState as useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
1635
+ export { $State$1 as $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, getDataProps, hasVariant, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, set, setPlumeStrictMode, useButton, useCanvasDollarState, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
package/dist/common.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export declare function notNil<T>(x: T | undefined | null): x is T;
2
- export declare function pick<T>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
3
- export declare function pickBy<T>(obj: T, func: (key: string, val: any) => boolean): Partial<T>;
4
- export declare function omit<T>(obj: T, ...keys: (keyof T)[]): Partial<T>;
2
+ export declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
3
+ export declare function pickBy<T extends {}>(obj: T, func: (key: string, val: any) => boolean): Partial<T>;
4
+ export declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
5
5
  export declare function isSubset<T>(a1: T[], a2: T[]): boolean;
6
6
  export declare function chainSingleArgFuncs<A>(...funcs: ((arg: A) => A)[]): ((arg: A) => A) | undefined;
7
7
  export declare function ensure<T>(x: T | null | undefined): T;
@@ -1,7 +1,8 @@
1
- export declare const classNames: import("classnames/types").ClassNamesExport;
1
+ import _classNames from "classnames";
2
+ export declare const classNames: typeof _classNames;
2
3
  export { omit, pick } from "./common";
3
4
  export { HTMLElementRefOf, StrictProps } from "./react-utils";
4
- export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
5
+ export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, mergeVariantsWithStates, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
5
6
  export { ensureGlobalVariants } from "./render/global-variants";
6
7
  export { PlasmicHead, plasmicHeadMeta } from "./render/PlasmicHead";
7
8
  export { PlasmicIcon } from "./render/PlasmicIcon";
@@ -9,7 +10,7 @@ export { PlasmicImg } from "./render/PlasmicImg";
9
10
  export { PlasmicLink } from "./render/PlasmicLink";
10
11
  export { PlasmicSlot, renderPlasmicSlot } from "./render/PlasmicSlot";
11
12
  export { createUseScreenVariants } from "./render/screen-variants";
12
- export { PlasmicRootProvider, useIsSSR } from "./render/ssr";
13
+ export { PlasmicDataSourceContextProvider, PlasmicRootProvider, useCurrentUser, useIsSSR, } from "./render/ssr";
13
14
  export { Stack } from "./render/Stack";
14
15
  export { genTranslatableString, Trans } from "./render/translation";
15
16
  export { useTrigger } from "./render/triggers";
package/dist/index.d.ts CHANGED
@@ -10,4 +10,4 @@ export * from "./plume/switch";
10
10
  export * from "./plume/text-input";
11
11
  export * from "./plume/triggered-overlay";
12
12
  export * from "./states/helpers";
13
- export { default as useDollarState } from "./states/index";
13
+ export { $State, default as useDollarState, useCanvasDollarState, } from "./states/valtio";