@plasmicapp/react-web 0.2.233 → 0.2.235

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.
@@ -1424,6 +1424,15 @@ var PlasmicTranslatorContext = React__default.createContext(undefined);
1424
1424
  function isIterable(val) {
1425
1425
  return val != null && typeof val[Symbol.iterator] === "function";
1426
1426
  }
1427
+ function usePlasmicTranslator() {
1428
+ var _t = React__default.useContext(PlasmicTranslatorContext);
1429
+ var translator = _t
1430
+ ? typeof _t === "function"
1431
+ ? _t
1432
+ : _t.translator
1433
+ : undefined;
1434
+ return translator;
1435
+ }
1427
1436
  function genTranslatableString(elt, opts) {
1428
1437
  var components = {};
1429
1438
  var componentsCount = 0;
@@ -2005,9 +2014,13 @@ function subscribeToValtio($$state, statePath, node) {
2005
2014
  var maybeValtioProxy = spec.valueProp
2006
2015
  ? $$state.env.$props[spec.valueProp]
2007
2016
  : get($$state.stateValues, statePath);
2008
- if (getVersion(maybeValtioProxy) && spec.onChangeProp) {
2017
+ if (getVersion(maybeValtioProxy) &&
2018
+ (spec.onChangeProp || (spec.onMutate && node.isLeaf()))) {
2009
2019
  var unsub = subscribe(maybeValtioProxy, function () {
2010
2020
  var _a, _b;
2021
+ if (spec.onMutate && node.isLeaf()) {
2022
+ spec.onMutate(maybeValtioProxy, spec.refName ? $$state.env.$refs[spec.refName] : undefined);
2023
+ }
2011
2024
  (_b = (_a = $$state.env.$props)[spec.onChangeProp]) === null || _b === void 0 ? void 0 : _b.call(_a, spec.valueProp
2012
2025
  ? $$state.env.$props[spec.valueProp]
2013
2026
  : get($$state.stateValues, statePath));
@@ -2176,11 +2189,12 @@ var mkUntrackedValue = function (o) {
2176
2189
  return o != null && typeof o === "object" ? ref(o) : o;
2177
2190
  };
2178
2191
  var envFieldsAreNonNill = function (env) {
2179
- var _a, _b;
2192
+ var _a, _b, _c;
2180
2193
  return ({
2181
2194
  $props: env.$props,
2182
2195
  $ctx: (_a = env.$ctx) !== null && _a !== void 0 ? _a : {},
2183
2196
  $queries: (_b = env.$queries) !== null && _b !== void 0 ? _b : {},
2197
+ $refs: (_c = env.$refs) !== null && _c !== void 0 ? _c : {},
2184
2198
  });
2185
2199
  };
2186
2200
  /**
@@ -2417,6 +2431,10 @@ function initializeCodeComponentStates($state, states, repetitionIndex, componen
2417
2431
  finally { if (e_1) throw e_1.error; }
2418
2432
  }
2419
2433
  }
2434
+ function generateOnMutateForSpec(stateName, componentHelpers) {
2435
+ var _a, _b;
2436
+ 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;
2437
+ }
2420
2438
  function initializePlasmicStates($state, states, repetitionIndex) {
2421
2439
  var e_2, _a;
2422
2440
  var _b;
@@ -3810,5 +3828,5 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef, isDismissabl
3810
3828
  };
3811
3829
  }
3812
3830
 
3813
- export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateStateOnChangeProp, generateStateOnChangePropForCodeComponents, generateStateValueProp, getCurrentInitialValue, getDataProps, getStateCellsInPlasmicProxy, getStateSpecInPlasmicProxy, hasVariant, initializeCodeComponentStates, initializePlasmicStates, is$StateProxy, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, resetToInitialValue, set, setPlumeStrictMode, useButton, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, withPlasmicPageGuard, wrapWithClassName };
3831
+ export { DropdownMenu, PlasmicHead, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicPageGuard, PlasmicRootProvider, PlasmicSlot, SelectContext, Stack, Trans, TriggeredOverlayContext, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, generateOnMutateForSpec, generateStateOnChangeProp, generateStateOnChangePropForCodeComponents, generateStateValueProp, getCurrentInitialValue, getDataProps, getStateCellsInPlasmicProxy, getStateSpecInPlasmicProxy, hasVariant, initializeCodeComponentStates, initializePlasmicStates, is$StateProxy, isPlasmicStateProxy, makeFragment, mergeVariantsWithStates, omit, pick, plasmicHeadMeta, renderPlasmicSlot, resetToInitialValue, set, setPlumeStrictMode, useButton, useCheckbox, useDollarState, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, usePlasmicTranslator, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, withPlasmicPageGuard, wrapWithClassName };
3814
3832
  //# sourceMappingURL=react-web.esm.js.map