@plasmicapp/react-web 0.2.93 → 0.2.96
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 +254 -235
- package/dist/index-common.d.ts +1 -0
- package/dist/plume/collection-utils.d.ts +1 -1
- package/dist/plume/menu/context.d.ts +2 -2
- package/dist/plume/menu-button/menu-trigger.d.ts +2 -2
- package/dist/plume/select/context.d.ts +1 -1
- package/dist/plume/triggered-overlay/context.d.ts +3 -3
- package/dist/react-utils.d.ts +2 -2
- package/dist/react-web.cjs.development.js +148 -40
- 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 +110 -4
- package/dist/react-web.esm.js.map +1 -1
- package/dist/render/ssr.d.ts +3 -1
- package/dist/render/translation.d.ts +18 -0
- package/package.json +23 -7
- package/skinny/dist/{collection-utils-3487dd27.js → collection-utils-2745acd4.js} +2 -2
- package/skinny/dist/collection-utils-2745acd4.js.map +1 -0
- package/skinny/dist/context-034b8d25.js.map +1 -1
- package/skinny/dist/index-common.d.ts +1 -0
- package/skinny/dist/index.js +3 -2
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/plume/checkbox/index.js +5 -3
- package/skinny/dist/plume/checkbox/index.js.map +1 -1
- package/skinny/dist/plume/menu/context.d.ts +2 -2
- package/skinny/dist/plume/menu/index.js +7 -4
- package/skinny/dist/plume/menu/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/index.js +6 -3
- package/skinny/dist/plume/menu-button/index.js.map +1 -1
- package/skinny/dist/plume/menu-button/menu-trigger.d.ts +1 -1
- package/skinny/dist/plume/select/context.d.ts +1 -1
- package/skinny/dist/plume/select/index.js +9 -4
- package/skinny/dist/plume/select/index.js.map +1 -1
- package/skinny/dist/plume/switch/index.js +5 -3
- package/skinny/dist/plume/switch/index.js.map +1 -1
- package/skinny/dist/plume/triggered-overlay/context.d.ts +3 -3
- package/skinny/dist/plume/triggered-overlay/index.js +2 -1
- package/skinny/dist/plume/triggered-overlay/index.js.map +1 -1
- package/skinny/dist/react-utils.d.ts +1 -1
- package/skinny/dist/render/ssr.d.ts +3 -1
- package/skinny/dist/render/translation.d.ts +18 -0
- package/skinny/dist/ssr-fbf922f6.js +108 -0
- package/skinny/dist/ssr-fbf922f6.js.map +1 -0
- package/skinny/dist/collection-utils-3487dd27.js.map +0 -1
- package/skinny/dist/ssr-d2fd94f2.js +0 -31
- package/skinny/dist/ssr-d2fd94f2.js.map +0 -1
package/dist/react-web.esm.js
CHANGED
|
@@ -2,8 +2,22 @@ import classNames$1 from 'classnames';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { forwardRef, createElement, Fragment, isValidElement, useState, useRef, useMemo, createContext, useContext, useImperativeHandle, useCallback, cloneElement } from 'react';
|
|
4
4
|
import ReactDOM__default, { createPortal } from 'react-dom';
|
|
5
|
-
import { SSRProvider, useIsSSR as useIsSSR$1
|
|
6
|
-
import {
|
|
5
|
+
import { SSRProvider, useIsSSR as useIsSSR$1 } from '@react-aria/ssr';
|
|
6
|
+
import { useFocusRing, useFocusable, FocusScope } from '@react-aria/focus';
|
|
7
|
+
import { useCheckbox as useCheckbox$1 } from '@react-aria/checkbox';
|
|
8
|
+
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
|
9
|
+
import { useToggleState } from '@react-stately/toggle';
|
|
10
|
+
import { useMenu as useMenu$1, useMenuSection, useMenuItem as useMenuItem$1, useMenuTrigger as useMenuTrigger$1 } from '@react-aria/menu';
|
|
11
|
+
import { useTreeState } from '@react-stately/tree';
|
|
12
|
+
import { Item, Section } from '@react-stately/collections';
|
|
13
|
+
import { useSeparator } from '@react-aria/separator';
|
|
14
|
+
import { useMenuTriggerState } from '@react-stately/menu';
|
|
15
|
+
import { usePress } from '@react-aria/interactions';
|
|
16
|
+
import { useSelect as useSelect$1, HiddenSelect } from '@react-aria/select';
|
|
17
|
+
import { useListBox, useOption, useListBoxSection } from '@react-aria/listbox';
|
|
18
|
+
import { useSelectState } from '@react-stately/select';
|
|
19
|
+
import { useSwitch as useSwitch$1 } from '@react-aria/switch';
|
|
20
|
+
import { useOverlay, useOverlayPosition, DismissButton } from '@react-aria/overlays';
|
|
7
21
|
|
|
8
22
|
function _extends() {
|
|
9
23
|
_extends = Object.assign || function (target) {
|
|
@@ -1338,6 +1352,96 @@ function createUseScreenVariants(isMulti, screenQueries) {
|
|
|
1338
1352
|
};
|
|
1339
1353
|
}
|
|
1340
1354
|
|
|
1355
|
+
var PlasmicTranslatorContext = /*#__PURE__*/React__default.createContext(undefined);
|
|
1356
|
+
|
|
1357
|
+
function isIterable(val) {
|
|
1358
|
+
return val != null && typeof val[Symbol.iterator] === "function";
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
function genTranslatableString(elt) {
|
|
1362
|
+
var components = {};
|
|
1363
|
+
var componentsCount = 0;
|
|
1364
|
+
|
|
1365
|
+
var getText = function getText(node) {
|
|
1366
|
+
if (!node) {
|
|
1367
|
+
return "";
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
if (typeof node === "number" || typeof node === "boolean" || typeof node === "string") {
|
|
1371
|
+
return node.toString();
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
if (typeof node !== "object") {
|
|
1375
|
+
return "";
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
if (Array.isArray(node) || isIterable(node)) {
|
|
1379
|
+
return Array.from(node).map(function (child) {
|
|
1380
|
+
return getText(child);
|
|
1381
|
+
}).filter(function (child) {
|
|
1382
|
+
return !!child;
|
|
1383
|
+
}).join("");
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
var nodeChildren = hasKey(node, "props") && hasKey(node.props, "children") && node.props.children || hasKey(node, "children") && node.children || [];
|
|
1387
|
+
var contents = "" + React__default.Children.toArray(nodeChildren).map(function (child) {
|
|
1388
|
+
return getText(child);
|
|
1389
|
+
}).filter(function (child) {
|
|
1390
|
+
return !!child;
|
|
1391
|
+
}).join("");
|
|
1392
|
+
|
|
1393
|
+
if (React__default.isValidElement(node) && node.type === React__default.Fragment) {
|
|
1394
|
+
return contents;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
var componentId = componentsCount + 1;
|
|
1398
|
+
componentsCount++;
|
|
1399
|
+
components[componentId] = React__default.isValidElement(node) ? React__default.cloneElement(node, {
|
|
1400
|
+
key: componentId,
|
|
1401
|
+
children: undefined
|
|
1402
|
+
}) : node;
|
|
1403
|
+
return "<" + componentId + ">" + contents + "</" + componentId + ">";
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
var str = getText(elt);
|
|
1407
|
+
return {
|
|
1408
|
+
str: str,
|
|
1409
|
+
components: components,
|
|
1410
|
+
componentsCount: componentsCount
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
function Trans(_ref) {
|
|
1414
|
+
var children = _ref.children;
|
|
1415
|
+
|
|
1416
|
+
var _t = React__default.useContext(PlasmicTranslatorContext);
|
|
1417
|
+
|
|
1418
|
+
if (!_t) {
|
|
1419
|
+
warnNoTranslationFunctionAtMostOnce();
|
|
1420
|
+
return children;
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
var _genTranslatableStrin = genTranslatableString(children),
|
|
1424
|
+
str = _genTranslatableStrin.str,
|
|
1425
|
+
components = _genTranslatableStrin.components,
|
|
1426
|
+
componentsCount = _genTranslatableStrin.componentsCount;
|
|
1427
|
+
|
|
1428
|
+
return _t(str, componentsCount > 0 ? {
|
|
1429
|
+
components: components
|
|
1430
|
+
} : undefined);
|
|
1431
|
+
}
|
|
1432
|
+
var hasWarned = false;
|
|
1433
|
+
|
|
1434
|
+
function warnNoTranslationFunctionAtMostOnce() {
|
|
1435
|
+
if (!hasWarned) {
|
|
1436
|
+
console.warn("Using Plasmic Translation but no translation function has been provided");
|
|
1437
|
+
hasWarned = true;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
function hasKey(v, key) {
|
|
1442
|
+
return typeof v === "object" && v !== null && key in v;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1341
1445
|
var PlasmicRootContext = /*#__PURE__*/createContext(undefined);
|
|
1342
1446
|
function PlasmicRootProvider(props) {
|
|
1343
1447
|
var platform = props.platform,
|
|
@@ -1349,7 +1453,9 @@ function PlasmicRootProvider(props) {
|
|
|
1349
1453
|
}, [platform]);
|
|
1350
1454
|
return createElement(PlasmicRootContext.Provider, {
|
|
1351
1455
|
value: context
|
|
1352
|
-
}, createElement(SSRProvider, null,
|
|
1456
|
+
}, createElement(SSRProvider, null, createElement(PlasmicTranslatorContext.Provider, {
|
|
1457
|
+
value: props.translator
|
|
1458
|
+
}, children)));
|
|
1353
1459
|
}
|
|
1354
1460
|
var useIsSSR = useIsSSR$1;
|
|
1355
1461
|
function useHasPlasmicRoot() {
|
|
@@ -3008,5 +3114,5 @@ function useTriggeredOverlay(plasmicClass, props, config, outerRef) {
|
|
|
3008
3114
|
};
|
|
3009
3115
|
}
|
|
3010
3116
|
|
|
3011
|
-
export { DropdownMenu, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, Stack, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, getDataProps, hasVariant, makeFragment, omit, pick, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
3117
|
+
export { DropdownMenu, PlasmicIcon, PlasmicImg, PlasmicLink, PlasmicRootProvider, PlasmicSlot, Stack, Trans, classNames, createPlasmicElementProxy, createUseScreenVariants, deriveRenderOpts, ensureGlobalVariants, genTranslatableString, getDataProps, hasVariant, makeFragment, omit, pick, renderPlasmicSlot, setPlumeStrictMode, useButton, useCheckbox, useIsSSR, useMenu, useMenuButton, useMenuGroup, useMenuItem, useSelect, useSelectOption, useSelectOptionGroup, useSwitch, useTextInput, useTrigger, useTriggeredOverlay, wrapWithClassName };
|
|
3012
3118
|
//# sourceMappingURL=react-web.esm.js.map
|