@plasmicapp/react-web 0.2.234 → 0.2.236
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 +20 -5
- package/dist/index.cjs.js +12 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +12 -3
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/helpers.d.ts +1 -0
- package/dist/states/index.d.ts +1 -1
- package/dist/states/types.d.ts +4 -1
- package/package.json +4 -4
- package/skinny/dist/index.js +12 -3
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/helpers.d.ts +1 -0
- package/skinny/dist/states/index.d.ts +1 -1
- package/skinny/dist/states/types.d.ts +4 -1
package/dist/all.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ type InitFuncEnv = {
|
|
|
44
44
|
$state: Record<string, any>;
|
|
45
45
|
$queries?: Record<string, any>;
|
|
46
46
|
$ctx?: Record<string, any>;
|
|
47
|
+
$refs?: Record<string, any>;
|
|
47
48
|
};
|
|
48
49
|
type DollarStateEnv = Omit<InitFuncEnv, "$state">;
|
|
49
50
|
type NoUndefinedField<T> = {
|
|
@@ -61,6 +62,8 @@ interface $StateSpec<T> {
|
|
|
61
62
|
isImmutable?: boolean;
|
|
62
63
|
variableType: "text" | "number" | "boolean" | "array" | "object" | "variant";
|
|
63
64
|
initFuncHash?: string;
|
|
65
|
+
refName?: string;
|
|
66
|
+
onMutate?: (stateValue: T, $ref: any) => void;
|
|
64
67
|
}
|
|
65
68
|
interface $State {
|
|
66
69
|
[key: string]: any;
|
|
@@ -11067,6 +11070,7 @@ type StateSpec = {
|
|
|
11067
11070
|
interface StateHelpers<P, T> {
|
|
11068
11071
|
initFunc?: ($props: P) => T;
|
|
11069
11072
|
onChangeArgsToValue?: (...args: any) => T;
|
|
11073
|
+
onMutate?: (stateValue: T, $ref: any) => void;
|
|
11070
11074
|
}
|
|
11071
11075
|
type ComponentHelpers<P> = {
|
|
11072
11076
|
states: Record<string, StateHelpers<P, any>>;
|
|
@@ -11259,6 +11263,7 @@ interface PropTypeBase<P> {
|
|
|
11259
11263
|
displayName?: string;
|
|
11260
11264
|
description?: string;
|
|
11261
11265
|
helpText?: string;
|
|
11266
|
+
required?: boolean;
|
|
11262
11267
|
/**
|
|
11263
11268
|
* If the user has chosen to use a dynamic expression for this prop, provide
|
|
11264
11269
|
* a hint as to the expected values that the expression should evaluate to.
|
|
@@ -11302,6 +11307,11 @@ interface Defaultable<P, T> {
|
|
|
11302
11307
|
*/
|
|
11303
11308
|
defaultExpr?: string;
|
|
11304
11309
|
defaultExprHint?: string;
|
|
11310
|
+
/**
|
|
11311
|
+
* This function validates whether the prop value is valid.
|
|
11312
|
+
* If the value is invalid, it returns an error message. Otherwise, it returns true.
|
|
11313
|
+
*/
|
|
11314
|
+
validator?: (value: T, ...args: ControlContext<P>) => (string | true) | Promise<string | true>;
|
|
11305
11315
|
}
|
|
11306
11316
|
interface Controllable {
|
|
11307
11317
|
/**
|
|
@@ -11477,15 +11487,19 @@ interface DataSourceType<P> extends PropTypeBase<P> {
|
|
|
11477
11487
|
dataSource: "airtable" | "cms";
|
|
11478
11488
|
}
|
|
11479
11489
|
type DataPickerValueType = string | number | (string | number)[];
|
|
11480
|
-
interface
|
|
11490
|
+
interface RichDataPickerType<P> extends PropTypeBaseDefault<P, DataPickerValueType> {
|
|
11481
11491
|
type: "dataSelector";
|
|
11482
|
-
data
|
|
11492
|
+
data?: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
|
|
11483
11493
|
alwaysShowValuePathAsLabel?: boolean;
|
|
11494
|
+
mergeWithExternalData?: boolean;
|
|
11484
11495
|
}
|
|
11485
|
-
|
|
11496
|
+
type DataPickerType<P> = "dataPicker" | RichDataPickerType<P>;
|
|
11497
|
+
interface RichExprEditorType<P> extends PropTypeBaseDefault<P, DataPickerValueType> {
|
|
11486
11498
|
type: "exprEditor";
|
|
11487
|
-
data
|
|
11499
|
+
data?: Record<string, any> | ContextDependentConfig<P, Record<string, any>>;
|
|
11500
|
+
mergeWithExternalData?: boolean;
|
|
11488
11501
|
}
|
|
11502
|
+
type ExprEditorType<P> = "exprEditor" | RichExprEditorType<P>;
|
|
11489
11503
|
interface FormValidationRulesType<P> extends PropTypeBaseDefault<P, any> {
|
|
11490
11504
|
type: "formValidationRules";
|
|
11491
11505
|
}
|
|
@@ -11755,6 +11769,7 @@ declare function initializeCodeComponentStates($state: $State, states: {
|
|
|
11755
11769
|
name: string;
|
|
11756
11770
|
plasmicStateName: string;
|
|
11757
11771
|
}[], repetitionIndex: number[], componentHelpers: ComponentHelpers<any>, child$Props: Record<string, any>): void;
|
|
11772
|
+
declare function generateOnMutateForSpec(stateName: string, componentHelpers: ComponentHelpers<any>): ((stateValue: any, $ref: any) => void) | undefined;
|
|
11758
11773
|
declare function initializePlasmicStates($state: $State, states: {
|
|
11759
11774
|
name: string;
|
|
11760
11775
|
initFunc: InitFunc<any>;
|
|
@@ -13414,4 +13429,4 @@ interface TriggeredOverlayContextValue {
|
|
|
13414
13429
|
}
|
|
13415
13430
|
declare const TriggeredOverlayContext: React$1.Context<TriggeredOverlayContextValue | undefined>;
|
|
13416
13431
|
|
|
13417
|
-
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, PlasmicTranslator, PlumeButtonProps, PlumeTextInputProps, 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, usePlasmicTranslator, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, withPlasmicPageGuard, wrapWithClassName };
|
|
13432
|
+
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, PlasmicTranslator, PlumeButtonProps, PlumeTextInputProps, SelectContext, SelectOptionRef, SelectRef, SelectRefValue, SingleBooleanChoiceArg, SingleChoiceArg, Stack, StrictProps, SwitchProps, SwitchRef, SwitchRefValue, TextInputRef, TextInputRefValue, Trans, TriggeredOverlayConfig, TriggeredOverlayContext, TriggeredOverlayRef, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateOnMutateForSpec, 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, usePlasmicTranslator, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, withPlasmicPageGuard, wrapWithClassName };
|
package/dist/index.cjs.js
CHANGED
|
@@ -2045,9 +2045,13 @@ function subscribeToValtio($$state, statePath, node) {
|
|
|
2045
2045
|
var maybeValtioProxy = spec.valueProp
|
|
2046
2046
|
? $$state.env.$props[spec.valueProp]
|
|
2047
2047
|
: get__default['default']($$state.stateValues, statePath);
|
|
2048
|
-
if (valtio.getVersion(maybeValtioProxy) &&
|
|
2048
|
+
if (valtio.getVersion(maybeValtioProxy) &&
|
|
2049
|
+
(spec.onChangeProp || (spec.onMutate && node.isLeaf()))) {
|
|
2049
2050
|
var unsub = valtio.subscribe(maybeValtioProxy, function () {
|
|
2050
2051
|
var _a, _b;
|
|
2052
|
+
if (spec.onMutate && node.isLeaf()) {
|
|
2053
|
+
spec.onMutate(maybeValtioProxy, spec.refName ? $$state.env.$refs[spec.refName] : undefined);
|
|
2054
|
+
}
|
|
2051
2055
|
(_b = (_a = $$state.env.$props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, spec.valueProp
|
|
2052
2056
|
? $$state.env.$props[spec.valueProp]
|
|
2053
2057
|
: get__default['default']($$state.stateValues, statePath));
|
|
@@ -2216,11 +2220,12 @@ var mkUntrackedValue = function (o) {
|
|
|
2216
2220
|
return o != null && typeof o === "object" ? valtio.ref(o) : o;
|
|
2217
2221
|
};
|
|
2218
2222
|
var envFieldsAreNonNill = function (env) {
|
|
2219
|
-
var _a, _b;
|
|
2223
|
+
var _a, _b, _c;
|
|
2220
2224
|
return ({
|
|
2221
2225
|
$props: env.$props,
|
|
2222
2226
|
$ctx: (_a = env.$ctx) !== null && _a !== void 0 ? _a : {},
|
|
2223
2227
|
$queries: (_b = env.$queries) !== null && _b !== void 0 ? _b : {},
|
|
2228
|
+
$refs: (_c = env.$refs) !== null && _c !== void 0 ? _c : {},
|
|
2224
2229
|
});
|
|
2225
2230
|
};
|
|
2226
2231
|
/**
|
|
@@ -2457,6 +2462,10 @@ function initializeCodeComponentStates($state, states, repetitionIndex, componen
|
|
|
2457
2462
|
finally { if (e_1) throw e_1.error; }
|
|
2458
2463
|
}
|
|
2459
2464
|
}
|
|
2465
|
+
function generateOnMutateForSpec(stateName, componentHelpers) {
|
|
2466
|
+
var _a, _b;
|
|
2467
|
+
return (_b = (_a = componentHelpers === null || componentHelpers === void 0 ? void 0 : componentHelpers.states) === null || _a === void 0 ? void 0 : _a[stateName]) === null || _b === void 0 ? void 0 : _b.onMutate;
|
|
2468
|
+
}
|
|
2460
2469
|
function initializePlasmicStates($state, states, repetitionIndex) {
|
|
2461
2470
|
var e_2, _a;
|
|
2462
2471
|
var _b;
|
|
@@ -3886,6 +3895,7 @@ exports.createUseScreenVariants = createUseScreenVariants;
|
|
|
3886
3895
|
exports.deriveRenderOpts = deriveRenderOpts;
|
|
3887
3896
|
exports.ensureGlobalVariants = ensureGlobalVariants;
|
|
3888
3897
|
exports.genTranslatableString = genTranslatableString;
|
|
3898
|
+
exports.generateOnMutateForSpec = generateOnMutateForSpec;
|
|
3889
3899
|
exports.generateStateOnChangeProp = generateStateOnChangeProp;
|
|
3890
3900
|
exports.generateStateOnChangePropForCodeComponents = generateStateOnChangePropForCodeComponents;
|
|
3891
3901
|
exports.generateStateValueProp = generateStateValueProp;
|