@plasmicapp/react-web 0.2.187 → 0.2.189
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/dist/all.d.ts +71 -34
- package/dist/auth/PlasmicPageGuard.d.ts +2 -1
- package/dist/index-common.d.ts +1 -1
- package/dist/react-web.cjs.development.js +8 -1
- package/dist/react-web.cjs.development.js.map +1 -1
- package/dist/react-web.cjs.production.min.js +1 -1
- package/dist/react-web.cjs.production.min.js.map +1 -1
- package/dist/react-web.esm.js +8 -2
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/ssr.d.ts +2 -1
- package/package.json +5 -5
- package/skinny/dist/auth/PlasmicPageGuard.d.ts +2 -1
- package/skinny/dist/{collection-utils-0bfbb8a8.js → collection-utils-0967eaf0.js} +4 -4
- package/skinny/dist/{collection-utils-0bfbb8a8.js.map → collection-utils-0967eaf0.js.map} +1 -1
- package/skinny/dist/{common-125681b4.js → common-9d6d348d.js} +2 -2
- package/skinny/dist/{common-125681b4.js.map → common-9d6d348d.js.map} +1 -1
- package/skinny/dist/index-common.d.ts +1 -1
- package/skinny/dist/index.js +12 -7
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/button/index.js +2 -2
- package/skinny/dist/plume/checkbox/index.js +5 -5
- package/skinny/dist/plume/menu/index.js +6 -6
- package/skinny/dist/plume/menu-button/index.js +5 -5
- package/skinny/dist/plume/select/index.js +6 -6
- package/skinny/dist/plume/switch/index.js +5 -5
- package/skinny/dist/plume/text-input/index.js +2 -2
- package/skinny/dist/plume/triggered-overlay/index.js +4 -4
- package/skinny/dist/{plume-utils-427ac667.js → plume-utils-7d68bcc0.js} +2 -2
- package/skinny/dist/{plume-utils-427ac667.js.map → plume-utils-7d68bcc0.js.map} +1 -1
- package/skinny/dist/{props-utils-5092839e.js → props-utils-9f9c761a.js} +2 -2
- package/skinny/dist/{props-utils-5092839e.js.map → props-utils-9f9c761a.js.map} +1 -1
- package/skinny/dist/{react-utils-091cf05d.js → react-utils-ee4e03ba.js} +2 -2
- package/skinny/dist/{react-utils-091cf05d.js.map → react-utils-ee4e03ba.js.map} +1 -1
- package/skinny/dist/render/PlasmicImg/index.js +2 -2
- package/skinny/dist/render/ssr.d.ts +2 -1
- package/skinny/dist/{ssr-08aff522.js → ssr-c9834f50.js} +2 -2
- package/skinny/dist/ssr-c9834f50.js.map +1 -0
- package/skinny/dist/ssr-08aff522.js.map +0 -1
package/dist/all.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ interface PlasmicPageGuardProps {
|
|
|
25
25
|
canTriggerLogin: boolean;
|
|
26
26
|
children: React__default.ReactNode;
|
|
27
27
|
}
|
|
28
|
-
declare function PlasmicPageGuard(props: PlasmicPageGuardProps):
|
|
28
|
+
declare function PlasmicPageGuard(props: PlasmicPageGuardProps): JSX.Element | null;
|
|
29
|
+
declare function withPlasmicPageGuard<P extends object>(WrappedComponent: React__default.ComponentType<P>, options: Omit<PlasmicPageGuardProps, "children">): React__default.FC<P>;
|
|
29
30
|
|
|
30
31
|
declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
|
|
31
32
|
declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
|
|
@@ -10997,17 +10998,32 @@ interface CanvasComponentProps<Data = any> {
|
|
|
10997
10998
|
setControlContextData?: (data: Data) => void;
|
|
10998
10999
|
}
|
|
10999
11000
|
declare type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
|
|
11001
|
+
declare type ControlExtras = {
|
|
11002
|
+
path: (string | number)[];
|
|
11003
|
+
};
|
|
11000
11004
|
/**
|
|
11001
|
-
*
|
|
11002
|
-
|
|
11005
|
+
* Context that we pass back to control functions.
|
|
11006
|
+
*/
|
|
11007
|
+
declare type ControlContext<P> = [
|
|
11008
|
+
/**
|
|
11009
|
+
* props
|
|
11003
11010
|
*/
|
|
11004
|
-
|
|
11011
|
+
P,
|
|
11005
11012
|
/**
|
|
11006
11013
|
* `contextData` can be `null` if the prop controls are rendering before
|
|
11007
11014
|
* the component instance itself (it will re-render once the component
|
|
11008
11015
|
* calls `setControlContextData`)
|
|
11009
11016
|
*/
|
|
11010
|
-
|
|
11017
|
+
InferDataType<P> | null,
|
|
11018
|
+
/**
|
|
11019
|
+
* Extra information for the control to use
|
|
11020
|
+
*/
|
|
11021
|
+
ControlExtras];
|
|
11022
|
+
/**
|
|
11023
|
+
* Config option that takes the context (e.g., props) of the component instance
|
|
11024
|
+
* to dynamically set its value.
|
|
11025
|
+
*/
|
|
11026
|
+
declare type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
|
|
11011
11027
|
interface PropTypeBase<P> {
|
|
11012
11028
|
displayName?: string;
|
|
11013
11029
|
description?: string;
|
|
@@ -11161,7 +11177,7 @@ declare type JSONLikeType<P> = "object" | ({
|
|
|
11161
11177
|
/**
|
|
11162
11178
|
* Optional function that generates a name for this item in the array
|
|
11163
11179
|
*/
|
|
11164
|
-
nameFunc?: (item: any) => string | undefined;
|
|
11180
|
+
nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
|
|
11165
11181
|
} & DefaultValueOrExpr<P, any> & PropTypeBase<P>) | ({
|
|
11166
11182
|
type: "array";
|
|
11167
11183
|
itemType?: {
|
|
@@ -11172,8 +11188,29 @@ declare type JSONLikeType<P> = "object" | ({
|
|
|
11172
11188
|
/**
|
|
11173
11189
|
* Optional function that generates a name for this item in the array
|
|
11174
11190
|
*/
|
|
11175
|
-
nameFunc?: (item: any) => string | undefined;
|
|
11191
|
+
nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
|
|
11176
11192
|
};
|
|
11193
|
+
/**
|
|
11194
|
+
* Specify how to let Plasmic know how to update its own internal representation of the data when the value has
|
|
11195
|
+
* changed, or when issuing a minimalValue or shownValue that is different.
|
|
11196
|
+
*
|
|
11197
|
+
* Important to specify this if you are expecting any nested expression values in this data type!
|
|
11198
|
+
*/
|
|
11199
|
+
unstable__keyFunc?: (item: any) => any;
|
|
11200
|
+
/**
|
|
11201
|
+
* Specify what would be the tentative new value that is set if the user makes any changes.
|
|
11202
|
+
*
|
|
11203
|
+
* Useful for field mappings.
|
|
11204
|
+
*
|
|
11205
|
+
* For instance, consider a Table where we have a `fields` prop:
|
|
11206
|
+
*
|
|
11207
|
+
* - Initially, the value is undefined. But if the user makes any changes, we would want to save an array of at
|
|
11208
|
+
* least three items (corresponding to, say, three columns inferred from a schema).
|
|
11209
|
+
*
|
|
11210
|
+
* - Let's say there are 5 columns in the value. The data schema changes, removing a column and adding two new
|
|
11211
|
+
* ones. Now we would want a different minimal value, containing 6 items.
|
|
11212
|
+
*/
|
|
11213
|
+
unstable__minimalValue?: ContextDependentConfig<P, any>;
|
|
11177
11214
|
} & DefaultValueOrExpr<P, any[]> & PropTypeBase<P>) | ({
|
|
11178
11215
|
type: "dataSource";
|
|
11179
11216
|
dataSource: "airtable" | "cms";
|
|
@@ -11902,6 +11939,31 @@ declare type Queries = {
|
|
|
11902
11939
|
};
|
|
11903
11940
|
declare function createUseScreenVariants(isMulti: boolean, screenQueries: Queries): () => string | string[] | undefined;
|
|
11904
11941
|
|
|
11942
|
+
interface PlasmicDataSourceContextValue {
|
|
11943
|
+
userAuthToken?: string | null;
|
|
11944
|
+
isUserLoading?: boolean;
|
|
11945
|
+
authRedirectUri?: string;
|
|
11946
|
+
user?: {
|
|
11947
|
+
email: string;
|
|
11948
|
+
properties: Record<string, unknown> | null;
|
|
11949
|
+
roleId: string;
|
|
11950
|
+
roleName: string;
|
|
11951
|
+
roleIds: string[];
|
|
11952
|
+
roleNames: string[];
|
|
11953
|
+
} | null;
|
|
11954
|
+
}
|
|
11955
|
+
declare function useCurrentUser(): {
|
|
11956
|
+
email: string;
|
|
11957
|
+
properties: Record<string, unknown> | null;
|
|
11958
|
+
roleId: string;
|
|
11959
|
+
roleName: string;
|
|
11960
|
+
roleIds: string[];
|
|
11961
|
+
roleNames: string[];
|
|
11962
|
+
} | {
|
|
11963
|
+
isLoggedIn: boolean;
|
|
11964
|
+
};
|
|
11965
|
+
declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
|
|
11966
|
+
|
|
11905
11967
|
/**
|
|
11906
11968
|
* Returns whether the component is currently being server side rendered or
|
|
11907
11969
|
* hydrated on the client. Can be used to delay browser-specific rendering
|
|
@@ -11927,32 +11989,7 @@ declare function genTranslatableString(elt: React__default.ReactNode): {
|
|
|
11927
11989
|
};
|
|
11928
11990
|
declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
|
|
11929
11991
|
|
|
11930
|
-
interface PlasmicDataSourceContextValue {
|
|
11931
|
-
userAuthToken?: string;
|
|
11932
|
-
isUserLoading?: boolean;
|
|
11933
|
-
authRedirectUri?: string;
|
|
11934
|
-
user?: {
|
|
11935
|
-
email: string;
|
|
11936
|
-
properties: Record<string, unknown> | null;
|
|
11937
|
-
roleId: string;
|
|
11938
|
-
roleName: string;
|
|
11939
|
-
roleIds: string[];
|
|
11940
|
-
roleNames: string[];
|
|
11941
|
-
};
|
|
11942
|
-
}
|
|
11943
|
-
declare function useCurrentUser(): {
|
|
11944
|
-
email: string;
|
|
11945
|
-
properties: Record<string, unknown> | null;
|
|
11946
|
-
roleId: string;
|
|
11947
|
-
roleName: string;
|
|
11948
|
-
roleIds: string[];
|
|
11949
|
-
roleNames: string[];
|
|
11950
|
-
} | {
|
|
11951
|
-
isLoggedIn: boolean;
|
|
11952
|
-
};
|
|
11953
|
-
declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
|
|
11954
|
-
|
|
11955
|
-
interface PlasmicRootProviderProps {
|
|
11992
|
+
interface PlasmicRootProviderProps extends PlasmicDataSourceContextValue {
|
|
11956
11993
|
platform?: "nextjs" | "gatsby";
|
|
11957
11994
|
children?: React$1.ReactNode;
|
|
11958
11995
|
translator?: PlasmicTranslator;
|
|
@@ -13302,4 +13339,4 @@ interface TriggeredOverlayContextValue {
|
|
|
13302
13339
|
}
|
|
13303
13340
|
declare const TriggeredOverlayContext: React$1.Context<TriggeredOverlayContextValue | undefined>;
|
|
13304
13341
|
|
|
13305
|
-
export { $State, $StateSpec, 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, generateStateOnChangePropForCodeComponents, generateStateValueProp, dlv as get, getCurrentInitialValue, getDataProps, getStateCellsInPlasmicProxy, getStateSpecInPlasmicProxy, hasVariant, initializeCodeComponentStates, initializePlasmicStates, is$StateProxy, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, resetToInitialValue, set, setPlumeStrictMode, useButton, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
13342
|
+
export { $State, $StateSpec, 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, generateStateOnChangePropForCodeComponents, generateStateValueProp, dlv as get, getCurrentInitialValue, getDataProps, getStateCellsInPlasmicProxy, getStateSpecInPlasmicProxy, hasVariant, initializeCodeComponentStates, initializePlasmicStates, is$StateProxy, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, resetToInitialValue, set, setPlumeStrictMode, useButton, useCheckbox, useCurrentUser, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, withPlasmicPageGuard, wrapWithClassName };
|
|
@@ -6,5 +6,6 @@ interface PlasmicPageGuardProps {
|
|
|
6
6
|
canTriggerLogin: boolean;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export declare function PlasmicPageGuard(props: PlasmicPageGuardProps):
|
|
9
|
+
export declare function PlasmicPageGuard(props: PlasmicPageGuardProps): JSX.Element | null;
|
|
10
|
+
export declare function withPlasmicPageGuard<P extends object>(WrappedComponent: React.ComponentType<P>, options: Omit<PlasmicPageGuardProps, "children">): React.FC<P>;
|
|
10
11
|
export {};
|
package/dist/index-common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _classNames from "classnames";
|
|
2
|
-
export { PlasmicPageGuard } from "./auth/PlasmicPageGuard";
|
|
2
|
+
export { PlasmicPageGuard, withPlasmicPageGuard, } from "./auth/PlasmicPageGuard";
|
|
3
3
|
export { omit, pick } from "./common";
|
|
4
4
|
export { HTMLElementRefOf, StrictProps } from "./react-utils";
|
|
5
5
|
export { createPlasmicElementProxy, deriveRenderOpts, Flex, hasVariant, makeFragment, mergeVariantsWithStates, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, wrapWithClassName, } from "./render/elements";
|
|
@@ -966,7 +966,13 @@ function PlasmicPageGuard(props) {
|
|
|
966
966
|
if (!canUserViewPage()) {
|
|
967
967
|
return React__default.createElement("div", null, "You don't have access to this page");
|
|
968
968
|
}
|
|
969
|
-
return children;
|
|
969
|
+
return React__default.createElement(React__default.Fragment, null, children);
|
|
970
|
+
}
|
|
971
|
+
function withPlasmicPageGuard(WrappedComponent, options) {
|
|
972
|
+
var PageGuard = function PageGuard(props) {
|
|
973
|
+
return React__default.createElement(PlasmicPageGuard, Object.assign({}, options), React__default.createElement(WrappedComponent, Object.assign({}, props)));
|
|
974
|
+
};
|
|
975
|
+
return PageGuard;
|
|
970
976
|
}
|
|
971
977
|
|
|
972
978
|
function notNil(x) {
|
|
@@ -4726,5 +4732,6 @@ exports.useSwitch = useSwitch;
|
|
|
4726
4732
|
exports.useTextInput = useTextInput;
|
|
4727
4733
|
exports.useTrigger = useTrigger;
|
|
4728
4734
|
exports.useTriggeredOverlay = useTriggeredOverlay;
|
|
4735
|
+
exports.withPlasmicPageGuard = withPlasmicPageGuard;
|
|
4729
4736
|
exports.wrapWithClassName = wrapWithClassName;
|
|
4730
4737
|
//# sourceMappingURL=react-web.cjs.development.js.map
|