@tamagui/react-native-web-internals 1.116.1 → 1.116.2
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/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.js +192 -0
- package/dist/cjs/StyleSheet/__tests__/compiler-test.js +378 -0
- package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.js +117 -0
- package/dist/cjs/StyleSheet/__tests__/index-test.js +347 -0
- package/dist/cjs/StyleSheet/__tests__/preprocess-test.js +77 -0
- package/dist/cjs/StyleSheet/__tests__/validate-test.js +18 -0
- package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.js +121 -0
- package/dist/cjs/StyleSheet/compiler/hash.js +21 -0
- package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.js +31 -0
- package/dist/cjs/StyleSheet/compiler/index.js +253 -0
- package/dist/cjs/StyleSheet/compiler/normalizeColor.js +42 -0
- package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.js +45 -0
- package/dist/cjs/StyleSheet/compiler/resolveShadowValue.js +35 -0
- package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.js +44 -0
- package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.js +94 -0
- package/dist/cjs/StyleSheet/dom/index.js +74 -0
- package/dist/cjs/StyleSheet/index.js +52 -0
- package/dist/cjs/StyleSheet/preprocess.js +67 -0
- package/dist/cjs/StyleSheet/validate.js +66 -0
- package/dist/cjs/TextAncestorContext.js +24 -0
- package/dist/cjs/colorProps.js +32 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.js +46 -0
- package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.js +30 -0
- package/dist/cjs/modules/AccessibilityUtil/index.js +36 -0
- package/dist/cjs/modules/AccessibilityUtil/isDisabled.js +22 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.js +60 -0
- package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.js +43 -0
- package/dist/cjs/modules/AssetRegistry/index.js +28 -0
- package/dist/cjs/modules/ImageLoader/index.js +102 -0
- package/dist/cjs/modules/InteractionManager.js +68 -0
- package/dist/cjs/modules/Platform/__tests__/index-test.js +46 -0
- package/dist/cjs/modules/Platform/index.js +26 -0
- package/dist/cjs/modules/TextInputState/index.js +59 -0
- package/dist/cjs/modules/UIManager/__tests__/index-test.js +66 -0
- package/dist/cjs/modules/UIManager/index.js +101 -0
- package/dist/cjs/modules/canUseDOM.js +23 -0
- package/dist/cjs/modules/createDOMProps/__tests__/index-test.js +106 -0
- package/dist/cjs/modules/createDOMProps/index.js +121 -0
- package/dist/cjs/modules/createEventHandle/__tests__/index-test.js +242 -0
- package/dist/cjs/modules/createEventHandle/index.js +74 -0
- package/dist/cjs/modules/dismissKeyboard/index.js +33 -0
- package/dist/cjs/modules/forwardedProps/index.js +145 -0
- package/dist/cjs/modules/getBoundingClientRect/index.js +25 -0
- package/dist/cjs/modules/invariant.js +35 -0
- package/dist/cjs/modules/isSelectionValid/index.js +27 -0
- package/dist/cjs/modules/isWebColor/index.js +22 -0
- package/dist/cjs/modules/mergeRefs/__tests__/index-test.js +34 -0
- package/dist/cjs/modules/mergeRefs/index.js +41 -0
- package/dist/cjs/modules/modality/__tests__/index-test.js +20 -0
- package/dist/cjs/modules/modality/index.js +90 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.js +28 -0
- package/dist/cjs/modules/multiplyStyleLengthValue/index.js +28 -0
- package/dist/cjs/modules/normalizeColor/index.js +40 -0
- package/dist/cjs/modules/pick/index.js +26 -0
- package/dist/cjs/modules/processColor/__tests__/index-test.js +64 -0
- package/dist/cjs/modules/processColor/index.js +36 -0
- package/dist/cjs/modules/requestIdleCallback/index.js +44 -0
- package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.js +34 -0
- package/dist/cjs/modules/setValueForStyles/index.js +39 -0
- package/dist/cjs/modules/unitlessNumbers/index.js +80 -0
- package/dist/cjs/modules/useElementLayout/index.js +65 -0
- package/dist/cjs/modules/useEvent/__tests__/index-test.js +289 -0
- package/dist/cjs/modules/useEvent/index.js +45 -0
- package/dist/cjs/modules/useHover/__tests__/index-test.js +195 -0
- package/dist/cjs/modules/useHover/index.js +81 -0
- package/dist/cjs/modules/useLayoutEffect/index.js +31 -0
- package/dist/cjs/modules/useLocale/index.js +54 -0
- package/dist/cjs/modules/useLocale/isLocaleRTL.js +91 -0
- package/dist/cjs/modules/useMergeRefs/__tests__/index-test.js +68 -0
- package/dist/cjs/modules/useMergeRefs/index.js +36 -0
- package/dist/cjs/modules/usePlatformMethods/index.js +39 -0
- package/dist/cjs/modules/useStable/__tests__/index-test.js +69 -0
- package/dist/cjs/modules/useStable/index.js +34 -0
- package/dist/cjs/styleTypes.js +14 -0
- package/dist/cjs/types.js +14 -0
- package/package.json +7 -7
- /package/dist/cjs/StyleSheet/__tests__/{compiler-createReactDOMStyle-test.cjs.map → compiler-createReactDOMStyle-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{compiler-test.cjs.map → compiler-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{dom-createOrderedCSSStyleSheet-test.cjs.map → dom-createOrderedCSSStyleSheet-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{preprocess-test.cjs.map → preprocess-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/__tests__/{validate-test.cjs.map → validate-test.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{createReactDOMStyle.cjs.map → createReactDOMStyle.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hash.cjs.map → hash.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{hyphenateStyleName.cjs.map → hyphenateStyleName.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeColor.cjs.map → normalizeColor.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{normalizeValueWithProperty.cjs.map → normalizeValueWithProperty.js.map} +0 -0
- /package/dist/cjs/StyleSheet/compiler/{resolveShadowValue.cjs.map → resolveShadowValue.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createCSSStyleSheet.cjs.map → createCSSStyleSheet.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{createOrderedCSSStyleSheet.cjs.map → createOrderedCSSStyleSheet.js.map} +0 -0
- /package/dist/cjs/StyleSheet/dom/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{preprocess.cjs.map → preprocess.js.map} +0 -0
- /package/dist/cjs/StyleSheet/{validate.cjs.map → validate.js.map} +0 -0
- /package/dist/cjs/{TextAncestorContext.cjs.map → TextAncestorContext.js.map} +0 -0
- /package/dist/cjs/{colorProps.cjs.map → colorProps.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAccessibilityComponent-test.cjs.map → propsToAccessibilityComponent-test.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/__tests__/{propsToAriaRole-test.cjs.map → propsToAriaRole-test.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{isDisabled.cjs.map → isDisabled.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAccessibilityComponent.cjs.map → propsToAccessibilityComponent.js.map} +0 -0
- /package/dist/cjs/modules/AccessibilityUtil/{propsToAriaRole.cjs.map → propsToAriaRole.js.map} +0 -0
- /package/dist/cjs/modules/AssetRegistry/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/ImageLoader/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{InteractionManager.cjs.map → InteractionManager.js.map} +0 -0
- /package/dist/cjs/modules/Platform/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/Platform/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/TextInputState/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/UIManager/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/UIManager/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{canUseDOM.cjs.map → canUseDOM.js.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/createDOMProps/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/createEventHandle/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/dismissKeyboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/forwardedProps/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/getBoundingClientRect/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/{invariant.cjs.map → invariant.js.map} +0 -0
- /package/dist/cjs/modules/isSelectionValid/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/isWebColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/mergeRefs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/modality/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/modality/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/multiplyStyleLengthValue/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/normalizeColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/pick/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/processColor/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/processColor/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/requestIdleCallback/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{dangerousStyleValue.cjs.map → dangerousStyleValue.js.map} +0 -0
- /package/dist/cjs/modules/setValueForStyles/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/unitlessNumbers/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useElementLayout/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useEvent/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useEvent/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useHover/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useHover/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLayoutEffect/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLocale/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useLocale/{isLocaleRTL.cjs.map → isLocaleRTL.js.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useMergeRefs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/usePlatformMethods/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/modules/useStable/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/modules/useStable/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{styleTypes.cjs.map → styleTypes.js.map} +0 -0
- /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var compiler_exports = {};
|
|
24
|
+
__export(compiler_exports, {
|
|
25
|
+
atomic: () => atomic,
|
|
26
|
+
classic: () => classic,
|
|
27
|
+
inline: () => inline,
|
|
28
|
+
stringifyValueWithProperty: () => stringifyValueWithProperty
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(compiler_exports);
|
|
31
|
+
var import_simple_hash = require("@tamagui/simple-hash"), import_createReactDOMStyle = __toESM(require("./createReactDOMStyle")), import_hyphenateStyleName = __toESM(require("./hyphenateStyleName")), import_normalizeValueWithProperty = __toESM(require("./normalizeValueWithProperty"));
|
|
32
|
+
const cache = /* @__PURE__ */ new Map(), emptyObject = {}, classicGroup = 1, atomicGroup = 2.2, customGroup = {
|
|
33
|
+
borderColor: 2,
|
|
34
|
+
borderRadius: 2,
|
|
35
|
+
borderStyle: 2,
|
|
36
|
+
borderWidth: 2,
|
|
37
|
+
display: 2,
|
|
38
|
+
flex: 2,
|
|
39
|
+
margin: 2,
|
|
40
|
+
overflow: 2,
|
|
41
|
+
overscrollBehavior: 2,
|
|
42
|
+
padding: 2,
|
|
43
|
+
marginHorizontal: 2.1,
|
|
44
|
+
marginVertical: 2.1,
|
|
45
|
+
paddingHorizontal: 2.1,
|
|
46
|
+
paddingVertical: 2.1
|
|
47
|
+
}, borderTopLeftRadius = "borderTopLeftRadius", borderTopRightRadius = "borderTopRightRadius", borderBottomLeftRadius = "borderBottomLeftRadius", borderBottomRightRadius = "borderBottomRightRadius", borderLeftColor = "borderLeftColor", borderLeftStyle = "borderLeftStyle", borderLeftWidth = "borderLeftWidth", borderRightColor = "borderRightColor", borderRightStyle = "borderRightStyle", borderRightWidth = "borderRightWidth", right = "right", marginLeft = "marginLeft", marginRight = "marginRight", paddingLeft = "paddingLeft", paddingRight = "paddingRight", left = "left", PROPERTIES_FLIP = {
|
|
48
|
+
[borderTopLeftRadius]: borderTopRightRadius,
|
|
49
|
+
[borderTopRightRadius]: borderTopLeftRadius,
|
|
50
|
+
[borderBottomLeftRadius]: borderBottomRightRadius,
|
|
51
|
+
[borderBottomRightRadius]: borderBottomLeftRadius,
|
|
52
|
+
[borderLeftColor]: borderRightColor,
|
|
53
|
+
[borderLeftStyle]: borderRightStyle,
|
|
54
|
+
[borderLeftWidth]: borderRightWidth,
|
|
55
|
+
[borderRightColor]: borderLeftColor,
|
|
56
|
+
[borderRightStyle]: borderLeftStyle,
|
|
57
|
+
[borderRightWidth]: borderLeftWidth,
|
|
58
|
+
[left]: right,
|
|
59
|
+
[marginLeft]: marginRight,
|
|
60
|
+
[marginRight]: marginLeft,
|
|
61
|
+
[paddingLeft]: paddingRight,
|
|
62
|
+
[paddingRight]: paddingLeft,
|
|
63
|
+
[right]: left
|
|
64
|
+
}, PROPERTIES_I18N = {
|
|
65
|
+
borderTopStartRadius: borderTopLeftRadius,
|
|
66
|
+
borderTopEndRadius: borderTopRightRadius,
|
|
67
|
+
borderBottomStartRadius: borderBottomLeftRadius,
|
|
68
|
+
borderBottomEndRadius: borderBottomRightRadius,
|
|
69
|
+
borderStartColor: borderLeftColor,
|
|
70
|
+
borderStartStyle: borderLeftStyle,
|
|
71
|
+
borderStartWidth: borderLeftWidth,
|
|
72
|
+
borderEndColor: borderRightColor,
|
|
73
|
+
borderEndStyle: borderRightStyle,
|
|
74
|
+
borderEndWidth: borderRightWidth,
|
|
75
|
+
end: right,
|
|
76
|
+
marginStart: marginLeft,
|
|
77
|
+
marginEnd: marginRight,
|
|
78
|
+
paddingStart: paddingLeft,
|
|
79
|
+
paddingEnd: paddingRight,
|
|
80
|
+
start: left
|
|
81
|
+
}, PROPERTIES_VALUE = ["clear", "float", "textAlign"];
|
|
82
|
+
function atomic(style) {
|
|
83
|
+
const compiledStyle = { $$css: !0 }, compiledRules = [];
|
|
84
|
+
function atomicCompile(prop, value) {
|
|
85
|
+
const valueString = stringifyValueWithProperty(value, prop), cacheKey = prop + valueString, cachedResult = cache.get(cacheKey);
|
|
86
|
+
let identifier;
|
|
87
|
+
if (cachedResult != null)
|
|
88
|
+
identifier = cachedResult[0], compiledRules.push(cachedResult[1]);
|
|
89
|
+
else {
|
|
90
|
+
identifier = createIdentifier("r", prop, value);
|
|
91
|
+
const order = customGroup[prop] || atomicGroup, orderedRules = [createAtomicRules(identifier, prop, value), order];
|
|
92
|
+
compiledRules.push(orderedRules), cache.set(cacheKey, [identifier, orderedRules]);
|
|
93
|
+
}
|
|
94
|
+
return identifier;
|
|
95
|
+
}
|
|
96
|
+
return Object.keys(style).sort().forEach((prop) => {
|
|
97
|
+
const value = style[prop];
|
|
98
|
+
if (value != null) {
|
|
99
|
+
let localizeableValue;
|
|
100
|
+
if (PROPERTIES_VALUE.indexOf(prop) > -1) {
|
|
101
|
+
const left2 = atomicCompile(prop, "left"), right2 = atomicCompile(prop, "right");
|
|
102
|
+
value === "start" ? localizeableValue = [left2, right2] : value === "end" && (localizeableValue = [right2, left2]);
|
|
103
|
+
}
|
|
104
|
+
const propPolyfill = PROPERTIES_I18N[prop];
|
|
105
|
+
if (propPolyfill != null) {
|
|
106
|
+
const ltr = atomicCompile(propPolyfill, value), rtl = atomicCompile(PROPERTIES_FLIP[propPolyfill], value);
|
|
107
|
+
localizeableValue = [ltr, rtl];
|
|
108
|
+
}
|
|
109
|
+
if (prop === "transitionProperty") {
|
|
110
|
+
const values = Array.isArray(value) ? value : [value], polyfillIndices = [];
|
|
111
|
+
for (let i = 0; i < values.length; i++) {
|
|
112
|
+
const val = values[i];
|
|
113
|
+
typeof val == "string" && PROPERTIES_I18N[val] != null && polyfillIndices.push(i);
|
|
114
|
+
}
|
|
115
|
+
if (polyfillIndices.length > 0) {
|
|
116
|
+
const ltrPolyfillValues = [...values], rtlPolyfillValues = [...values];
|
|
117
|
+
polyfillIndices.forEach((i) => {
|
|
118
|
+
const ltrVal = ltrPolyfillValues[i];
|
|
119
|
+
if (typeof ltrVal == "string") {
|
|
120
|
+
const ltrPolyfill = PROPERTIES_I18N[ltrVal], rtlPolyfill = PROPERTIES_FLIP[ltrPolyfill];
|
|
121
|
+
ltrPolyfillValues[i] = ltrPolyfill, rtlPolyfillValues[i] = rtlPolyfill;
|
|
122
|
+
const ltr = atomicCompile(prop, ltrPolyfillValues), rtl = atomicCompile(prop, rtlPolyfillValues);
|
|
123
|
+
localizeableValue = [ltr, rtl];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
localizeableValue == null ? localizeableValue = atomicCompile(prop, value) : compiledStyle.$$css$localize = !0, compiledStyle[prop] = localizeableValue;
|
|
129
|
+
}
|
|
130
|
+
}), [compiledStyle, compiledRules];
|
|
131
|
+
}
|
|
132
|
+
function classic(style, name) {
|
|
133
|
+
const compiledStyle = { $$css: !0 }, compiledRules = [], { animationKeyframes, ...rest } = style, identifier = createIdentifier("css", name, style), selector = `.${identifier}`;
|
|
134
|
+
let animationName;
|
|
135
|
+
if (animationKeyframes != null) {
|
|
136
|
+
const [animationNames, keyframesRules] = processKeyframesValue(animationKeyframes);
|
|
137
|
+
animationName = animationNames.join(","), compiledRules.push(...keyframesRules);
|
|
138
|
+
}
|
|
139
|
+
const block = createDeclarationBlock({ ...rest, animationName });
|
|
140
|
+
return compiledRules.push(`${selector}${block}`), compiledStyle[identifier] = identifier, [compiledStyle, [[compiledRules, classicGroup]]];
|
|
141
|
+
}
|
|
142
|
+
function inline(originalStyle, isRTL) {
|
|
143
|
+
const style = originalStyle || emptyObject, frozenProps = {}, nextStyle = {};
|
|
144
|
+
for (const originalProp in style) {
|
|
145
|
+
const originalValue = style[originalProp];
|
|
146
|
+
let prop = originalProp, value = originalValue;
|
|
147
|
+
if (!Object.prototype.hasOwnProperty.call(style, originalProp) || originalValue == null)
|
|
148
|
+
continue;
|
|
149
|
+
PROPERTIES_VALUE.indexOf(originalProp) > -1 && (originalValue === "start" ? value = isRTL ? "right" : "left" : originalValue === "end" && (value = isRTL ? "left" : "right"));
|
|
150
|
+
const propPolyfill = PROPERTIES_I18N[originalProp];
|
|
151
|
+
if (propPolyfill != null && (prop = isRTL ? PROPERTIES_FLIP[propPolyfill] : propPolyfill), originalProp === "transitionProperty") {
|
|
152
|
+
const originalValues = Array.isArray(originalValue) ? originalValue : [originalValue];
|
|
153
|
+
originalValues.forEach((val, i) => {
|
|
154
|
+
if (typeof val == "string") {
|
|
155
|
+
const valuePolyfill = PROPERTIES_I18N[val];
|
|
156
|
+
valuePolyfill != null && (originalValues[i] = isRTL ? PROPERTIES_FLIP[valuePolyfill] : valuePolyfill);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
frozenProps[prop] || (nextStyle[prop] = value), PROPERTIES_I18N.hasOwnProperty(originalProp) && (frozenProps[prop] = !0);
|
|
161
|
+
}
|
|
162
|
+
return (0, import_createReactDOMStyle.default)(nextStyle, !0);
|
|
163
|
+
}
|
|
164
|
+
function stringifyValueWithProperty(value, property) {
|
|
165
|
+
const normalizedValue = (0, import_normalizeValueWithProperty.default)(value, property);
|
|
166
|
+
return typeof normalizedValue != "string" ? JSON.stringify(normalizedValue || "") : normalizedValue;
|
|
167
|
+
}
|
|
168
|
+
function createAtomicRules(identifier, property, value) {
|
|
169
|
+
const rules = [], selector = `.${identifier}`;
|
|
170
|
+
switch (property) {
|
|
171
|
+
case "animationKeyframes": {
|
|
172
|
+
const [animationNames, keyframesRules] = processKeyframesValue(value), block = createDeclarationBlock({
|
|
173
|
+
animationName: animationNames.join(",")
|
|
174
|
+
});
|
|
175
|
+
rules.push(`${selector}${block}`, ...keyframesRules);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
// Equivalent to using '::placeholder'
|
|
179
|
+
case "placeholderTextColor": {
|
|
180
|
+
const block = createDeclarationBlock({ color: value, opacity: 1 });
|
|
181
|
+
rules.push(
|
|
182
|
+
`${selector}::-webkit-input-placeholder${block}`,
|
|
183
|
+
`${selector}::-moz-placeholder${block}`,
|
|
184
|
+
`${selector}:-ms-input-placeholder${block}`,
|
|
185
|
+
`${selector}::placeholder${block}`
|
|
186
|
+
);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
// Polyfill for additional 'pointer-events' values
|
|
190
|
+
// See d13f78622b233a0afc0c7a200c0a0792c8ca9e58
|
|
191
|
+
case "pointerEvents": {
|
|
192
|
+
let finalValue = value;
|
|
193
|
+
if (value === "auto" || value === "box-only") {
|
|
194
|
+
if (finalValue = "auto!important", value === "box-only") {
|
|
195
|
+
const block2 = createDeclarationBlock({ pointerEvents: "none" });
|
|
196
|
+
rules.push(`${selector}>*${block2}`);
|
|
197
|
+
}
|
|
198
|
+
} else if ((value === "none" || value === "box-none") && (finalValue = "none!important", value === "box-none")) {
|
|
199
|
+
const block2 = createDeclarationBlock({ pointerEvents: "auto" });
|
|
200
|
+
rules.push(`${selector}>*${block2}`);
|
|
201
|
+
}
|
|
202
|
+
const block = createDeclarationBlock({ pointerEvents: finalValue });
|
|
203
|
+
rules.push(`${selector}${block}`);
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
// Polyfill for draft spec
|
|
207
|
+
// https://drafts.csswg.org/css-scrollbars-1/
|
|
208
|
+
case "scrollbarWidth": {
|
|
209
|
+
value === "none" && rules.push(`${selector}::-webkit-scrollbar{display:none}`);
|
|
210
|
+
const block = createDeclarationBlock({ scrollbarWidth: value });
|
|
211
|
+
rules.push(`${selector}${block}`);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
default: {
|
|
215
|
+
const block = createDeclarationBlock({ [property]: value });
|
|
216
|
+
rules.push(`${selector}${block}`);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return rules;
|
|
221
|
+
}
|
|
222
|
+
function createDeclarationBlock(style) {
|
|
223
|
+
const domStyle = (0, import_createReactDOMStyle.default)(style);
|
|
224
|
+
return `{${Object.keys(domStyle).map((property) => {
|
|
225
|
+
const value = domStyle[property], prop = (0, import_hyphenateStyleName.default)(property);
|
|
226
|
+
return Array.isArray(value) ? value.map((v) => `${prop}:${v}`).join(";") : `${prop}:${value}`;
|
|
227
|
+
}).sort().join(";")};}`;
|
|
228
|
+
}
|
|
229
|
+
function createIdentifier(prefix, name, value) {
|
|
230
|
+
const hashedString = (0, import_simple_hash.simpleHash)(name + stringifyValueWithProperty(value, name));
|
|
231
|
+
return process.env.NODE_ENV !== "production" ? `${prefix}-${name}-${hashedString}` : `${prefix}-${hashedString}`;
|
|
232
|
+
}
|
|
233
|
+
function createKeyframes(keyframes) {
|
|
234
|
+
const prefixes = ["-webkit-", ""], identifier = createIdentifier("r", "animation", keyframes), steps = "{" + Object.keys(keyframes).map((stepName) => {
|
|
235
|
+
const rule = keyframes[stepName], block = createDeclarationBlock(rule);
|
|
236
|
+
return `${stepName}${block}`;
|
|
237
|
+
}).join("") + "}", rules = prefixes.map((prefix) => `@${prefix}keyframes ${identifier}${steps}`);
|
|
238
|
+
return [identifier, rules];
|
|
239
|
+
}
|
|
240
|
+
function processKeyframesValue(keyframesValue) {
|
|
241
|
+
if (typeof keyframesValue == "number")
|
|
242
|
+
throw new Error(`Invalid CSS keyframes type: ${typeof keyframesValue}`);
|
|
243
|
+
const animationNames = [], rules = [];
|
|
244
|
+
return (Array.isArray(keyframesValue) ? keyframesValue : [keyframesValue]).forEach((keyframes) => {
|
|
245
|
+
if (typeof keyframes == "string")
|
|
246
|
+
animationNames.push(keyframes);
|
|
247
|
+
else {
|
|
248
|
+
const [identifier, keyframesRules] = createKeyframes(keyframes);
|
|
249
|
+
animationNames.push(identifier), rules.push(...keyframesRules);
|
|
250
|
+
}
|
|
251
|
+
}), [animationNames, rules];
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var normalizeColor_exports = {};
|
|
24
|
+
__export(normalizeColor_exports, {
|
|
25
|
+
default: () => normalizeColor_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(normalizeColor_exports);
|
|
28
|
+
var import_isWebColor = __toESM(require("../../modules/isWebColor")), import_processColor = require("../../modules/processColor");
|
|
29
|
+
const normalizeColor = (color, opacity = 1) => {
|
|
30
|
+
if (color == null) return;
|
|
31
|
+
if (typeof color == "string" && (0, import_isWebColor.default)(color))
|
|
32
|
+
return color;
|
|
33
|
+
const colorInt = (0, import_processColor.processColor)(color);
|
|
34
|
+
if (colorInt != null) {
|
|
35
|
+
const r = colorInt >> 16 & 255, g = colorInt >> 8 & 255, b = colorInt & 255, alpha = ((colorInt >> 24 & 255) / 255 * opacity).toFixed(2);
|
|
36
|
+
return `rgba(${r},${g},${b},${alpha})`;
|
|
37
|
+
}
|
|
38
|
+
if (typeof color == "string")
|
|
39
|
+
return color;
|
|
40
|
+
};
|
|
41
|
+
var normalizeColor_default = normalizeColor;
|
|
42
|
+
//# sourceMappingURL=normalizeColor.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var normalizeValueWithProperty_exports = {};
|
|
24
|
+
__export(normalizeValueWithProperty_exports, {
|
|
25
|
+
default: () => normalizeValueWithProperty
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(normalizeValueWithProperty_exports);
|
|
28
|
+
var import_unitlessNumbers = require("../../modules/unitlessNumbers/index"), import_normalizeColor = __toESM(require("./normalizeColor"));
|
|
29
|
+
const colorProps = {
|
|
30
|
+
backgroundColor: !0,
|
|
31
|
+
borderColor: !0,
|
|
32
|
+
borderTopColor: !0,
|
|
33
|
+
borderRightColor: !0,
|
|
34
|
+
borderBottomColor: !0,
|
|
35
|
+
borderLeftColor: !0,
|
|
36
|
+
color: !0,
|
|
37
|
+
shadowColor: !0,
|
|
38
|
+
textDecorationColor: !0,
|
|
39
|
+
textShadowColor: !0
|
|
40
|
+
};
|
|
41
|
+
function normalizeValueWithProperty(value, property) {
|
|
42
|
+
let returnValue = value;
|
|
43
|
+
return (property == null || !import_unitlessNumbers.unitlessNumbers[property]) && typeof value == "number" ? returnValue = `${value}px` : property != null && colorProps[property] && (returnValue = (0, import_normalizeColor.default)(value)), returnValue;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=normalizeValueWithProperty.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var resolveShadowValue_exports = {};
|
|
24
|
+
__export(resolveShadowValue_exports, {
|
|
25
|
+
default: () => resolveShadowValue_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(resolveShadowValue_exports);
|
|
28
|
+
var import_normalizeColor = __toESM(require("./normalizeColor")), import_normalizeValueWithProperty = __toESM(require("./normalizeValueWithProperty"));
|
|
29
|
+
const defaultOffset = { height: 0, width: 0 }, resolveShadowValue = (style) => {
|
|
30
|
+
const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style, { height, width } = shadowOffset || defaultOffset, offsetX = (0, import_normalizeValueWithProperty.default)(width), offsetY = (0, import_normalizeValueWithProperty.default)(height), blurRadius = (0, import_normalizeValueWithProperty.default)(shadowRadius || 0), color = (0, import_normalizeColor.default)(shadowColor || "black", shadowOpacity);
|
|
31
|
+
if (color != null && offsetX != null && offsetY != null && blurRadius != null)
|
|
32
|
+
return `${offsetX} ${offsetY} ${blurRadius} ${color}`;
|
|
33
|
+
};
|
|
34
|
+
var resolveShadowValue_default = resolveShadowValue;
|
|
35
|
+
//# sourceMappingURL=resolveShadowValue.js.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var createCSSStyleSheet_exports = {};
|
|
24
|
+
__export(createCSSStyleSheet_exports, {
|
|
25
|
+
default: () => createCSSStyleSheet
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(createCSSStyleSheet_exports);
|
|
28
|
+
var import_canUseDOM = __toESM(require("../../modules/canUseDOM"));
|
|
29
|
+
function createCSSStyleSheet(id, rootNode, textContent) {
|
|
30
|
+
if (import_canUseDOM.default) {
|
|
31
|
+
const root = rootNode ?? document;
|
|
32
|
+
let element = root.getElementById(id);
|
|
33
|
+
if (element == null)
|
|
34
|
+
if (element = document.createElement("style"), element.setAttribute("id", id), typeof textContent == "string" && element.appendChild(document.createTextNode(textContent)), root instanceof ShadowRoot)
|
|
35
|
+
root.insertBefore(element, root.firstChild);
|
|
36
|
+
else {
|
|
37
|
+
const head = root.head;
|
|
38
|
+
head && head.appendChild(element);
|
|
39
|
+
}
|
|
40
|
+
return element.sheet;
|
|
41
|
+
} else
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=createCSSStyleSheet.js.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var createOrderedCSSStyleSheet_exports = {};
|
|
16
|
+
__export(createOrderedCSSStyleSheet_exports, {
|
|
17
|
+
default: () => createOrderedCSSStyleSheet
|
|
18
|
+
});
|
|
19
|
+
module.exports = __toCommonJS(createOrderedCSSStyleSheet_exports);
|
|
20
|
+
const slice = Array.prototype.slice;
|
|
21
|
+
function createOrderedCSSStyleSheet(sheet) {
|
|
22
|
+
const groups = {}, selectors = {};
|
|
23
|
+
if (sheet != null) {
|
|
24
|
+
let group;
|
|
25
|
+
slice.call(sheet.cssRules).forEach((cssRule, i) => {
|
|
26
|
+
const cssText = cssRule.cssText;
|
|
27
|
+
if (cssText.indexOf("stylesheet-group") > -1)
|
|
28
|
+
group = decodeGroupRule(cssRule), groups[group] = { start: i, rules: [cssText] };
|
|
29
|
+
else {
|
|
30
|
+
const selectorText = getSelectorText(cssText);
|
|
31
|
+
selectorText != null && (selectors[selectorText] = !0, groups[group].rules.push(cssText));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function sheetInsert(sheet2, group, text) {
|
|
36
|
+
const orderedGroups = getOrderedGroups(groups), nextGroupIndex = orderedGroups.indexOf(group) + 1, nextGroup = orderedGroups[nextGroupIndex], position = nextGroup != null && groups[nextGroup].start != null ? groups[nextGroup].start : sheet2.cssRules.length, isInserted = insertRuleAt(sheet2, text, position);
|
|
37
|
+
if (isInserted) {
|
|
38
|
+
groups[group].start == null && (groups[group].start = position);
|
|
39
|
+
for (let i = nextGroupIndex; i < orderedGroups.length; i += 1) {
|
|
40
|
+
const groupNumber = orderedGroups[i], previousStart = groups[groupNumber].start || 0;
|
|
41
|
+
groups[groupNumber].start = previousStart + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return isInserted;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
/**
|
|
48
|
+
* The textContent of the style sheet.
|
|
49
|
+
*/
|
|
50
|
+
getTextContent() {
|
|
51
|
+
return getOrderedGroups(groups).map((group) => {
|
|
52
|
+
const rules = groups[group].rules, marker = rules.shift();
|
|
53
|
+
return rules.sort(), rules.unshift(marker), rules.join(`
|
|
54
|
+
`);
|
|
55
|
+
}).join(`
|
|
56
|
+
`);
|
|
57
|
+
},
|
|
58
|
+
/**
|
|
59
|
+
* Insert a rule into the style sheet
|
|
60
|
+
*/
|
|
61
|
+
insert(cssText, groupValue) {
|
|
62
|
+
const group = Number(groupValue);
|
|
63
|
+
if (groups[group] == null) {
|
|
64
|
+
const markerRule = encodeGroupRule(group);
|
|
65
|
+
groups[group] = { start: null, rules: [markerRule] }, sheet != null && sheetInsert(sheet, group, markerRule);
|
|
66
|
+
}
|
|
67
|
+
const selectorText = getSelectorText(cssText);
|
|
68
|
+
selectorText != null && selectors[selectorText] == null && (selectors[selectorText] = !0, groups[group].rules.push(cssText), sheet != null && (sheetInsert(sheet, group, cssText) || groups[group].rules.pop()));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function encodeGroupRule(group) {
|
|
73
|
+
return `[stylesheet-group="${group}"]{}`;
|
|
74
|
+
}
|
|
75
|
+
const groupPattern = /["']/g;
|
|
76
|
+
function decodeGroupRule(cssRule) {
|
|
77
|
+
return Number(cssRule.selectorText.split(groupPattern)[1]);
|
|
78
|
+
}
|
|
79
|
+
function getOrderedGroups(obj) {
|
|
80
|
+
return Object.keys(obj).map(Number).sort((a, b) => a > b ? 1 : -1);
|
|
81
|
+
}
|
|
82
|
+
const selectorPattern = /\s*([,])\s*/g;
|
|
83
|
+
function getSelectorText(cssText) {
|
|
84
|
+
const selector = cssText.split("{")[0].trim();
|
|
85
|
+
return selector !== "" ? selector.replace(selectorPattern, "$1") : null;
|
|
86
|
+
}
|
|
87
|
+
function insertRuleAt(root, cssText, position) {
|
|
88
|
+
try {
|
|
89
|
+
return root.insertRule(cssText, position), !0;
|
|
90
|
+
} catch {
|
|
91
|
+
return !1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=createOrderedCSSStyleSheet.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var dom_exports = {};
|
|
24
|
+
__export(dom_exports, {
|
|
25
|
+
createSheet: () => createSheet
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(dom_exports);
|
|
28
|
+
var import_canUseDOM = __toESM(require("../../modules/canUseDOM")), import_createCSSStyleSheet = __toESM(require("./createCSSStyleSheet")), import_createOrderedCSSStyleSheet = __toESM(require("./createOrderedCSSStyleSheet"));
|
|
29
|
+
const defaultId = "react-native-stylesheet", roots = /* @__PURE__ */ new WeakMap(), sheets = [], initialRules = [
|
|
30
|
+
// minimal top-level reset
|
|
31
|
+
"html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}",
|
|
32
|
+
"body{margin:0;}",
|
|
33
|
+
// minimal form pseudo-element reset
|
|
34
|
+
"button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}",
|
|
35
|
+
"input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}"
|
|
36
|
+
];
|
|
37
|
+
function createSheet(root, id = defaultId) {
|
|
38
|
+
let sheet;
|
|
39
|
+
function createSheet2() {
|
|
40
|
+
if (!sheet)
|
|
41
|
+
if (import_canUseDOM.default) {
|
|
42
|
+
const rootNode = root != null ? root.getRootNode() : document;
|
|
43
|
+
if (sheets.length === 0)
|
|
44
|
+
sheet = (0, import_createOrderedCSSStyleSheet.default)((0, import_createCSSStyleSheet.default)(id)), initialRules.forEach((rule) => {
|
|
45
|
+
sheet.insert(rule, 0);
|
|
46
|
+
}), roots.set(rootNode, sheets.length), sheets.push(sheet);
|
|
47
|
+
else {
|
|
48
|
+
const index = roots.get(rootNode);
|
|
49
|
+
if (index == null) {
|
|
50
|
+
const initialSheet = sheets[0], textContent = initialSheet != null ? initialSheet.getTextContent() : "";
|
|
51
|
+
sheet = (0, import_createOrderedCSSStyleSheet.default)(
|
|
52
|
+
(0, import_createCSSStyleSheet.default)(id, rootNode, textContent)
|
|
53
|
+
), roots.set(rootNode, sheets.length), sheets.push(sheet);
|
|
54
|
+
} else
|
|
55
|
+
sheet = sheets[index];
|
|
56
|
+
}
|
|
57
|
+
} else
|
|
58
|
+
sheets.length === 0 ? (sheet = (0, import_createOrderedCSSStyleSheet.default)((0, import_createCSSStyleSheet.default)(id)), initialRules.forEach((rule) => {
|
|
59
|
+
sheet.insert(rule, 0);
|
|
60
|
+
}), sheets.push(sheet)) : sheet = sheets[0];
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
getTextContent() {
|
|
64
|
+
return createSheet2(), sheet.getTextContent();
|
|
65
|
+
},
|
|
66
|
+
id,
|
|
67
|
+
insert(cssText, groupValue) {
|
|
68
|
+
createSheet2(), sheets.forEach((s) => {
|
|
69
|
+
s.insert(cssText, groupValue);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
+
var StyleSheet_exports = {};
|
|
16
|
+
__export(StyleSheet_exports, {
|
|
17
|
+
default: () => StyleSheet,
|
|
18
|
+
flatten: () => flatten
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(StyleSheet_exports);
|
|
21
|
+
const absoluteFillObject = {
|
|
22
|
+
position: "absolute",
|
|
23
|
+
left: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
top: 0,
|
|
26
|
+
bottom: 0
|
|
27
|
+
}, absoluteFill = absoluteFillObject;
|
|
28
|
+
function create(styles) {
|
|
29
|
+
return styles;
|
|
30
|
+
}
|
|
31
|
+
function compose(style1, style2) {
|
|
32
|
+
return flatten(style1, style2);
|
|
33
|
+
}
|
|
34
|
+
function flatten(...styles) {
|
|
35
|
+
return styles.flat().flat().flat().flat().reduce((acc, cur) => (cur && Object.assign(acc, cur), acc), {});
|
|
36
|
+
}
|
|
37
|
+
function getSheet() {
|
|
38
|
+
return {
|
|
39
|
+
id: "",
|
|
40
|
+
textContent: sheet.getTextContent()
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function StyleSheet(styles, options) {
|
|
44
|
+
}
|
|
45
|
+
StyleSheet.absoluteFill = absoluteFill;
|
|
46
|
+
StyleSheet.absoluteFillObject = absoluteFillObject;
|
|
47
|
+
StyleSheet.create = create;
|
|
48
|
+
StyleSheet.compose = compose;
|
|
49
|
+
StyleSheet.flatten = flatten;
|
|
50
|
+
StyleSheet.getSheet = getSheet;
|
|
51
|
+
StyleSheet.hairlineWidth = 1;
|
|
52
|
+
//# sourceMappingURL=index.js.map
|