@storybook/react-native-theming 10.0.0 → 10.0.1
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/index.d.ts +5 -119
- package/dist/index.js +408 -17
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,125 +1,9 @@
|
|
|
1
1
|
import * as RN from 'react-native';
|
|
2
2
|
import { TextStyle, ImageSourcePropType, ImageProps } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { Theme } from './theming.js';
|
|
4
|
+
export { ThemeProvider, useTheme, withTheme } from './theming.js';
|
|
4
5
|
import { ReactElement } from 'react';
|
|
5
6
|
|
|
6
|
-
type IsPreReact19 = 2 extends Parameters<React.FunctionComponent<any>>['length']
|
|
7
|
-
? true
|
|
8
|
-
: false
|
|
9
|
-
|
|
10
|
-
// unpack all here to avoid infinite self-referencing when defining our own JSX namespace for the pre-React 19 case
|
|
11
|
-
type ReactJSXElement = true extends IsPreReact19
|
|
12
|
-
? /** @ts-ignore */
|
|
13
|
-
JSX.Element
|
|
14
|
-
: /** @ts-ignore */
|
|
15
|
-
React.JSX.Element
|
|
16
|
-
type ReactJSXElementClass = true extends IsPreReact19
|
|
17
|
-
? /** @ts-ignore */
|
|
18
|
-
JSX.ElementClass
|
|
19
|
-
: /** @ts-ignore */
|
|
20
|
-
React.JSX.ElementClass
|
|
21
|
-
type ReactJSXElementAttributesProperty = true extends IsPreReact19
|
|
22
|
-
? /** @ts-ignore */
|
|
23
|
-
JSX.ElementAttributesProperty
|
|
24
|
-
: /** @ts-ignore */
|
|
25
|
-
React.JSX.ElementAttributesProperty
|
|
26
|
-
type ReactJSXElementChildrenAttribute = true extends IsPreReact19
|
|
27
|
-
? /** @ts-ignore */
|
|
28
|
-
JSX.ElementChildrenAttribute
|
|
29
|
-
: /** @ts-ignore */
|
|
30
|
-
React.JSX.ElementChildrenAttribute
|
|
31
|
-
type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19
|
|
32
|
-
? /** @ts-ignore */
|
|
33
|
-
JSX.LibraryManagedAttributes<C, P>
|
|
34
|
-
: /** @ts-ignore */
|
|
35
|
-
React.JSX.LibraryManagedAttributes<C, P>
|
|
36
|
-
type ReactJSXIntrinsicAttributes = true extends IsPreReact19
|
|
37
|
-
? /** @ts-ignore */
|
|
38
|
-
JSX.IntrinsicAttributes
|
|
39
|
-
: /** @ts-ignore */
|
|
40
|
-
React.JSX.IntrinsicAttributes
|
|
41
|
-
type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19
|
|
42
|
-
? /** @ts-ignore */
|
|
43
|
-
JSX.IntrinsicClassAttributes<T>
|
|
44
|
-
: /** @ts-ignore */
|
|
45
|
-
React.JSX.IntrinsicClassAttributes<T>
|
|
46
|
-
type ReactJSXIntrinsicElements = true extends IsPreReact19
|
|
47
|
-
? /** @ts-ignore */
|
|
48
|
-
JSX.IntrinsicElements
|
|
49
|
-
: /** @ts-ignore */
|
|
50
|
-
React.JSX.IntrinsicElements
|
|
51
|
-
|
|
52
|
-
type ReactJSXElementType = true extends IsPreReact19
|
|
53
|
-
? // based on the code from @types/react@18.2.8
|
|
54
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13
|
|
55
|
-
string | React.JSXElementConstructor<any>
|
|
56
|
-
: /** @ts-ignore */
|
|
57
|
-
React.JSX.ElementType
|
|
58
|
-
|
|
59
|
-
declare namespace ReactJSX {
|
|
60
|
-
type ElementType = ReactJSXElementType
|
|
61
|
-
interface Element extends ReactJSXElement {}
|
|
62
|
-
interface ElementClass extends ReactJSXElementClass {}
|
|
63
|
-
interface ElementAttributesProperty
|
|
64
|
-
extends ReactJSXElementAttributesProperty {}
|
|
65
|
-
interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {}
|
|
66
|
-
|
|
67
|
-
type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>
|
|
68
|
-
|
|
69
|
-
interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {}
|
|
70
|
-
interface IntrinsicClassAttributes<T>
|
|
71
|
-
extends ReactJSXIntrinsicClassAttributes<T> {}
|
|
72
|
-
|
|
73
|
-
type IntrinsicElements = ReactJSXIntrinsicElements
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @desc Utility type for getting props type of React component.
|
|
78
|
-
* It takes `defaultProps` into an account - making props with defaults optional.
|
|
79
|
-
*/
|
|
80
|
-
type PropsOf<
|
|
81
|
-
C extends keyof ReactJSX.IntrinsicElements | React.JSXElementConstructor<any>
|
|
82
|
-
> = ReactJSX.LibraryManagedAttributes<C, React.ComponentProps<C>>
|
|
83
|
-
|
|
84
|
-
// We need to use this version of Omit as it's distributive (Will preserve unions)
|
|
85
|
-
type DistributiveOmit<T, U> = T extends any
|
|
86
|
-
? Pick<T, Exclude<keyof T, U>>
|
|
87
|
-
: never
|
|
88
|
-
|
|
89
|
-
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
|
90
|
-
// TypeScript Version: 3.1
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
interface ThemeProviderProps {
|
|
95
|
-
theme: Partial<Theme> | ((outerTheme: Theme) => Theme)
|
|
96
|
-
children: React$1.ReactNode
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
declare function useTheme(): Theme
|
|
100
|
-
|
|
101
|
-
interface ThemeProvider {
|
|
102
|
-
(props: ThemeProviderProps): React$1.ReactElement
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
declare const ThemeProvider: ThemeProvider
|
|
106
|
-
|
|
107
|
-
type withTheme = <
|
|
108
|
-
C extends React$1.ComponentType<React$1.ComponentProps<C>>
|
|
109
|
-
>(
|
|
110
|
-
component: C
|
|
111
|
-
) => React$1.FC<DistributiveOmit<PropsOf<C>, 'theme'> & { theme?: Theme }>
|
|
112
|
-
|
|
113
|
-
declare const withTheme: withTheme
|
|
114
|
-
|
|
115
|
-
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
|
|
116
|
-
// TypeScript Version: 3.4
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// tslint:disable-next-line: no-empty-interface
|
|
121
|
-
export interface Theme extends StorybookTheme {}
|
|
122
|
-
|
|
123
7
|
// Definitions by: Pat Sissons <https://github.com/patsissons>
|
|
124
8
|
// TypeScript Version: 3.4
|
|
125
9
|
|
|
@@ -495,4 +379,6 @@ type StorybookTheme = StorybookThemeWeb;
|
|
|
495
379
|
declare const theme: StorybookThemeWeb;
|
|
496
380
|
declare const darkTheme: StorybookThemeWeb;
|
|
497
381
|
|
|
498
|
-
export { type StorybookTheme, type StyledComponent,
|
|
382
|
+
export { type StorybookTheme, type StyledComponent, darkTheme, styled, theme };
|
|
383
|
+
|
|
384
|
+
export interface Theme extends StorybookTheme {}
|
package/dist/index.js
CHANGED
|
@@ -1808,7 +1808,7 @@ var import_react_native = require("react-native");
|
|
|
1808
1808
|
var import_css_to_react_native = __toESM(require_css_to_react_native());
|
|
1809
1809
|
var React4 = __toESM(require("react"));
|
|
1810
1810
|
|
|
1811
|
-
// ../../node_modules/@emotion/react/dist/emotion-element-
|
|
1811
|
+
// ../../node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
1812
1812
|
var React2 = __toESM(require("react"));
|
|
1813
1813
|
var import_react = require("react");
|
|
1814
1814
|
|
|
@@ -2350,7 +2350,8 @@ var compat = function compat2(element) {
|
|
|
2350
2350
|
element.length < 1) {
|
|
2351
2351
|
return;
|
|
2352
2352
|
}
|
|
2353
|
-
var value = element.value
|
|
2353
|
+
var value = element.value;
|
|
2354
|
+
var parent = element.parent;
|
|
2354
2355
|
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
2355
2356
|
while (parent.type !== "rule") {
|
|
2356
2357
|
parent = parent.parent;
|
|
@@ -2563,10 +2564,7 @@ var prefixer = function prefixer2(element, index2, children, callback) {
|
|
|
2563
2564
|
};
|
|
2564
2565
|
var getServerStylisCache = isBrowser ? void 0 : weakMemoize(function() {
|
|
2565
2566
|
return memoize(function() {
|
|
2566
|
-
|
|
2567
|
-
return function(name) {
|
|
2568
|
-
return cache[name];
|
|
2569
|
-
};
|
|
2567
|
+
return {};
|
|
2570
2568
|
});
|
|
2571
2569
|
});
|
|
2572
2570
|
var defaultStylisPlugins = [prefixer];
|
|
@@ -2604,7 +2602,7 @@ var createCache = function createCache2(options) {
|
|
|
2604
2602
|
}
|
|
2605
2603
|
var _insert;
|
|
2606
2604
|
var omnipresentPlugins = [compat, removeLabel];
|
|
2607
|
-
if (
|
|
2605
|
+
if (!getServerStylisCache) {
|
|
2608
2606
|
var currentSheet;
|
|
2609
2607
|
var finalizingPlugins = [stringify, rulesheet(function(rule) {
|
|
2610
2608
|
currentSheet.insert(rule);
|
|
@@ -2687,11 +2685,323 @@ var hoistNonReactStatics = function(targetComponent, sourceComponent) {
|
|
|
2687
2685
|
return (0, import_hoist_non_react_statics.default)(targetComponent, sourceComponent);
|
|
2688
2686
|
};
|
|
2689
2687
|
|
|
2688
|
+
// ../../node_modules/@emotion/utils/dist/emotion-utils.esm.js
|
|
2689
|
+
var isBrowser2 = typeof document !== "undefined";
|
|
2690
|
+
function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
2691
|
+
var rawClassName = "";
|
|
2692
|
+
classNames.split(" ").forEach(function(className) {
|
|
2693
|
+
if (registered[className] !== void 0) {
|
|
2694
|
+
registeredStyles.push(registered[className] + ";");
|
|
2695
|
+
} else if (className) {
|
|
2696
|
+
rawClassName += className + " ";
|
|
2697
|
+
}
|
|
2698
|
+
});
|
|
2699
|
+
return rawClassName;
|
|
2700
|
+
}
|
|
2701
|
+
var registerStyles = function registerStyles2(cache, serialized, isStringTag) {
|
|
2702
|
+
var className = cache.key + "-" + serialized.name;
|
|
2703
|
+
if (
|
|
2704
|
+
// we only need to add the styles to the registered cache if the
|
|
2705
|
+
// class name could be used further down
|
|
2706
|
+
// the tree but if it's a string tag, we know it won't
|
|
2707
|
+
// so we don't have to add it to registered cache.
|
|
2708
|
+
// this improves memory usage since we can avoid storing the whole style string
|
|
2709
|
+
(isStringTag === false || // we need to always store it if we're in compat mode and
|
|
2710
|
+
// in node since emotion-server relies on whether a style is in
|
|
2711
|
+
// the registered cache to know whether a style is global or not
|
|
2712
|
+
// also, note that this check will be dead code eliminated in the browser
|
|
2713
|
+
isBrowser2 === false && cache.compat !== void 0) && cache.registered[className] === void 0
|
|
2714
|
+
) {
|
|
2715
|
+
cache.registered[className] = serialized.styles;
|
|
2716
|
+
}
|
|
2717
|
+
};
|
|
2718
|
+
var insertStyles = function insertStyles2(cache, serialized, isStringTag) {
|
|
2719
|
+
registerStyles(cache, serialized, isStringTag);
|
|
2720
|
+
var className = cache.key + "-" + serialized.name;
|
|
2721
|
+
if (cache.inserted[serialized.name] === void 0) {
|
|
2722
|
+
var stylesForSSR = "";
|
|
2723
|
+
var current = serialized;
|
|
2724
|
+
do {
|
|
2725
|
+
var maybeStyles = cache.insert(serialized === current ? "." + className : "", current, cache.sheet, true);
|
|
2726
|
+
if (!isBrowser2 && maybeStyles !== void 0) {
|
|
2727
|
+
stylesForSSR += maybeStyles;
|
|
2728
|
+
}
|
|
2729
|
+
current = current.next;
|
|
2730
|
+
} while (current !== void 0);
|
|
2731
|
+
if (!isBrowser2 && stylesForSSR.length !== 0) {
|
|
2732
|
+
return stylesForSSR;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
// ../../node_modules/@emotion/hash/dist/emotion-hash.esm.js
|
|
2738
|
+
function murmur2(str) {
|
|
2739
|
+
var h = 0;
|
|
2740
|
+
var k, i = 0, len = str.length;
|
|
2741
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
2742
|
+
k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
|
|
2743
|
+
k = /* Math.imul(k, m): */
|
|
2744
|
+
(k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16);
|
|
2745
|
+
k ^= /* k >>> r: */
|
|
2746
|
+
k >>> 24;
|
|
2747
|
+
h = /* Math.imul(k, m): */
|
|
2748
|
+
(k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
|
|
2749
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
2750
|
+
}
|
|
2751
|
+
switch (len) {
|
|
2752
|
+
case 3:
|
|
2753
|
+
h ^= (str.charCodeAt(i + 2) & 255) << 16;
|
|
2754
|
+
case 2:
|
|
2755
|
+
h ^= (str.charCodeAt(i + 1) & 255) << 8;
|
|
2756
|
+
case 1:
|
|
2757
|
+
h ^= str.charCodeAt(i) & 255;
|
|
2758
|
+
h = /* Math.imul(h, m): */
|
|
2759
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
2760
|
+
}
|
|
2761
|
+
h ^= h >>> 13;
|
|
2762
|
+
h = /* Math.imul(h, m): */
|
|
2763
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
2764
|
+
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
// ../../node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
|
|
2768
|
+
var unitlessKeys = {
|
|
2769
|
+
animationIterationCount: 1,
|
|
2770
|
+
aspectRatio: 1,
|
|
2771
|
+
borderImageOutset: 1,
|
|
2772
|
+
borderImageSlice: 1,
|
|
2773
|
+
borderImageWidth: 1,
|
|
2774
|
+
boxFlex: 1,
|
|
2775
|
+
boxFlexGroup: 1,
|
|
2776
|
+
boxOrdinalGroup: 1,
|
|
2777
|
+
columnCount: 1,
|
|
2778
|
+
columns: 1,
|
|
2779
|
+
flex: 1,
|
|
2780
|
+
flexGrow: 1,
|
|
2781
|
+
flexPositive: 1,
|
|
2782
|
+
flexShrink: 1,
|
|
2783
|
+
flexNegative: 1,
|
|
2784
|
+
flexOrder: 1,
|
|
2785
|
+
gridRow: 1,
|
|
2786
|
+
gridRowEnd: 1,
|
|
2787
|
+
gridRowSpan: 1,
|
|
2788
|
+
gridRowStart: 1,
|
|
2789
|
+
gridColumn: 1,
|
|
2790
|
+
gridColumnEnd: 1,
|
|
2791
|
+
gridColumnSpan: 1,
|
|
2792
|
+
gridColumnStart: 1,
|
|
2793
|
+
msGridRow: 1,
|
|
2794
|
+
msGridRowSpan: 1,
|
|
2795
|
+
msGridColumn: 1,
|
|
2796
|
+
msGridColumnSpan: 1,
|
|
2797
|
+
fontWeight: 1,
|
|
2798
|
+
lineHeight: 1,
|
|
2799
|
+
opacity: 1,
|
|
2800
|
+
order: 1,
|
|
2801
|
+
orphans: 1,
|
|
2802
|
+
scale: 1,
|
|
2803
|
+
tabSize: 1,
|
|
2804
|
+
widows: 1,
|
|
2805
|
+
zIndex: 1,
|
|
2806
|
+
zoom: 1,
|
|
2807
|
+
WebkitLineClamp: 1,
|
|
2808
|
+
// SVG-related properties
|
|
2809
|
+
fillOpacity: 1,
|
|
2810
|
+
floodOpacity: 1,
|
|
2811
|
+
stopOpacity: 1,
|
|
2812
|
+
strokeDasharray: 1,
|
|
2813
|
+
strokeDashoffset: 1,
|
|
2814
|
+
strokeMiterlimit: 1,
|
|
2815
|
+
strokeOpacity: 1,
|
|
2816
|
+
strokeWidth: 1
|
|
2817
|
+
};
|
|
2818
|
+
|
|
2819
|
+
// ../../node_modules/@emotion/serialize/dist/emotion-serialize.esm.js
|
|
2820
|
+
var isDevelopment2 = false;
|
|
2821
|
+
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
2822
|
+
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
2823
|
+
var isCustomProperty = function isCustomProperty2(property) {
|
|
2824
|
+
return property.charCodeAt(1) === 45;
|
|
2825
|
+
};
|
|
2826
|
+
var isProcessableValue = function isProcessableValue2(value) {
|
|
2827
|
+
return value != null && typeof value !== "boolean";
|
|
2828
|
+
};
|
|
2829
|
+
var processStyleName = /* @__PURE__ */ memoize(function(styleName) {
|
|
2830
|
+
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
|
|
2831
|
+
});
|
|
2832
|
+
var processStyleValue = function processStyleValue2(key, value) {
|
|
2833
|
+
switch (key) {
|
|
2834
|
+
case "animation":
|
|
2835
|
+
case "animationName": {
|
|
2836
|
+
if (typeof value === "string") {
|
|
2837
|
+
return value.replace(animationRegex, function(match2, p1, p2) {
|
|
2838
|
+
cursor = {
|
|
2839
|
+
name: p1,
|
|
2840
|
+
styles: p2,
|
|
2841
|
+
next: cursor
|
|
2842
|
+
};
|
|
2843
|
+
return p1;
|
|
2844
|
+
});
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) {
|
|
2849
|
+
return value + "px";
|
|
2850
|
+
}
|
|
2851
|
+
return value;
|
|
2852
|
+
};
|
|
2853
|
+
var noComponentSelectorMessage = "Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";
|
|
2854
|
+
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
2855
|
+
if (interpolation == null) {
|
|
2856
|
+
return "";
|
|
2857
|
+
}
|
|
2858
|
+
var componentSelector = interpolation;
|
|
2859
|
+
if (componentSelector.__emotion_styles !== void 0) {
|
|
2860
|
+
return componentSelector;
|
|
2861
|
+
}
|
|
2862
|
+
switch (typeof interpolation) {
|
|
2863
|
+
case "boolean": {
|
|
2864
|
+
return "";
|
|
2865
|
+
}
|
|
2866
|
+
case "object": {
|
|
2867
|
+
var keyframes = interpolation;
|
|
2868
|
+
if (keyframes.anim === 1) {
|
|
2869
|
+
cursor = {
|
|
2870
|
+
name: keyframes.name,
|
|
2871
|
+
styles: keyframes.styles,
|
|
2872
|
+
next: cursor
|
|
2873
|
+
};
|
|
2874
|
+
return keyframes.name;
|
|
2875
|
+
}
|
|
2876
|
+
var serializedStyles = interpolation;
|
|
2877
|
+
if (serializedStyles.styles !== void 0) {
|
|
2878
|
+
var next2 = serializedStyles.next;
|
|
2879
|
+
if (next2 !== void 0) {
|
|
2880
|
+
while (next2 !== void 0) {
|
|
2881
|
+
cursor = {
|
|
2882
|
+
name: next2.name,
|
|
2883
|
+
styles: next2.styles,
|
|
2884
|
+
next: cursor
|
|
2885
|
+
};
|
|
2886
|
+
next2 = next2.next;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
var styles2 = serializedStyles.styles + ";";
|
|
2890
|
+
return styles2;
|
|
2891
|
+
}
|
|
2892
|
+
return createStringFromObject(mergedProps, registered, interpolation);
|
|
2893
|
+
}
|
|
2894
|
+
case "function": {
|
|
2895
|
+
if (mergedProps !== void 0) {
|
|
2896
|
+
var previousCursor = cursor;
|
|
2897
|
+
var result = interpolation(mergedProps);
|
|
2898
|
+
cursor = previousCursor;
|
|
2899
|
+
return handleInterpolation(mergedProps, registered, result);
|
|
2900
|
+
}
|
|
2901
|
+
break;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
var asString = interpolation;
|
|
2905
|
+
if (registered == null) {
|
|
2906
|
+
return asString;
|
|
2907
|
+
}
|
|
2908
|
+
var cached = registered[asString];
|
|
2909
|
+
return cached !== void 0 ? cached : asString;
|
|
2910
|
+
}
|
|
2911
|
+
function createStringFromObject(mergedProps, registered, obj) {
|
|
2912
|
+
var string = "";
|
|
2913
|
+
if (Array.isArray(obj)) {
|
|
2914
|
+
for (var i = 0; i < obj.length; i++) {
|
|
2915
|
+
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
2916
|
+
}
|
|
2917
|
+
} else {
|
|
2918
|
+
for (var key in obj) {
|
|
2919
|
+
var value = obj[key];
|
|
2920
|
+
if (typeof value !== "object") {
|
|
2921
|
+
var asString = value;
|
|
2922
|
+
if (registered != null && registered[asString] !== void 0) {
|
|
2923
|
+
string += key + "{" + registered[asString] + "}";
|
|
2924
|
+
} else if (isProcessableValue(asString)) {
|
|
2925
|
+
string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
|
|
2926
|
+
}
|
|
2927
|
+
} else {
|
|
2928
|
+
if (key === "NO_COMPONENT_SELECTOR" && isDevelopment2) {
|
|
2929
|
+
throw new Error(noComponentSelectorMessage);
|
|
2930
|
+
}
|
|
2931
|
+
if (Array.isArray(value) && typeof value[0] === "string" && (registered == null || registered[value[0]] === void 0)) {
|
|
2932
|
+
for (var _i = 0; _i < value.length; _i++) {
|
|
2933
|
+
if (isProcessableValue(value[_i])) {
|
|
2934
|
+
string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
} else {
|
|
2938
|
+
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
2939
|
+
switch (key) {
|
|
2940
|
+
case "animation":
|
|
2941
|
+
case "animationName": {
|
|
2942
|
+
string += processStyleName(key) + ":" + interpolated + ";";
|
|
2943
|
+
break;
|
|
2944
|
+
}
|
|
2945
|
+
default: {
|
|
2946
|
+
string += key + "{" + interpolated + "}";
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
}
|
|
2953
|
+
return string;
|
|
2954
|
+
}
|
|
2955
|
+
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
|
|
2956
|
+
var cursor;
|
|
2957
|
+
function serializeStyles(args, registered, mergedProps) {
|
|
2958
|
+
if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) {
|
|
2959
|
+
return args[0];
|
|
2960
|
+
}
|
|
2961
|
+
var stringMode = true;
|
|
2962
|
+
var styles2 = "";
|
|
2963
|
+
cursor = void 0;
|
|
2964
|
+
var strings = args[0];
|
|
2965
|
+
if (strings == null || strings.raw === void 0) {
|
|
2966
|
+
stringMode = false;
|
|
2967
|
+
styles2 += handleInterpolation(mergedProps, registered, strings);
|
|
2968
|
+
} else {
|
|
2969
|
+
var asTemplateStringsArr = strings;
|
|
2970
|
+
styles2 += asTemplateStringsArr[0];
|
|
2971
|
+
}
|
|
2972
|
+
for (var i = 1; i < args.length; i++) {
|
|
2973
|
+
styles2 += handleInterpolation(mergedProps, registered, args[i]);
|
|
2974
|
+
if (stringMode) {
|
|
2975
|
+
var templateStringsArr = strings;
|
|
2976
|
+
styles2 += templateStringsArr[i];
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
labelPattern.lastIndex = 0;
|
|
2980
|
+
var identifierName = "";
|
|
2981
|
+
var match2;
|
|
2982
|
+
while ((match2 = labelPattern.exec(styles2)) !== null) {
|
|
2983
|
+
identifierName += "-" + match2[1];
|
|
2984
|
+
}
|
|
2985
|
+
var name = murmur2(styles2) + identifierName;
|
|
2986
|
+
return {
|
|
2987
|
+
name,
|
|
2988
|
+
styles: styles2,
|
|
2989
|
+
next: cursor
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2690
2993
|
// ../../node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.esm.js
|
|
2691
2994
|
var React = __toESM(require("react"));
|
|
2995
|
+
var isBrowser3 = typeof document !== "undefined";
|
|
2996
|
+
var syncFallback = function syncFallback2(create) {
|
|
2997
|
+
return create();
|
|
2998
|
+
};
|
|
2999
|
+
var useInsertionEffect2 = React["useInsertionEffect"] ? React["useInsertionEffect"] : false;
|
|
3000
|
+
var useInsertionEffectAlwaysWithSyncFallback = !isBrowser3 ? syncFallback : useInsertionEffect2 || syncFallback;
|
|
2692
3001
|
|
|
2693
|
-
// ../../node_modules/@emotion/react/dist/emotion-element-
|
|
2694
|
-
var
|
|
3002
|
+
// ../../node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
3003
|
+
var isDevelopment3 = false;
|
|
3004
|
+
var isBrowser4 = typeof document !== "undefined";
|
|
2695
3005
|
var EmotionCacheContext = /* @__PURE__ */ React2.createContext(
|
|
2696
3006
|
// we're doing this to avoid preconstruct's dead code elimination in this one case
|
|
2697
3007
|
// because this module is primarily intended for the browser and node
|
|
@@ -2710,7 +3020,7 @@ var withEmotionCache = function withEmotionCache2(func) {
|
|
|
2710
3020
|
return func(props, cache, ref);
|
|
2711
3021
|
});
|
|
2712
3022
|
};
|
|
2713
|
-
if (!
|
|
3023
|
+
if (!isBrowser4) {
|
|
2714
3024
|
withEmotionCache = function withEmotionCache3(func) {
|
|
2715
3025
|
return function(props) {
|
|
2716
3026
|
var cache = (0, import_react.useContext)(EmotionCacheContext);
|
|
@@ -2754,23 +3064,104 @@ var ThemeProvider = function ThemeProvider2(props) {
|
|
|
2754
3064
|
};
|
|
2755
3065
|
function withTheme(Component) {
|
|
2756
3066
|
var componentName = Component.displayName || Component.name || "Component";
|
|
2757
|
-
var
|
|
3067
|
+
var WithTheme = /* @__PURE__ */ React2.forwardRef(function render(props, ref) {
|
|
2758
3068
|
var theme2 = React2.useContext(ThemeContext);
|
|
2759
3069
|
return /* @__PURE__ */ React2.createElement(Component, _extends({
|
|
2760
3070
|
theme: theme2,
|
|
2761
3071
|
ref
|
|
2762
3072
|
}, props));
|
|
2763
|
-
};
|
|
2764
|
-
var WithTheme = /* @__PURE__ */ React2.forwardRef(render);
|
|
3073
|
+
});
|
|
2765
3074
|
WithTheme.displayName = "WithTheme(" + componentName + ")";
|
|
2766
3075
|
return hoistNonReactStatics(WithTheme, Component);
|
|
2767
3076
|
}
|
|
2768
3077
|
var hasOwn = {}.hasOwnProperty;
|
|
3078
|
+
var typePropName = "__EMOTION_TYPE_PLEASE_DO_NOT_USE__";
|
|
3079
|
+
var createEmotionProps = function createEmotionProps2(type, props) {
|
|
3080
|
+
var newProps = {};
|
|
3081
|
+
for (var _key in props) {
|
|
3082
|
+
if (hasOwn.call(props, _key)) {
|
|
3083
|
+
newProps[_key] = props[_key];
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
newProps[typePropName] = type;
|
|
3087
|
+
return newProps;
|
|
3088
|
+
};
|
|
3089
|
+
var Insertion = function Insertion2(_ref) {
|
|
3090
|
+
var cache = _ref.cache, serialized = _ref.serialized, isStringTag = _ref.isStringTag;
|
|
3091
|
+
registerStyles(cache, serialized, isStringTag);
|
|
3092
|
+
var rules = useInsertionEffectAlwaysWithSyncFallback(function() {
|
|
3093
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
3094
|
+
});
|
|
3095
|
+
if (!isBrowser4 && rules !== void 0) {
|
|
3096
|
+
var _ref2;
|
|
3097
|
+
var serializedNames = serialized.name;
|
|
3098
|
+
var next2 = serialized.next;
|
|
3099
|
+
while (next2 !== void 0) {
|
|
3100
|
+
serializedNames += " " + next2.name;
|
|
3101
|
+
next2 = next2.next;
|
|
3102
|
+
}
|
|
3103
|
+
return /* @__PURE__ */ React2.createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
3104
|
+
__html: rules
|
|
3105
|
+
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
3106
|
+
}
|
|
3107
|
+
return null;
|
|
3108
|
+
};
|
|
3109
|
+
var Emotion = /* @__PURE__ */ withEmotionCache(function(props, cache, ref) {
|
|
3110
|
+
var cssProp = props.css;
|
|
3111
|
+
if (typeof cssProp === "string" && cache.registered[cssProp] !== void 0) {
|
|
3112
|
+
cssProp = cache.registered[cssProp];
|
|
3113
|
+
}
|
|
3114
|
+
var WrappedComponent = props[typePropName];
|
|
3115
|
+
var registeredStyles = [cssProp];
|
|
3116
|
+
var className = "";
|
|
3117
|
+
if (typeof props.className === "string") {
|
|
3118
|
+
className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
|
|
3119
|
+
} else if (props.className != null) {
|
|
3120
|
+
className = props.className + " ";
|
|
3121
|
+
}
|
|
3122
|
+
var serialized = serializeStyles(registeredStyles, void 0, React2.useContext(ThemeContext));
|
|
3123
|
+
className += cache.key + "-" + serialized.name;
|
|
3124
|
+
var newProps = {};
|
|
3125
|
+
for (var _key2 in props) {
|
|
3126
|
+
if (hasOwn.call(props, _key2) && _key2 !== "css" && _key2 !== typePropName && !isDevelopment3) {
|
|
3127
|
+
newProps[_key2] = props[_key2];
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
newProps.className = className;
|
|
3131
|
+
if (ref) {
|
|
3132
|
+
newProps.ref = ref;
|
|
3133
|
+
}
|
|
3134
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Insertion, {
|
|
3135
|
+
cache,
|
|
3136
|
+
serialized,
|
|
3137
|
+
isStringTag: typeof WrappedComponent === "string"
|
|
3138
|
+
}), /* @__PURE__ */ React2.createElement(WrappedComponent, newProps));
|
|
3139
|
+
});
|
|
3140
|
+
var Emotion$1 = Emotion;
|
|
2769
3141
|
|
|
2770
3142
|
// ../../node_modules/@emotion/react/dist/emotion-react.esm.js
|
|
2771
3143
|
var React3 = __toESM(require("react"));
|
|
2772
3144
|
var import_extends2 = __toESM(require_extends());
|
|
2773
3145
|
var import_hoist_non_react_statics2 = __toESM(require_hoist_non_react_statics_cjs());
|
|
3146
|
+
var jsx = function jsx2(type, props) {
|
|
3147
|
+
var args = arguments;
|
|
3148
|
+
if (props == null || !hasOwn.call(props, "css")) {
|
|
3149
|
+
return React3.createElement.apply(void 0, args);
|
|
3150
|
+
}
|
|
3151
|
+
var argsLength = args.length;
|
|
3152
|
+
var createElementArgArray = new Array(argsLength);
|
|
3153
|
+
createElementArgArray[0] = Emotion$1;
|
|
3154
|
+
createElementArgArray[1] = createEmotionProps(type, props);
|
|
3155
|
+
for (var i = 2; i < argsLength; i++) {
|
|
3156
|
+
createElementArgArray[i] = args[i];
|
|
3157
|
+
}
|
|
3158
|
+
return React3.createElement.apply(null, createElementArgArray);
|
|
3159
|
+
};
|
|
3160
|
+
(function(_jsx) {
|
|
3161
|
+
var JSX;
|
|
3162
|
+
/* @__PURE__ */ (function(_JSX) {
|
|
3163
|
+
})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));
|
|
3164
|
+
})(jsx || (jsx = {}));
|
|
2774
3165
|
|
|
2775
3166
|
// ../../node_modules/@emotion/primitives-core/dist/emotion-primitives-core.esm.js
|
|
2776
3167
|
function interleave(vals) {
|
|
@@ -2788,7 +3179,7 @@ var styles;
|
|
|
2788
3179
|
var generated = {};
|
|
2789
3180
|
var buffer = "";
|
|
2790
3181
|
var lastType;
|
|
2791
|
-
function
|
|
3182
|
+
function handleInterpolation2(interpolation, i, arr) {
|
|
2792
3183
|
var type = typeof interpolation;
|
|
2793
3184
|
if (type === "string") {
|
|
2794
3185
|
interpolation = interpolation.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, "");
|
|
@@ -2796,7 +3187,7 @@ function handleInterpolation(interpolation, i, arr) {
|
|
|
2796
3187
|
if (type === "function") {
|
|
2797
3188
|
if (this === void 0) ;
|
|
2798
3189
|
else {
|
|
2799
|
-
|
|
3190
|
+
handleInterpolation2.call(this, interpolation(this), i, arr);
|
|
2800
3191
|
}
|
|
2801
3192
|
return;
|
|
2802
3193
|
}
|
|
@@ -2826,7 +3217,7 @@ function handleInterpolation(interpolation, i, arr) {
|
|
|
2826
3217
|
styles.push(interpolation);
|
|
2827
3218
|
}
|
|
2828
3219
|
if (Array.isArray(interpolation)) {
|
|
2829
|
-
interpolation.forEach(
|
|
3220
|
+
interpolation.forEach(handleInterpolation2, this);
|
|
2830
3221
|
}
|
|
2831
3222
|
lastType = type;
|
|
2832
3223
|
}
|
|
@@ -2846,7 +3237,7 @@ function createCss(StyleSheet4) {
|
|
|
2846
3237
|
vals = interleave(args);
|
|
2847
3238
|
}
|
|
2848
3239
|
try {
|
|
2849
|
-
vals.forEach(
|
|
3240
|
+
vals.forEach(handleInterpolation2, this);
|
|
2850
3241
|
} finally {
|
|
2851
3242
|
buffer = prevBuffer;
|
|
2852
3243
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-theming",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "A wrapper library around emotion 11 to provide theming support for react-native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@emotion/native": "^11.11.0",
|
|
32
|
-
"@emotion/react": "^11.
|
|
32
|
+
"@emotion/react": "^11.14.0",
|
|
33
33
|
"tsup": "^8.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"dist/**/*",
|
|
44
44
|
"README.md"
|
|
45
45
|
],
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "7604d1c21f15767940d30d9c5dcf9da73d0a9fe7"
|
|
47
47
|
}
|