@plasmicapp/react-web 0.2.356 → 0.2.358
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 +88 -86
- package/dist/index-common.d.ts +3 -2
- package/dist/index.cjs.js +15 -16
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +16 -17
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/ssr.d.ts +1 -1
- package/dist/render/translation.d.ts +2 -10
- package/package.json +4 -4
- package/skinny/dist/index-common.d.ts +3 -2
- package/skinny/dist/index.js +7 -9
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +1 -1
- package/skinny/dist/plume/menu/index.js +1 -1
- package/skinny/dist/plume/menu-button/index.js +1 -1
- package/skinny/dist/plume/select/index.js +1 -1
- package/skinny/dist/plume/switch/index.js +1 -1
- package/skinny/dist/render/ssr.d.ts +1 -1
- package/skinny/dist/render/translation.d.ts +2 -10
- package/skinny/dist/{ssr-64c8ab20.js → ssr-61d6e91a.js} +12 -11
- package/skinny/dist/ssr-61d6e91a.js.map +1 -0
- package/skinny/dist/ssr-64c8ab20.js.map +0 -1
package/dist/all.d.ts
CHANGED
|
@@ -2,67 +2,6 @@
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { AriaAttributes, DOMAttributes as DOMAttributes$1, AriaRole, CSSProperties as CSSProperties$1, ReactNode, ReactElement, FocusEvent, KeyboardEvent as KeyboardEvent$1, SyntheticEvent } from 'react';
|
|
4
4
|
|
|
5
|
-
interface PlasmicPageGuardProps {
|
|
6
|
-
appId: string;
|
|
7
|
-
authorizeEndpoint: string;
|
|
8
|
-
minRole?: string;
|
|
9
|
-
canTriggerLogin: boolean;
|
|
10
|
-
children: React__default.ReactNode;
|
|
11
|
-
unauthorizedComp?: React__default.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
declare function PlasmicPageGuard(props: PlasmicPageGuardProps): React__default.JSX.Element | null;
|
|
14
|
-
declare function withPlasmicPageGuard<P extends object>(WrappedComponent: React__default.ComponentType<P>, options: Omit<PlasmicPageGuardProps, "children">): React__default.FC<P>;
|
|
15
|
-
|
|
16
|
-
declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
|
|
17
|
-
declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
|
|
18
|
-
|
|
19
|
-
type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
|
|
20
|
-
type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
|
|
21
|
-
|
|
22
|
-
// Type definitions for dlv 1.1
|
|
23
|
-
// Project: https://github.com/developit/dlv#readme
|
|
24
|
-
// Definitions by: Ryan Sonshine <https://github.com/ryansonshine>
|
|
25
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
26
|
-
// TypeScript Version: 2.2
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
declare function dlv(object: object, key: string | Array<string | number>, defaultValue?: any): any;
|
|
30
|
-
|
|
31
|
-
type InitFuncEnv = {
|
|
32
|
-
$props: Record<string, any>;
|
|
33
|
-
$state: Record<string, any>;
|
|
34
|
-
$queries?: Record<string, any>;
|
|
35
|
-
$ctx?: Record<string, any>;
|
|
36
|
-
$refs?: Record<string, any>;
|
|
37
|
-
};
|
|
38
|
-
type DollarStateEnv = Omit<InitFuncEnv, "$state">;
|
|
39
|
-
type NoUndefinedField<T> = {
|
|
40
|
-
[P in keyof T]-?: T[P];
|
|
41
|
-
};
|
|
42
|
-
type InitFunc<T> = (env: NoUndefinedField<InitFuncEnv>) => T;
|
|
43
|
-
type ObjectPath = (string | number)[];
|
|
44
|
-
interface $StateSpec<T> {
|
|
45
|
-
path: string;
|
|
46
|
-
initFunc?: InitFunc<T>;
|
|
47
|
-
initVal?: T;
|
|
48
|
-
type: "private" | "readonly" | "writable";
|
|
49
|
-
valueProp?: string;
|
|
50
|
-
onChangeProp?: string;
|
|
51
|
-
isImmutable?: boolean;
|
|
52
|
-
variableType: "text" | "number" | "boolean" | "array" | "object" | "variant" | "dateString" | "dateRangeStrings";
|
|
53
|
-
initFuncHash?: string;
|
|
54
|
-
refName?: string;
|
|
55
|
-
onMutate?: (stateValue: T, $ref: any) => void;
|
|
56
|
-
}
|
|
57
|
-
interface $State {
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
registerInitFunc?: (path: string, f: InitFunc<any>, repetitonIndex?: number[], overrideEnv?: DollarStateEnv) => any;
|
|
60
|
-
}
|
|
61
|
-
interface Internal$StateSpec<T> extends $StateSpec<T> {
|
|
62
|
-
isRepeated: boolean;
|
|
63
|
-
pathObj: (string | symbol)[];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
5
|
declare global {
|
|
67
6
|
interface Window {
|
|
68
7
|
__PlasmicHostVersion: string;
|
|
@@ -12467,6 +12406,78 @@ declare global {
|
|
|
12467
12406
|
}
|
|
12468
12407
|
}
|
|
12469
12408
|
|
|
12409
|
+
type PlasmicTranslator = (str: string, opts?: {
|
|
12410
|
+
components?: {
|
|
12411
|
+
[key: string]: React__default.ReactElement;
|
|
12412
|
+
};
|
|
12413
|
+
}) => React__default.ReactNode;
|
|
12414
|
+
interface PlasmicI18NContextValue {
|
|
12415
|
+
translator?: PlasmicTranslator;
|
|
12416
|
+
tagPrefix?: string;
|
|
12417
|
+
}
|
|
12418
|
+
declare function usePlasmicTranslator$1(): PlasmicTranslator | undefined;
|
|
12419
|
+
|
|
12420
|
+
interface PlasmicPageGuardProps {
|
|
12421
|
+
appId: string;
|
|
12422
|
+
authorizeEndpoint: string;
|
|
12423
|
+
minRole?: string;
|
|
12424
|
+
canTriggerLogin: boolean;
|
|
12425
|
+
children: React__default.ReactNode;
|
|
12426
|
+
unauthorizedComp?: React__default.ReactNode;
|
|
12427
|
+
}
|
|
12428
|
+
declare function PlasmicPageGuard(props: PlasmicPageGuardProps): React__default.JSX.Element | null;
|
|
12429
|
+
declare function withPlasmicPageGuard<P extends object>(WrappedComponent: React__default.ComponentType<P>, options: Omit<PlasmicPageGuardProps, "children">): React__default.FC<P>;
|
|
12430
|
+
|
|
12431
|
+
declare function pick<T extends {}>(obj: T, ...keys: (string | number | symbol)[]): Partial<T>;
|
|
12432
|
+
declare function omit<T extends {}>(obj: T, ...keys: (keyof T)[]): Partial<T>;
|
|
12433
|
+
|
|
12434
|
+
type StrictProps<T, TExpected> = Exclude<keyof T, keyof TExpected> extends never ? {} : Partial<"Unexpected extraneous props">;
|
|
12435
|
+
type HTMLElementRefOf<T extends keyof JSX.IntrinsicElements> = Exclude<React__default.ComponentProps<T>["ref"], string>;
|
|
12436
|
+
|
|
12437
|
+
// Type definitions for dlv 1.1
|
|
12438
|
+
// Project: https://github.com/developit/dlv#readme
|
|
12439
|
+
// Definitions by: Ryan Sonshine <https://github.com/ryansonshine>
|
|
12440
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
12441
|
+
// TypeScript Version: 2.2
|
|
12442
|
+
|
|
12443
|
+
|
|
12444
|
+
declare function dlv(object: object, key: string | Array<string | number>, defaultValue?: any): any;
|
|
12445
|
+
|
|
12446
|
+
type InitFuncEnv = {
|
|
12447
|
+
$props: Record<string, any>;
|
|
12448
|
+
$state: Record<string, any>;
|
|
12449
|
+
$queries?: Record<string, any>;
|
|
12450
|
+
$ctx?: Record<string, any>;
|
|
12451
|
+
$refs?: Record<string, any>;
|
|
12452
|
+
};
|
|
12453
|
+
type DollarStateEnv = Omit<InitFuncEnv, "$state">;
|
|
12454
|
+
type NoUndefinedField<T> = {
|
|
12455
|
+
[P in keyof T]-?: T[P];
|
|
12456
|
+
};
|
|
12457
|
+
type InitFunc<T> = (env: NoUndefinedField<InitFuncEnv>) => T;
|
|
12458
|
+
type ObjectPath = (string | number)[];
|
|
12459
|
+
interface $StateSpec<T> {
|
|
12460
|
+
path: string;
|
|
12461
|
+
initFunc?: InitFunc<T>;
|
|
12462
|
+
initVal?: T;
|
|
12463
|
+
type: "private" | "readonly" | "writable";
|
|
12464
|
+
valueProp?: string;
|
|
12465
|
+
onChangeProp?: string;
|
|
12466
|
+
isImmutable?: boolean;
|
|
12467
|
+
variableType: "text" | "number" | "boolean" | "array" | "object" | "variant" | "dateString" | "dateRangeStrings";
|
|
12468
|
+
initFuncHash?: string;
|
|
12469
|
+
refName?: string;
|
|
12470
|
+
onMutate?: (stateValue: T, $ref: any) => void;
|
|
12471
|
+
}
|
|
12472
|
+
interface $State {
|
|
12473
|
+
[key: string]: any;
|
|
12474
|
+
registerInitFunc?: (path: string, f: InitFunc<any>, repetitonIndex?: number[], overrideEnv?: DollarStateEnv) => any;
|
|
12475
|
+
}
|
|
12476
|
+
interface Internal$StateSpec<T> extends $StateSpec<T> {
|
|
12477
|
+
isRepeated: boolean;
|
|
12478
|
+
pathObj: (string | symbol)[];
|
|
12479
|
+
}
|
|
12480
|
+
|
|
12470
12481
|
declare function initializeCodeComponentStates($state: $State, states: {
|
|
12471
12482
|
name: string;
|
|
12472
12483
|
plasmicStateName: string;
|
|
@@ -12739,31 +12750,6 @@ declare function useCurrentUser(): {
|
|
|
12739
12750
|
*/
|
|
12740
12751
|
declare function useIsSSR$1(): boolean;
|
|
12741
12752
|
|
|
12742
|
-
type PlasmicTranslator = (str: string, opts?: {
|
|
12743
|
-
components?: {
|
|
12744
|
-
[key: string]: React__default.ReactElement;
|
|
12745
|
-
};
|
|
12746
|
-
}) => React__default.ReactNode;
|
|
12747
|
-
interface PlasmicI18NContextValue {
|
|
12748
|
-
translator?: PlasmicTranslator;
|
|
12749
|
-
tagPrefix?: string;
|
|
12750
|
-
}
|
|
12751
|
-
interface TransProps {
|
|
12752
|
-
transKey?: string;
|
|
12753
|
-
children?: React__default.ReactNode;
|
|
12754
|
-
}
|
|
12755
|
-
declare function usePlasmicTranslator(): PlasmicTranslator | undefined;
|
|
12756
|
-
declare function genTranslatableString(elt: React__default.ReactNode, opts?: {
|
|
12757
|
-
tagPrefix?: string;
|
|
12758
|
-
}): {
|
|
12759
|
-
str: string;
|
|
12760
|
-
components: {
|
|
12761
|
-
[key: string]: React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
|
12762
|
-
};
|
|
12763
|
-
componentsCount: number;
|
|
12764
|
-
};
|
|
12765
|
-
declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
|
|
12766
|
-
|
|
12767
12753
|
interface PlasmicRootProviderProps extends PlasmicDataSourceContextValue {
|
|
12768
12754
|
platform?: "nextjs" | "gatsby";
|
|
12769
12755
|
children?: React$1.ReactNode;
|
|
@@ -12831,6 +12817,22 @@ declare const Stack: (<T extends keyof JSX.IntrinsicElements = "div">(props: {
|
|
|
12831
12817
|
}>;
|
|
12832
12818
|
};
|
|
12833
12819
|
|
|
12820
|
+
declare const usePlasmicTranslator: typeof usePlasmicTranslator$1;
|
|
12821
|
+
interface TransProps {
|
|
12822
|
+
transKey?: string;
|
|
12823
|
+
children?: React__default.ReactNode;
|
|
12824
|
+
}
|
|
12825
|
+
declare function genTranslatableString(elt: React__default.ReactNode, opts?: {
|
|
12826
|
+
tagPrefix?: string;
|
|
12827
|
+
}): {
|
|
12828
|
+
str: string;
|
|
12829
|
+
components: {
|
|
12830
|
+
[key: string]: React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
|
12831
|
+
};
|
|
12832
|
+
componentsCount: number;
|
|
12833
|
+
};
|
|
12834
|
+
declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
|
|
12835
|
+
|
|
12834
12836
|
/*
|
|
12835
12837
|
* Copyright 2020 Adobe. All rights reserved.
|
|
12836
12838
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/index-common.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export { PlasmicTranslator } from "@plasmicapp/host";
|
|
1
2
|
export { PlasmicPageGuard, withPlasmicPageGuard, } from "./auth/PlasmicPageGuard";
|
|
2
3
|
export { omit, pick } from "./common";
|
|
3
4
|
export { HTMLElementRefOf, StrictProps } from "./react-utils";
|
|
4
|
-
export {
|
|
5
|
+
export { Flex, MultiChoiceArg, SingleBooleanChoiceArg, SingleChoiceArg, createPlasmicElementProxy, deriveRenderOpts, hasVariant, makeFragment, mergeVariantsWithStates, 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";
|
|
@@ -11,7 +12,7 @@ export { PlasmicSlot, renderPlasmicSlot } from "./render/PlasmicSlot";
|
|
|
11
12
|
export { createUseScreenVariants } from "./render/screen-variants";
|
|
12
13
|
export { PlasmicDataSourceContextProvider, PlasmicRootProvider, useCurrentUser, useIsSSR, } from "./render/ssr";
|
|
13
14
|
export { Stack } from "./render/Stack";
|
|
14
|
-
export {
|
|
15
|
+
export { Trans, genTranslatableString, usePlasmicTranslator, } from "./render/translation";
|
|
15
16
|
export { useTrigger } from "./render/triggers";
|
|
16
17
|
export * from "./states";
|
|
17
18
|
export declare const classNames: any;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1493,11 +1493,9 @@ function isInternalHref(href) {
|
|
|
1493
1493
|
return /^\/(?!\/)/.test(href);
|
|
1494
1494
|
}
|
|
1495
1495
|
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
}
|
|
1500
|
-
function usePlasmicTranslator() {
|
|
1496
|
+
// Make the refactor to host backwards compatible for loader
|
|
1497
|
+
var PlasmicTranslatorContext = host.PlasmicTranslatorContext !== null && host.PlasmicTranslatorContext !== void 0 ? host.PlasmicTranslatorContext : React.createContext(undefined);
|
|
1498
|
+
var usePlasmicTranslator = host.usePlasmicTranslator !== null && host.usePlasmicTranslator !== void 0 ? host.usePlasmicTranslator : (function () {
|
|
1501
1499
|
var _t = React.useContext(PlasmicTranslatorContext);
|
|
1502
1500
|
var translator = _t
|
|
1503
1501
|
? typeof _t === "function"
|
|
@@ -1505,7 +1503,7 @@ function usePlasmicTranslator() {
|
|
|
1505
1503
|
: _t.translator
|
|
1506
1504
|
: undefined;
|
|
1507
1505
|
return translator;
|
|
1508
|
-
}
|
|
1506
|
+
});
|
|
1509
1507
|
function genTranslatableString(elt, opts) {
|
|
1510
1508
|
var components = {};
|
|
1511
1509
|
var componentsCount = 0;
|
|
@@ -1585,6 +1583,9 @@ function warnNoTranslationFunctionAtMostOnce() {
|
|
|
1585
1583
|
function hasKey(v, key) {
|
|
1586
1584
|
return typeof v === "object" && v !== null && key in v;
|
|
1587
1585
|
}
|
|
1586
|
+
function isIterable(val) {
|
|
1587
|
+
return val != null && typeof val[Symbol.iterator] === "function";
|
|
1588
|
+
}
|
|
1588
1589
|
|
|
1589
1590
|
function PlasmicSlot(props) {
|
|
1590
1591
|
return renderPlasmicSlot(props);
|
|
@@ -1739,10 +1740,10 @@ function PlasmicRootProvider(props) {
|
|
|
1739
1740
|
authRedirectUri: authRedirectUri,
|
|
1740
1741
|
}); }, [userAuthToken, isUserLoading, user, authRedirectUri]);
|
|
1741
1742
|
var reactMajorVersion = +React__namespace.version.split(".")[0];
|
|
1742
|
-
return (React__namespace.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (
|
|
1743
|
-
React__namespace.createElement(React__namespace.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." },
|
|
1743
|
+
return (React__namespace.createElement(MaybeWrap, { cond: !disableLoadingBoundary && reactMajorVersion >= 18, wrapper: function (children_) { return (React__namespace.createElement(host.DataProvider, { name: "plasmicInternalEnableLoadingBoundary", hidden: true, data: true },
|
|
1744
|
+
React__namespace.createElement(React__namespace.Suspense, { fallback: suspenseFallback !== null && suspenseFallback !== void 0 ? suspenseFallback : "Loading..." }, children_))); } },
|
|
1744
1745
|
React__namespace.createElement(PlasmicRootContext.Provider, { value: context },
|
|
1745
|
-
React__namespace.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (
|
|
1746
|
+
React__namespace.createElement(MaybeWrap, { cond: reactMajorVersion < 18, wrapper: function (children_) { return React__namespace.createElement(ssr.SSRProvider, null, children_); } },
|
|
1746
1747
|
React__namespace.createElement(dataSourcesContext.PlasmicDataSourceContextProvider, { value: dataSourceContextValue },
|
|
1747
1748
|
React__namespace.createElement(PlasmicTranslatorContext.Provider, { value: (_a = props.i18n) !== null && _a !== void 0 ? _a : props.translator },
|
|
1748
1749
|
React__namespace.createElement(PlasmicHeadContext.Provider, { value: props.Head },
|
|
@@ -2110,7 +2111,7 @@ function subscribeToValtio($$state, statePath, node) {
|
|
|
2110
2111
|
}
|
|
2111
2112
|
}
|
|
2112
2113
|
function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
2113
|
-
var _a
|
|
2114
|
+
var _a;
|
|
2114
2115
|
var initialStateName = initialStateCell.node.getSpec().path;
|
|
2115
2116
|
var stateAccess = new Set();
|
|
2116
2117
|
$$state.stateInitializationEnv.visited.add(initialStateName);
|
|
@@ -2167,16 +2168,12 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
2167
2168
|
: clonedValue;
|
|
2168
2169
|
set(proxyRoot, initialStateCell.path, value);
|
|
2169
2170
|
}
|
|
2170
|
-
catch (
|
|
2171
|
+
catch (_b) {
|
|
2171
2172
|
// Setting the state to undefined to make sure it gets re-initialized
|
|
2172
2173
|
// in case it changes values.
|
|
2173
2174
|
initialStateCell.initialValue = undefined;
|
|
2174
2175
|
set(proxyRoot, initialStateCell.path, undefined);
|
|
2175
2176
|
}
|
|
2176
|
-
//immediately fire onChange
|
|
2177
|
-
if (initialSpec.onChangeProp) {
|
|
2178
|
-
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
2179
|
-
}
|
|
2180
2177
|
$$state.stateInitializationEnv.visited.delete(initialStateName);
|
|
2181
2178
|
$$state.stateInitializationEnv.stack.pop();
|
|
2182
2179
|
return initialValue;
|
|
@@ -2517,7 +2514,9 @@ function useDollarState(specs) {
|
|
|
2517
2514
|
var spec = node.getSpec();
|
|
2518
2515
|
if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
|
|
2519
2516
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2520
|
-
|
|
2517
|
+
if (stateCell.initialValue === UNINITIALIZED) {
|
|
2518
|
+
initializeStateValue($$state, stateCell, $state);
|
|
2519
|
+
}
|
|
2521
2520
|
}
|
|
2522
2521
|
});
|
|
2523
2522
|
}, []);
|