react-native-element-inspector 0.1.0
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/LICENSE +21 -0
- package/README.md +134 -0
- package/lib/ElementCycler.d.ts +14 -0
- package/lib/ElementCycler.d.ts.map +1 -0
- package/lib/ElementCycler.js +33 -0
- package/lib/ElementCycler.js.map +1 -0
- package/lib/ElementHighlighter.d.ts +21 -0
- package/lib/ElementHighlighter.d.ts.map +1 -0
- package/lib/ElementHighlighter.js +89 -0
- package/lib/ElementHighlighter.js.map +1 -0
- package/lib/ElementInspector.d.ts +12 -0
- package/lib/ElementInspector.d.ts.map +1 -0
- package/lib/ElementInspector.js +74 -0
- package/lib/ElementInspector.js.map +1 -0
- package/lib/components/Checkbox.d.ts +7 -0
- package/lib/components/Checkbox.d.ts.map +1 -0
- package/lib/components/Checkbox.js +30 -0
- package/lib/components/Checkbox.js.map +1 -0
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +2 -0
- package/lib/components/index.js.map +1 -0
- package/lib/constants/colors.d.ts +24 -0
- package/lib/constants/colors.d.ts.map +1 -0
- package/lib/constants/colors.js +18 -0
- package/lib/constants/colors.js.map +1 -0
- package/lib/constants/index.d.ts +3 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/constants/index.js +3 -0
- package/lib/constants/index.js.map +1 -0
- package/lib/constants/ui.d.ts +56 -0
- package/lib/constants/ui.d.ts.map +1 -0
- package/lib/constants/ui.js +46 -0
- package/lib/constants/ui.js.map +1 -0
- package/lib/fiber/FiberAdapter.d.ts +52 -0
- package/lib/fiber/FiberAdapter.d.ts.map +1 -0
- package/lib/fiber/FiberAdapter.js +112 -0
- package/lib/fiber/FiberAdapter.js.map +1 -0
- package/lib/fiber/detectVersion.d.ts +9 -0
- package/lib/fiber/detectVersion.d.ts.map +1 -0
- package/lib/fiber/detectVersion.js +17 -0
- package/lib/fiber/detectVersion.js.map +1 -0
- package/lib/fiber/index.d.ts +5 -0
- package/lib/fiber/index.d.ts.map +1 -0
- package/lib/fiber/index.js +4 -0
- package/lib/fiber/index.js.map +1 -0
- package/lib/fiber/types.d.ts +35 -0
- package/lib/fiber/types.d.ts.map +1 -0
- package/lib/fiber/types.js +3 -0
- package/lib/fiber/types.js.map +1 -0
- package/lib/floatingPanel/AddPropertyRow.d.ts +13 -0
- package/lib/floatingPanel/AddPropertyRow.d.ts.map +1 -0
- package/lib/floatingPanel/AddPropertyRow.js +61 -0
- package/lib/floatingPanel/AddPropertyRow.js.map +1 -0
- package/lib/floatingPanel/CloseButton.d.ts +7 -0
- package/lib/floatingPanel/CloseButton.d.ts.map +1 -0
- package/lib/floatingPanel/CloseButton.js +21 -0
- package/lib/floatingPanel/CloseButton.js.map +1 -0
- package/lib/floatingPanel/EditableValue.d.ts +12 -0
- package/lib/floatingPanel/EditableValue.d.ts.map +1 -0
- package/lib/floatingPanel/EditableValue.js +67 -0
- package/lib/floatingPanel/EditableValue.js.map +1 -0
- package/lib/floatingPanel/FloatingPanel.d.ts +7 -0
- package/lib/floatingPanel/FloatingPanel.d.ts.map +1 -0
- package/lib/floatingPanel/FloatingPanel.js +70 -0
- package/lib/floatingPanel/FloatingPanel.js.map +1 -0
- package/lib/floatingPanel/HandleContent.d.ts +7 -0
- package/lib/floatingPanel/HandleContent.d.ts.map +1 -0
- package/lib/floatingPanel/HandleContent.js +35 -0
- package/lib/floatingPanel/HandleContent.js.map +1 -0
- package/lib/floatingPanel/InspectorBubble.d.ts +6 -0
- package/lib/floatingPanel/InspectorBubble.d.ts.map +1 -0
- package/lib/floatingPanel/InspectorBubble.js +91 -0
- package/lib/floatingPanel/InspectorBubble.js.map +1 -0
- package/lib/floatingPanel/PanelBody.d.ts +8 -0
- package/lib/floatingPanel/PanelBody.d.ts.map +1 -0
- package/lib/floatingPanel/PanelBody.js +72 -0
- package/lib/floatingPanel/PanelBody.js.map +1 -0
- package/lib/floatingPanel/PanelFooter.d.ts +9 -0
- package/lib/floatingPanel/PanelFooter.d.ts.map +1 -0
- package/lib/floatingPanel/PanelFooter.js +21 -0
- package/lib/floatingPanel/PanelFooter.js.map +1 -0
- package/lib/floatingPanel/PanelHeader.d.ts +13 -0
- package/lib/floatingPanel/PanelHeader.d.ts.map +1 -0
- package/lib/floatingPanel/PanelHeader.js +56 -0
- package/lib/floatingPanel/PanelHeader.js.map +1 -0
- package/lib/floatingPanel/index.d.ts +12 -0
- package/lib/floatingPanel/index.d.ts.map +1 -0
- package/lib/floatingPanel/index.js +11 -0
- package/lib/floatingPanel/index.js.map +1 -0
- package/lib/floatingPanel/panelUtils.d.ts +3 -0
- package/lib/floatingPanel/panelUtils.d.ts.map +1 -0
- package/lib/floatingPanel/panelUtils.js +12 -0
- package/lib/floatingPanel/panelUtils.js.map +1 -0
- package/lib/floatingPanel/types.d.ts +23 -0
- package/lib/floatingPanel/types.d.ts.map +1 -0
- package/lib/floatingPanel/types.js +2 -0
- package/lib/floatingPanel/types.js.map +1 -0
- package/lib/hooks/index.d.ts +8 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +8 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useDebouncedCallback.d.ts +2 -0
- package/lib/hooks/useDebouncedCallback.d.ts.map +1 -0
- package/lib/hooks/useDebouncedCallback.js +12 -0
- package/lib/hooks/useDebouncedCallback.js.map +1 -0
- package/lib/hooks/useDebouncedValue.d.ts +2 -0
- package/lib/hooks/useDebouncedValue.d.ts.map +1 -0
- package/lib/hooks/useDebouncedValue.js +10 -0
- package/lib/hooks/useDebouncedValue.js.map +1 -0
- package/lib/hooks/useFloatingPanel.d.ts +14 -0
- package/lib/hooks/useFloatingPanel.d.ts.map +1 -0
- package/lib/hooks/useFloatingPanel.js +132 -0
- package/lib/hooks/useFloatingPanel.js.map +1 -0
- package/lib/hooks/useLayoutSnapshot.d.ts +14 -0
- package/lib/hooks/useLayoutSnapshot.d.ts.map +1 -0
- package/lib/hooks/useLayoutSnapshot.js +39 -0
- package/lib/hooks/useLayoutSnapshot.js.map +1 -0
- package/lib/hooks/useStyleMutation.d.ts +14 -0
- package/lib/hooks/useStyleMutation.d.ts.map +1 -0
- package/lib/hooks/useStyleMutation.js +22 -0
- package/lib/hooks/useStyleMutation.js.map +1 -0
- package/lib/hooks/useStyleOverrides.d.ts +24 -0
- package/lib/hooks/useStyleOverrides.d.ts.map +1 -0
- package/lib/hooks/useStyleOverrides.js +165 -0
- package/lib/hooks/useStyleOverrides.js.map +1 -0
- package/lib/hooks/useTapToSelect.d.ts +20 -0
- package/lib/hooks/useTapToSelect.d.ts.map +1 -0
- package/lib/hooks/useTapToSelect.js +58 -0
- package/lib/hooks/useTapToSelect.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/clamp.d.ts +2 -0
- package/lib/utils/clamp.d.ts.map +1 -0
- package/lib/utils/clamp.js +2 -0
- package/lib/utils/clamp.js.map +1 -0
- package/lib/utils/flattenStyles.d.ts +6 -0
- package/lib/utils/flattenStyles.d.ts.map +1 -0
- package/lib/utils/flattenStyles.js +11 -0
- package/lib/utils/flattenStyles.js.map +1 -0
- package/lib/utils/hitTest.d.ts +7 -0
- package/lib/utils/hitTest.d.ts.map +1 -0
- package/lib/utils/hitTest.js +20 -0
- package/lib/utils/hitTest.js.map +1 -0
- package/lib/utils/index.d.ts +12 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/layoutSnapshot.d.ts +7 -0
- package/lib/utils/layoutSnapshot.d.ts.map +1 -0
- package/lib/utils/layoutSnapshot.js +42 -0
- package/lib/utils/layoutSnapshot.js.map +1 -0
- package/lib/utils/sourceMapping.d.ts +26 -0
- package/lib/utils/sourceMapping.d.ts.map +1 -0
- package/lib/utils/sourceMapping.js +53 -0
- package/lib/utils/sourceMapping.js.map +1 -0
- package/lib/utils/styleFormatting.d.ts +5 -0
- package/lib/utils/styleFormatting.d.ts.map +1 -0
- package/lib/utils/styleFormatting.js +38 -0
- package/lib/utils/styleFormatting.js.map +1 -0
- package/lib/utils/styleInputParsing.d.ts +5 -0
- package/lib/utils/styleInputParsing.d.ts.map +1 -0
- package/lib/utils/styleInputParsing.js +33 -0
- package/lib/utils/styleInputParsing.js.map +1 -0
- package/lib/utils/yogaLayout.d.ts +33 -0
- package/lib/utils/yogaLayout.d.ts.map +1 -0
- package/lib/utils/yogaLayout.js +33 -0
- package/lib/utils/yogaLayout.js.map +1 -0
- package/package.json +74 -0
- package/src/ElementCycler.tsx +64 -0
- package/src/ElementHighlighter.tsx +122 -0
- package/src/ElementInspector.tsx +119 -0
- package/src/components/Checkbox.tsx +41 -0
- package/src/components/index.ts +1 -0
- package/src/constants/colors.ts +18 -0
- package/src/constants/index.ts +9 -0
- package/src/constants/ui.ts +51 -0
- package/src/fiber/FiberAdapter.ts +153 -0
- package/src/fiber/detectVersion.ts +19 -0
- package/src/fiber/index.ts +4 -0
- package/src/fiber/types.ts +36 -0
- package/src/floatingPanel/AddPropertyRow.tsx +102 -0
- package/src/floatingPanel/CloseButton.tsx +34 -0
- package/src/floatingPanel/EditableValue.tsx +109 -0
- package/src/floatingPanel/FloatingPanel.tsx +114 -0
- package/src/floatingPanel/HandleContent.tsx +45 -0
- package/src/floatingPanel/InspectorBubble.tsx +121 -0
- package/src/floatingPanel/PanelBody.tsx +162 -0
- package/src/floatingPanel/PanelFooter.tsx +36 -0
- package/src/floatingPanel/PanelHeader.tsx +111 -0
- package/src/floatingPanel/index.ts +11 -0
- package/src/floatingPanel/panelUtils.ts +13 -0
- package/src/floatingPanel/types.ts +26 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useDebouncedCallback.ts +18 -0
- package/src/hooks/useDebouncedValue.ts +12 -0
- package/src/hooks/useFloatingPanel.ts +191 -0
- package/src/hooks/useLayoutSnapshot.ts +42 -0
- package/src/hooks/useStyleMutation.ts +31 -0
- package/src/hooks/useStyleOverrides.ts +176 -0
- package/src/hooks/useTapToSelect.ts +76 -0
- package/src/index.ts +2 -0
- package/src/utils/clamp.ts +2 -0
- package/src/utils/flattenStyles.ts +12 -0
- package/src/utils/hitTest.ts +29 -0
- package/src/utils/index.ts +11 -0
- package/src/utils/layoutSnapshot.ts +48 -0
- package/src/utils/sourceMapping.ts +67 -0
- package/src/utils/styleFormatting.ts +34 -0
- package/src/utils/styleInputParsing.ts +33 -0
- package/src/utils/yogaLayout.ts +49 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FiberAdapter, type FiberNode, type MeasuredElement } from '../fiber';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a layout snapshot: walk the fiber tree, measure every host fiber,
|
|
5
|
+
* return a flat array sorted by zIndex (desc) → depth (desc).
|
|
6
|
+
*/
|
|
7
|
+
export const buildLayoutSnapshot = async (root: FiberNode): Promise<MeasuredElement[]> => {
|
|
8
|
+
const hostFibers = FiberAdapter.walkHostFibers(root);
|
|
9
|
+
const elements: MeasuredElement[] = [];
|
|
10
|
+
|
|
11
|
+
// Measure all host fibers in parallel
|
|
12
|
+
const measurements = await Promise.allSettled(
|
|
13
|
+
hostFibers.map(async ({ fiber, depth }) => {
|
|
14
|
+
const rect = await FiberAdapter.measure(fiber);
|
|
15
|
+
const style = FiberAdapter.getStyle(fiber);
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
fiber,
|
|
19
|
+
x: rect.x,
|
|
20
|
+
y: rect.y,
|
|
21
|
+
width: rect.width,
|
|
22
|
+
height: rect.height,
|
|
23
|
+
depth,
|
|
24
|
+
zIndex: typeof style?.zIndex === 'number' ? style.zIndex : 0,
|
|
25
|
+
componentName: FiberAdapter.getComponentName(fiber),
|
|
26
|
+
} satisfies MeasuredElement;
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
for (const result of measurements) {
|
|
31
|
+
if (result.status === 'fulfilled') {
|
|
32
|
+
const element = result.value;
|
|
33
|
+
// Skip zero-size elements — invisible and untappable
|
|
34
|
+
if (element.width > 0 && element.height > 0) {
|
|
35
|
+
elements.push(element);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Skip fibers that fail to measure (unmounted, off-screen, etc.)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Sort: zIndex descending, then depth descending
|
|
42
|
+
elements.sort((a, b) => {
|
|
43
|
+
if (a.zIndex !== b.zIndex) return b.zIndex - a.zIndex;
|
|
44
|
+
return b.depth - a.depth;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return elements;
|
|
48
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FiberNode } from '../fiber';
|
|
2
|
+
|
|
3
|
+
export interface SourceLocation {
|
|
4
|
+
fileName: string;
|
|
5
|
+
lineNumber: number;
|
|
6
|
+
columnNumber?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extract the source file location from a fiber node.
|
|
11
|
+
* Host components (RCTView, RCTText, etc.) don't have _debugSource,
|
|
12
|
+
* so we check _debugOwner (the component that rendered this element)
|
|
13
|
+
* and walk up the fiber tree as a fallback.
|
|
14
|
+
*/
|
|
15
|
+
export const getSourceLocation = (fiber: FiberNode): SourceLocation | null => {
|
|
16
|
+
// Check the fiber itself first
|
|
17
|
+
if (fiber._debugSource) return fiber._debugSource;
|
|
18
|
+
|
|
19
|
+
// Check _debugOwner — points to the component that created this JSX
|
|
20
|
+
if (fiber._debugOwner?._debugSource) return fiber._debugOwner._debugSource;
|
|
21
|
+
|
|
22
|
+
// Walk up the return (parent) chain
|
|
23
|
+
let current: FiberNode | null = fiber.return;
|
|
24
|
+
while (current) {
|
|
25
|
+
if (current._debugSource) return current._debugSource;
|
|
26
|
+
current = current.return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Format a source location for display.
|
|
34
|
+
* Strips the project root for readability.
|
|
35
|
+
* Adds extension to the file name and line number, e.g. "MyComponent.js:42"
|
|
36
|
+
*/
|
|
37
|
+
export const formatSourceLocation = (source: SourceLocation): string => {
|
|
38
|
+
const lastSlash = source.fileName.lastIndexOf('/');
|
|
39
|
+
const fileName = lastSlash === -1 ? source.fileName : source.fileName.substring(lastSlash + 1);
|
|
40
|
+
return `${fileName}:${source.lineNumber}`;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the name of the nearest user component that owns this fiber.
|
|
45
|
+
* React 19 dropped _debugSource, so we use _debugOwner to find the
|
|
46
|
+
* parent component name as a fallback.
|
|
47
|
+
*/
|
|
48
|
+
export const getOwnerName = (fiber: FiberNode): string | null => {
|
|
49
|
+
type OwnerInfo = {
|
|
50
|
+
type: string | (((...args: never[]) => unknown) & { displayName?: string; name?: string });
|
|
51
|
+
_debugOwner?: OwnerInfo;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
let owner = fiber._debugOwner as OwnerInfo | undefined;
|
|
55
|
+
while (owner) {
|
|
56
|
+
const ownerType = owner.type;
|
|
57
|
+
if (typeof ownerType === 'function') {
|
|
58
|
+
const name = ownerType.displayName ?? ownerType.name;
|
|
59
|
+
// Skip generic RN host wrappers
|
|
60
|
+
if (name && name !== 'View' && name !== 'Text' && name !== 'ScrollView') {
|
|
61
|
+
return `in ${name}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
owner = owner._debugOwner;
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Complete set of React Native style properties typed as ColorValue */
|
|
2
|
+
const COLOR_PROPS = new Set([
|
|
3
|
+
'color',
|
|
4
|
+
'backgroundColor',
|
|
5
|
+
'borderColor',
|
|
6
|
+
'borderTopColor',
|
|
7
|
+
'borderRightColor',
|
|
8
|
+
'borderBottomColor',
|
|
9
|
+
'borderLeftColor',
|
|
10
|
+
'borderStartColor',
|
|
11
|
+
'borderEndColor',
|
|
12
|
+
'borderBlockColor',
|
|
13
|
+
'borderBlockStartColor',
|
|
14
|
+
'borderBlockEndColor',
|
|
15
|
+
'outlineColor',
|
|
16
|
+
'shadowColor',
|
|
17
|
+
'textDecorationColor',
|
|
18
|
+
'textShadowColor',
|
|
19
|
+
'tintColor',
|
|
20
|
+
'overlayColor',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
/** Returns true if the style property name holds a color value */
|
|
24
|
+
export const isColorProp = (propertyName: string): boolean => COLOR_PROPS.has(propertyName);
|
|
25
|
+
|
|
26
|
+
/** Format a style value for display in the inspector panel */
|
|
27
|
+
export const formatValue = (value: unknown): string => {
|
|
28
|
+
if (value === undefined) return 'undefined';
|
|
29
|
+
if (value === null) return 'null';
|
|
30
|
+
if (typeof value === 'number') return String(value);
|
|
31
|
+
if (typeof value === 'string') return `"${value}"`;
|
|
32
|
+
if (typeof value === 'boolean') return String(value);
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Parses user input back to the appropriate type. */
|
|
2
|
+
export const parseInput = (text: string, originalValue: unknown): unknown => {
|
|
3
|
+
const trimmed = text.trim();
|
|
4
|
+
if (trimmed === '') return originalValue;
|
|
5
|
+
|
|
6
|
+
// Strip surrounding quotes if the user typed them
|
|
7
|
+
if (
|
|
8
|
+
(trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
9
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'"))
|
|
10
|
+
) {
|
|
11
|
+
return trimmed.slice(1, -1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Only coerce to number when the original was numeric
|
|
15
|
+
if (typeof originalValue === 'number') {
|
|
16
|
+
const asNumber = Number(trimmed);
|
|
17
|
+
if (!Number.isNaN(asNumber)) return asNumber;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Boolean
|
|
21
|
+
if (trimmed === 'true') return true;
|
|
22
|
+
if (trimmed === 'false') return false;
|
|
23
|
+
|
|
24
|
+
// Everything else is a string (e.g. color names, hex codes)
|
|
25
|
+
return trimmed;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Raw value → editable string (no quotes around strings). */
|
|
29
|
+
export const toEditableString = (value: unknown): string => {
|
|
30
|
+
if (value === undefined) return '';
|
|
31
|
+
if (value === null) return '';
|
|
32
|
+
return String(value);
|
|
33
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { StyleObject } from './flattenStyles';
|
|
2
|
+
|
|
3
|
+
export interface BoxModel {
|
|
4
|
+
margin: { top: number; right: number; bottom: number; left: number };
|
|
5
|
+
border: { top: number; right: number; bottom: number; left: number };
|
|
6
|
+
padding: { top: number; right: number; bottom: number; left: number };
|
|
7
|
+
content: { width: number; height: number };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Extract box model values from a flattened style object.
|
|
12
|
+
*/
|
|
13
|
+
export const extractBoxModel = (
|
|
14
|
+
style: StyleObject | null,
|
|
15
|
+
measured: { width: number; height: number },
|
|
16
|
+
): BoxModel => {
|
|
17
|
+
const num = (key: string): number | undefined => {
|
|
18
|
+
const val = style?.[key];
|
|
19
|
+
return typeof val === 'number' ? val : undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const margin = {
|
|
23
|
+
top: num('marginTop') ?? num('marginVertical') ?? num('margin') ?? 0,
|
|
24
|
+
right: num('marginRight') ?? num('marginHorizontal') ?? num('margin') ?? 0,
|
|
25
|
+
bottom: num('marginBottom') ?? num('marginVertical') ?? num('margin') ?? 0,
|
|
26
|
+
left: num('marginLeft') ?? num('marginHorizontal') ?? num('margin') ?? 0,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const border = {
|
|
30
|
+
top: num('borderTopWidth') ?? num('borderWidth') ?? 0,
|
|
31
|
+
right: num('borderRightWidth') ?? num('borderWidth') ?? 0,
|
|
32
|
+
bottom: num('borderBottomWidth') ?? num('borderWidth') ?? 0,
|
|
33
|
+
left: num('borderLeftWidth') ?? num('borderWidth') ?? 0,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const padding = {
|
|
37
|
+
top: num('paddingTop') ?? num('paddingVertical') ?? num('padding') ?? 0,
|
|
38
|
+
right: num('paddingRight') ?? num('paddingHorizontal') ?? num('padding') ?? 0,
|
|
39
|
+
bottom: num('paddingBottom') ?? num('paddingVertical') ?? num('padding') ?? 0,
|
|
40
|
+
left: num('paddingLeft') ?? num('paddingHorizontal') ?? num('padding') ?? 0,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const content = {
|
|
44
|
+
width: measured.width - padding.left - padding.right - border.left - border.right,
|
|
45
|
+
height: measured.height - padding.top - padding.bottom - border.top - border.bottom,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return { margin, border, padding, content };
|
|
49
|
+
};
|