@weapp-tailwindcss/react-native 0.3.4 → 0.3.6
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/README.md +14 -0
- package/README.zh-CN.md +14 -0
- package/dist/babel.cjs +2 -3
- package/dist/babel.d.cts +6 -0
- package/dist/babel.d.ts +2 -3
- package/dist/babel.js +1 -2
- package/dist/compiler.cjs +12 -2
- package/dist/compiler.d.cts +7 -0
- package/dist/compiler.d.ts +1 -3
- package/dist/compiler.js +13 -3
- package/dist/env.d.cts +10 -0
- package/dist/env.d.ts +1 -3
- package/dist/index.cjs +7 -3
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/manifest-DRxbQp2v.cjs +47 -0
- package/dist/manifest-DuhmZ2T9.js +24 -0
- package/dist/metro-BdsKKvRn.d.cts +63 -0
- package/dist/{metro-BZbdIyTH.js → metro-OMh6z1jy.js} +216 -97
- package/dist/metro-ahmChgsA.d.ts +63 -0
- package/dist/{metro-Ds2ZUc6_.cjs → metro-kaKzXOAU.cjs} +238 -101
- package/dist/metro-transformer.cjs +5 -11
- package/dist/metro-transformer.d.cts +2 -0
- package/dist/metro-transformer.d.ts +1 -3
- package/dist/metro-transformer.js +4 -10
- package/dist/metro.cjs +4 -1
- package/dist/metro.d.cts +2 -0
- package/dist/metro.d.ts +2 -53
- package/dist/metro.js +1 -2
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
- package/dist/runtime-CbkbHrPb.cjs +383 -0
- package/dist/runtime-D4ZGX6yk.d.cts +42 -0
- package/dist/runtime-DuvYZu4P.js +330 -0
- package/dist/{runtime-B3hAisFx.d.ts → runtime-YHlnn5ip.d.ts} +20 -12
- package/dist/runtime.cjs +10 -186
- package/dist/runtime.d.cts +3 -0
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +1 -179
- package/dist/tailwind-4T0v_pRK.d.ts +13 -0
- package/dist/tailwind-B1Gl9P_t.js +121 -0
- package/dist/tailwind-CVspvWID.cjs +129 -0
- package/dist/tailwind-CfKLPJuW.d.cts +13 -0
- package/dist/tailwind.cjs +2 -58
- package/dist/tailwind.d.cts +2 -0
- package/dist/tailwind.d.ts +2 -16
- package/dist/tailwind.js +1 -55
- package/dist/{types-CKAFTXX9.d.ts → types-CxNMLBiF.d.cts} +6 -3
- package/dist/types-CxNMLBiF.d.ts +20 -0
- package/package.json +75 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -19,7 +19,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
//#endregion
|
|
23
22
|
Object.defineProperty(exports, "__toESM", {
|
|
24
23
|
enumerable: true,
|
|
25
24
|
get: function() {
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
const require_manifest = require("./manifest-DRxbQp2v.cjs");
|
|
2
|
+
let _weapp_tailwindcss_postcss_native_runtime = require("@weapp-tailwindcss/postcss/native-runtime");
|
|
3
|
+
// src/runtime/line-height.ts
|
|
4
|
+
function flattenInlineStyle(value, resolveRegistered) {
|
|
5
|
+
const style = {};
|
|
6
|
+
const active = /* @__PURE__ */ new Set();
|
|
7
|
+
const pending = [{ value }];
|
|
8
|
+
while (pending.length) {
|
|
9
|
+
const current = pending.pop();
|
|
10
|
+
if (Array.isArray(current.value)) {
|
|
11
|
+
if (current.exit) {
|
|
12
|
+
active.delete(current.value);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (active.has(current.value)) throw new Error("内联 style 数组包含循环引用");
|
|
16
|
+
active.add(current.value);
|
|
17
|
+
pending.push({
|
|
18
|
+
value: current.value,
|
|
19
|
+
exit: true
|
|
20
|
+
});
|
|
21
|
+
for (let index = current.value.length - 1; index >= 0; index--) pending.push({ value: current.value[index] });
|
|
22
|
+
} else if (current.value && typeof current.value === "object") Object.assign(style, current.value);
|
|
23
|
+
else if (typeof current.value === "number") Object.assign(style, resolveRegistered?.(current.value));
|
|
24
|
+
}
|
|
25
|
+
return style;
|
|
26
|
+
}
|
|
27
|
+
/** 字号级联完成后再计算;继承字号未知时不猜测平台默认值。 */
|
|
28
|
+
function relativeLineHeightStyle(relative, inline) {
|
|
29
|
+
if (!relative) return;
|
|
30
|
+
const style = flattenInlineStyle(inline);
|
|
31
|
+
if (style.lineHeight !== void 0 && !relative.important) return;
|
|
32
|
+
const fontSize = relative.importantFontSize ?? style.fontSize ?? relative.fontSize;
|
|
33
|
+
return typeof fontSize === "number" && Number.isFinite(fontSize) && fontSize >= 0 ? { lineHeight: fontSize * relative.multiplier } : void 0;
|
|
34
|
+
}
|
|
35
|
+
// src/runtime/shadow.ts
|
|
36
|
+
/** 阴影颜色依赖最终文字颜色;继承上下文未知时保留元数据,不猜测黑色。 */
|
|
37
|
+
function deferredBoxShadowStyle(context, inline) {
|
|
38
|
+
const style = flattenInlineStyle(inline);
|
|
39
|
+
if (!context.important && "boxShadow" in style) return;
|
|
40
|
+
const color = context.importantColor ?? (typeof style.color === "string" ? style.color : context.color);
|
|
41
|
+
const computed = (0, _weapp_tailwindcss_postcss_native_runtime.resolveNativeBoxShadow)(context.expression, context.bindings, color);
|
|
42
|
+
if (computed) return { boxShadow: computed };
|
|
43
|
+
if (!color && (0, _weapp_tailwindcss_postcss_native_runtime.resolveNativeBoxShadow)(context.expression, context.bindings, "#000000")) return;
|
|
44
|
+
throw new Error(`无法将当前 class 组合的 box-shadow 编译为原生阴影:${context.expression.value}`);
|
|
45
|
+
}
|
|
46
|
+
function inlineBoxShadowStyle(context, inline) {
|
|
47
|
+
if (!context || typeof flattenInlineStyle(inline).color !== "string") return;
|
|
48
|
+
return deferredBoxShadowStyle(context, inline);
|
|
49
|
+
}
|
|
50
|
+
// src/runtime/resolve.ts
|
|
51
|
+
function matches(rule, environment) {
|
|
52
|
+
if (rule.colorScheme && rule.colorScheme !== environment.colorScheme) return false;
|
|
53
|
+
if (!rule.platform) return true;
|
|
54
|
+
if (rule.platform === "native") return environment.platform !== "web";
|
|
55
|
+
return rule.platform === environment.platform;
|
|
56
|
+
}
|
|
57
|
+
function resolveRules(ids, manifest, environment, nativeStyleSheet) {
|
|
58
|
+
const normal = [];
|
|
59
|
+
const important = [];
|
|
60
|
+
for (const id of ids) {
|
|
61
|
+
const rule = manifest?.styleEntries?.[id];
|
|
62
|
+
if (rule) {
|
|
63
|
+
if (!matches(rule, environment)) continue;
|
|
64
|
+
(rule.important ? important : normal).push({
|
|
65
|
+
rule,
|
|
66
|
+
id
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const fallbackIds = manifest?.staticLookup?.[id] ?? [];
|
|
71
|
+
if (fallbackIds.length) for (const fallbackId of fallbackIds) {
|
|
72
|
+
const fallbackRule = manifest?.styleEntries?.[fallbackId];
|
|
73
|
+
if (!fallbackRule || !matches(fallbackRule, environment)) continue;
|
|
74
|
+
(fallbackRule.important ? important : normal).push({
|
|
75
|
+
rule: fallbackRule,
|
|
76
|
+
id: fallbackId
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
else for (const fallbackRule of manifest?.rules?.[id] ?? []) {
|
|
80
|
+
if (!matches(fallbackRule, environment)) continue;
|
|
81
|
+
(fallbackRule.important ? important : normal).push({
|
|
82
|
+
rule: fallbackRule,
|
|
83
|
+
id
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const order = (left, right) => (left.rule.order ?? 0) - (right.rule.order ?? 0);
|
|
88
|
+
normal.sort(order);
|
|
89
|
+
important.sort(order);
|
|
90
|
+
const customProperties = Object.assign({}, ...[...normal, ...important].map(({ rule }) => rule.customProperties));
|
|
91
|
+
const style = {};
|
|
92
|
+
const importantStyle = {};
|
|
93
|
+
let relative;
|
|
94
|
+
let boxShadow;
|
|
95
|
+
let transform;
|
|
96
|
+
const apply = (rule, isImportant) => {
|
|
97
|
+
Object.assign(style, rule.style);
|
|
98
|
+
if (isImportant) Object.assign(importantStyle, rule.style);
|
|
99
|
+
if (rule.lineHeightMultiplier !== void 0) {
|
|
100
|
+
relative = {
|
|
101
|
+
multiplier: rule.lineHeightMultiplier,
|
|
102
|
+
important: isImportant
|
|
103
|
+
};
|
|
104
|
+
delete style.lineHeight;
|
|
105
|
+
if (isImportant) delete importantStyle.lineHeight;
|
|
106
|
+
} else if ("lineHeight" in rule.style) relative = void 0;
|
|
107
|
+
if (rule.boxShadowExpression) {
|
|
108
|
+
boxShadow = {
|
|
109
|
+
expression: rule.boxShadowExpression,
|
|
110
|
+
bindings: customProperties,
|
|
111
|
+
important: isImportant
|
|
112
|
+
};
|
|
113
|
+
delete style.boxShadow;
|
|
114
|
+
if (isImportant) delete importantStyle.boxShadow;
|
|
115
|
+
} else if ("boxShadow" in rule.style) boxShadow = void 0;
|
|
116
|
+
if (rule.transformExpression) transform = {
|
|
117
|
+
expression: rule.transformExpression,
|
|
118
|
+
important: isImportant
|
|
119
|
+
};
|
|
120
|
+
else if ("transform" in rule.style) transform = void 0;
|
|
121
|
+
};
|
|
122
|
+
for (const { rule } of normal) apply(rule, false);
|
|
123
|
+
for (const { rule } of important) apply(rule, true);
|
|
124
|
+
if (transform) {
|
|
125
|
+
const computed = (0, _weapp_tailwindcss_postcss_native_runtime.resolveNativeTransform)(transform.expression, customProperties);
|
|
126
|
+
if (!computed) throw new Error(`无法将当前 class 组合的 transform 编译为原生变换:${transform.expression.value}`);
|
|
127
|
+
style.transform = computed;
|
|
128
|
+
if (transform.important) importantStyle.transform = computed;
|
|
129
|
+
}
|
|
130
|
+
if (boxShadow) {
|
|
131
|
+
boxShadow.color = typeof style.color === "string" ? style.color : environment.color;
|
|
132
|
+
boxShadow.importantColor = typeof importantStyle.color === "string" ? importantStyle.color : void 0;
|
|
133
|
+
const computed = deferredBoxShadowStyle(boxShadow);
|
|
134
|
+
if (computed) {
|
|
135
|
+
Object.assign(style, computed);
|
|
136
|
+
if (boxShadow.important) Object.assign(importantStyle, computed);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (relative) {
|
|
140
|
+
relative.fontSize = typeof style.fontSize === "number" ? style.fontSize : environment.fontSize;
|
|
141
|
+
relative.importantFontSize = typeof importantStyle.fontSize === "number" ? importantStyle.fontSize : void 0;
|
|
142
|
+
const computed = relativeLineHeightStyle(relative);
|
|
143
|
+
if (computed) {
|
|
144
|
+
Object.assign(style, computed);
|
|
145
|
+
if (relative.important) Object.assign(importantStyle, computed);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const normalIds = normal.map((item) => item.id);
|
|
149
|
+
const importantIds = important.map((item) => item.id);
|
|
150
|
+
const asStyleValue = (ids, fallback) => {
|
|
151
|
+
if (relative || boxShadow || transform) return fallback;
|
|
152
|
+
if (!nativeStyleSheet) return fallback;
|
|
153
|
+
const values = ids.map((id) => nativeStyleSheet[id]).filter((value) => value !== void 0);
|
|
154
|
+
if (values.length === 1) return values[0];
|
|
155
|
+
if (values.length > 1) return values;
|
|
156
|
+
return fallback;
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
style,
|
|
160
|
+
importantStyle,
|
|
161
|
+
styleValue: asStyleValue([...normalIds, ...importantIds], style),
|
|
162
|
+
importantValue: asStyleValue(importantIds, importantStyle),
|
|
163
|
+
relativeLineHeight: relative,
|
|
164
|
+
boxShadow
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
// src/runtime.ts
|
|
168
|
+
let activeEnvironment = {};
|
|
169
|
+
let styleSheetFactory;
|
|
170
|
+
let styleSheetFlattener;
|
|
171
|
+
let styleSheetRevision = 0;
|
|
172
|
+
function resolveRegisteredStyle(value) {
|
|
173
|
+
const resolved = styleSheetFlattener?.(value);
|
|
174
|
+
return resolved && typeof resolved === "object" && !Array.isArray(resolved) ? resolved : void 0;
|
|
175
|
+
}
|
|
176
|
+
function createStyleSheet(manifest) {
|
|
177
|
+
const revision = styleSheetRevision;
|
|
178
|
+
const factory = styleSheetFactory;
|
|
179
|
+
const source = manifest.styleSheet ?? Object.fromEntries(Object.entries(manifest.styleEntries ?? {}).map(([id, rule]) => [id, rule.style]));
|
|
180
|
+
return {
|
|
181
|
+
revision,
|
|
182
|
+
styles: factory?.(JSON.parse(JSON.stringify(source)))
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function flatten(value, result) {
|
|
186
|
+
if (!value) return;
|
|
187
|
+
if (typeof value === "string") {
|
|
188
|
+
result.push(...value.split(/\s+/).filter(Boolean));
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (Array.isArray(value)) {
|
|
192
|
+
for (const item of value) flatten(item, result);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
for (const [className, enabled] of Object.entries(value)) if (enabled) result.push(className);
|
|
196
|
+
}
|
|
197
|
+
function canonicalTokens(value) {
|
|
198
|
+
const tokens = [];
|
|
199
|
+
flatten(value, tokens);
|
|
200
|
+
return [...new Set(tokens)].sort();
|
|
201
|
+
}
|
|
202
|
+
function resolveDynamic(value, manifest, environment, nativeStyleSheet) {
|
|
203
|
+
const classNames = canonicalTokens(value);
|
|
204
|
+
return resolveRules(manifest?.staticLookup ? classNames.flatMap((className) => manifest.staticLookup?.[className] ?? []) : classNames, manifest, environment, nativeStyleSheet);
|
|
205
|
+
}
|
|
206
|
+
function rememberStyle(styleMetadata, style, importantStyle, relativeLineHeight, boxShadow) {
|
|
207
|
+
const important = importantStyle && (typeof importantStyle !== "object" || Object.keys(importantStyle).length) ? importantStyle : void 0;
|
|
208
|
+
if (important !== void 0 || relativeLineHeight || boxShadow) styleMetadata.set(style, {
|
|
209
|
+
important,
|
|
210
|
+
relativeLineHeight,
|
|
211
|
+
boxShadow
|
|
212
|
+
});
|
|
213
|
+
return style;
|
|
214
|
+
}
|
|
215
|
+
function createNativeStyleRuntime(initialManifest, initialPublication) {
|
|
216
|
+
if (!initialManifest && initialPublication) throw new Error("React Native 发布身份必须绑定 manifest");
|
|
217
|
+
let manifest = initialManifest ? require_manifest.copyManifestSnapshot(initialManifest) : void 0;
|
|
218
|
+
let publication = require_manifest.copyPublication(initialPublication);
|
|
219
|
+
let environment = activeEnvironment;
|
|
220
|
+
const cache = /* @__PURE__ */ new Map();
|
|
221
|
+
const styleMetadata = /* @__PURE__ */ new Map();
|
|
222
|
+
const initial = manifest ? createStyleSheet(manifest) : void 0;
|
|
223
|
+
let nativeStyleSheet = initial?.styles;
|
|
224
|
+
let revision = initial?.revision ?? styleSheetRevision;
|
|
225
|
+
const ensureStyleSheet = () => {
|
|
226
|
+
if (revision !== styleSheetRevision) {
|
|
227
|
+
const prepared = manifest ? createStyleSheet(manifest) : void 0;
|
|
228
|
+
nativeStyleSheet = prepared?.styles;
|
|
229
|
+
revision = prepared?.revision ?? styleSheetRevision;
|
|
230
|
+
cache.clear();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
tw(value, requestedEnvironment = {}) {
|
|
235
|
+
ensureStyleSheet();
|
|
236
|
+
const effectiveEnvironment = {
|
|
237
|
+
...environment,
|
|
238
|
+
...requestedEnvironment
|
|
239
|
+
};
|
|
240
|
+
const key = `${canonicalTokens(value).join("")}|${effectiveEnvironment.colorScheme ?? ""}|${effectiveEnvironment.platform ?? ""}|${effectiveEnvironment.fontSize ?? ""}|${effectiveEnvironment.color ?? ""}`;
|
|
241
|
+
const cached = cache.get(key);
|
|
242
|
+
if (cached) return cached;
|
|
243
|
+
const resolved = resolveDynamic(value, manifest, effectiveEnvironment, nativeStyleSheet);
|
|
244
|
+
const style = rememberStyle(styleMetadata, resolved.styleValue, resolved.importantValue, resolved.relativeLineHeight, resolved.boxShadow);
|
|
245
|
+
cache.set(key, style);
|
|
246
|
+
return style;
|
|
247
|
+
},
|
|
248
|
+
getStaticStyle(ids, requestedEnvironment = {}) {
|
|
249
|
+
ensureStyleSheet();
|
|
250
|
+
const effectiveEnvironment = {
|
|
251
|
+
...environment,
|
|
252
|
+
...requestedEnvironment
|
|
253
|
+
};
|
|
254
|
+
const resolved = resolveRules(ids, manifest, effectiveEnvironment, nativeStyleSheet);
|
|
255
|
+
return rememberStyle(styleMetadata, resolved.styleValue, resolved.importantValue, resolved.relativeLineHeight, resolved.boxShadow);
|
|
256
|
+
},
|
|
257
|
+
composeStyle(tailwindStyle, inlineStyle) {
|
|
258
|
+
const metadata = styleMetadata.get(tailwindStyle);
|
|
259
|
+
const important = metadata?.important;
|
|
260
|
+
const inline = flattenInlineStyle(inlineStyle, resolveRegisteredStyle);
|
|
261
|
+
const relative = relativeLineHeightStyle(metadata?.relativeLineHeight, inline);
|
|
262
|
+
const boxShadow = inlineBoxShadowStyle(metadata?.boxShadow, inline);
|
|
263
|
+
if (relative || boxShadow) return [
|
|
264
|
+
tailwindStyle,
|
|
265
|
+
inlineStyle,
|
|
266
|
+
{
|
|
267
|
+
...flattenInlineStyle(important, resolveRegisteredStyle),
|
|
268
|
+
...relative,
|
|
269
|
+
...boxShadow
|
|
270
|
+
}
|
|
271
|
+
];
|
|
272
|
+
return important !== void 0 ? [
|
|
273
|
+
tailwindStyle,
|
|
274
|
+
inlineStyle,
|
|
275
|
+
important
|
|
276
|
+
] : [tailwindStyle, inlineStyle];
|
|
277
|
+
},
|
|
278
|
+
setManifest(nextManifest, nextPublication) {
|
|
279
|
+
const preparedManifest = require_manifest.copyManifestSnapshot(nextManifest);
|
|
280
|
+
const preparedPublication = require_manifest.copyPublication(nextPublication);
|
|
281
|
+
const preparedStyleSheet = createStyleSheet(preparedManifest);
|
|
282
|
+
manifest = preparedManifest;
|
|
283
|
+
publication = preparedPublication;
|
|
284
|
+
nativeStyleSheet = preparedStyleSheet.styles;
|
|
285
|
+
revision = preparedStyleSheet.revision;
|
|
286
|
+
cache.clear();
|
|
287
|
+
styleMetadata.clear();
|
|
288
|
+
},
|
|
289
|
+
setEnvironment(nextEnvironment) {
|
|
290
|
+
environment = nextEnvironment;
|
|
291
|
+
activeEnvironment = nextEnvironment;
|
|
292
|
+
cache.clear();
|
|
293
|
+
},
|
|
294
|
+
getManifest() {
|
|
295
|
+
return manifest;
|
|
296
|
+
},
|
|
297
|
+
getPublication() {
|
|
298
|
+
return publication;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
const defaultRuntime = createNativeStyleRuntime();
|
|
303
|
+
function setManifest(manifest, publication) {
|
|
304
|
+
defaultRuntime.setManifest(manifest, publication);
|
|
305
|
+
}
|
|
306
|
+
/** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
|
|
307
|
+
function setStyleSheetFactory(factory, flatten) {
|
|
308
|
+
styleSheetFactory = factory;
|
|
309
|
+
styleSheetFlattener = flatten;
|
|
310
|
+
styleSheetRevision += 1;
|
|
311
|
+
}
|
|
312
|
+
function setEnvironment(environment) {
|
|
313
|
+
defaultRuntime.setEnvironment(environment);
|
|
314
|
+
}
|
|
315
|
+
function getManifest() {
|
|
316
|
+
return defaultRuntime.getManifest();
|
|
317
|
+
}
|
|
318
|
+
function getPublication() {
|
|
319
|
+
return defaultRuntime.getPublication();
|
|
320
|
+
}
|
|
321
|
+
function tw(value, environment) {
|
|
322
|
+
return defaultRuntime.tw(value, environment);
|
|
323
|
+
}
|
|
324
|
+
function getStaticStyle(ids, environment) {
|
|
325
|
+
return defaultRuntime.getStaticStyle(ids, environment);
|
|
326
|
+
}
|
|
327
|
+
function composeStyle(tailwindStyle, inlineStyle) {
|
|
328
|
+
return defaultRuntime.composeStyle(tailwindStyle, inlineStyle);
|
|
329
|
+
}
|
|
330
|
+
Object.defineProperty(exports, "composeStyle", {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
get: function() {
|
|
333
|
+
return composeStyle;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(exports, "createNativeStyleRuntime", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
get: function() {
|
|
339
|
+
return createNativeStyleRuntime;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
Object.defineProperty(exports, "getManifest", {
|
|
343
|
+
enumerable: true,
|
|
344
|
+
get: function() {
|
|
345
|
+
return getManifest;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(exports, "getPublication", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function() {
|
|
351
|
+
return getPublication;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(exports, "getStaticStyle", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function() {
|
|
357
|
+
return getStaticStyle;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "setEnvironment", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function() {
|
|
363
|
+
return setEnvironment;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(exports, "setManifest", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function() {
|
|
369
|
+
return setManifest;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
Object.defineProperty(exports, "setStyleSheetFactory", {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function() {
|
|
375
|
+
return setStyleSheetFactory;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
Object.defineProperty(exports, "tw", {
|
|
379
|
+
enumerable: true,
|
|
380
|
+
get: function() {
|
|
381
|
+
return tw;
|
|
382
|
+
}
|
|
383
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.cjs";
|
|
2
|
+
type FalsyStyle = undefined | null | false | '';
|
|
3
|
+
type RegisteredStyle<T> = number & {
|
|
4
|
+
__registeredStyleBrand: T;
|
|
5
|
+
};
|
|
6
|
+
interface RecursiveStyleArray<T> extends Array<T | ReadonlyArray<T> | RecursiveStyleArray<T>> {}
|
|
7
|
+
type StyleRecord = Record<string, unknown>;
|
|
8
|
+
interface NativeStyleEnvironment {
|
|
9
|
+
colorScheme?: 'light' | 'dark' | undefined;
|
|
10
|
+
platform?: NativePlatform | undefined;
|
|
11
|
+
/** 未在当前元素指定字号时,调用方可显式传入已知的继承字号。 */
|
|
12
|
+
fontSize?: number | undefined;
|
|
13
|
+
/** 当前元素没有文字颜色时,调用方可显式提供已知的继承颜色。 */
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
type NativeClassValue = string | false | null | undefined | NativeClassValue[] | Record<string, boolean>;
|
|
17
|
+
type NativeStyleValue = StyleRecord | RegisteredStyle<StyleRecord> | RecursiveStyleArray<StyleRecord | RegisteredStyle<StyleRecord> | FalsyStyle> | FalsyStyle;
|
|
18
|
+
interface NativeStyleRuntime {
|
|
19
|
+
tw: (value: NativeClassValue, environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
20
|
+
getStaticStyle: (ids: readonly string[], environment?: NativeStyleEnvironment) => NativeStyleValue;
|
|
21
|
+
composeStyle: <const InlineStyle>(tailwindStyle: NativeStyleValue, inlineStyle: InlineStyle) => [NativeStyleValue, InlineStyle] | [NativeStyleValue, InlineStyle, NativeStyleValue];
|
|
22
|
+
setManifest: (manifest: NativeStyleManifest, publication?: NativeManifestPublication) => void;
|
|
23
|
+
setEnvironment: (environment: NativeStyleEnvironment) => void;
|
|
24
|
+
getManifest: () => NativeStyleManifest | undefined;
|
|
25
|
+
getPublication: () => NativeManifestPublication | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface StyleValue {
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
type StyleSheetFactory = (value: Record<string, StyleValue>) => Record<string, NativeStyleValue>;
|
|
31
|
+
type StyleSheetFlattener = (value: NativeStyleValue) => unknown;
|
|
32
|
+
declare function createNativeStyleRuntime(initialManifest?: NativeStyleManifest, initialPublication?: NativeManifestPublication): NativeStyleRuntime;
|
|
33
|
+
declare function setManifest(manifest: NativeStyleManifest, publication?: NativeManifestPublication): void;
|
|
34
|
+
/** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
|
|
35
|
+
declare function setStyleSheetFactory(factory: StyleSheetFactory, flatten?: StyleSheetFlattener): void;
|
|
36
|
+
declare function setEnvironment(environment: NativeStyleEnvironment): void;
|
|
37
|
+
declare function getManifest(): NativeStyleManifest | undefined;
|
|
38
|
+
declare function getPublication(): NativeManifestPublication | undefined;
|
|
39
|
+
declare function tw(value: NativeClassValue, environment?: NativeStyleEnvironment): NativeStyleValue;
|
|
40
|
+
declare function getStaticStyle(ids: readonly string[], environment?: NativeStyleEnvironment): NativeStyleValue;
|
|
41
|
+
declare function composeStyle<const InlineStyle>(tailwindStyle: NativeStyleValue, inlineStyle: InlineStyle): [NativeStyleValue, InlineStyle] | [NativeStyleValue, InlineStyle, NativeStyleValue];
|
|
42
|
+
export { getStaticStyle as a, setStyleSheetFactory as c, NativeStyleEnvironment as d, NativeStyleRuntime as f, getPublication as i, tw as l, createNativeStyleRuntime as n, setEnvironment as o, NativeStyleValue as p, getManifest as r, setManifest as s, composeStyle as t, NativeClassValue as u };
|