@weapp-tailwindcss/react-native 0.3.4 → 0.3.5

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.
Files changed (38) hide show
  1. package/README.md +14 -0
  2. package/README.zh-CN.md +14 -0
  3. package/dist/babel.cjs +2 -3
  4. package/dist/babel.d.ts +1 -2
  5. package/dist/babel.js +1 -2
  6. package/dist/compiler.cjs +12 -2
  7. package/dist/compiler.d.ts +1 -3
  8. package/dist/compiler.js +13 -3
  9. package/dist/env.d.ts +1 -3
  10. package/dist/index.cjs +7 -3
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +4 -4
  13. package/dist/manifest-DRxbQp2v.cjs +47 -0
  14. package/dist/manifest-DuhmZ2T9.js +24 -0
  15. package/dist/{metro-BZbdIyTH.js → metro-OMh6z1jy.js} +216 -97
  16. package/dist/metro-ahmChgsA.d.ts +63 -0
  17. package/dist/{metro-Ds2ZUc6_.cjs → metro-kaKzXOAU.cjs} +238 -101
  18. package/dist/metro-transformer.cjs +5 -11
  19. package/dist/metro-transformer.d.ts +1 -3
  20. package/dist/metro-transformer.js +4 -10
  21. package/dist/metro.cjs +4 -1
  22. package/dist/metro.d.ts +2 -53
  23. package/dist/metro.js +1 -2
  24. package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
  25. package/dist/runtime-BivP43Uy.cjs +382 -0
  26. package/dist/{runtime-B3hAisFx.d.ts → runtime-Bm9mAKDC.d.ts} +13 -10
  27. package/dist/runtime-BzHdtM5_.js +329 -0
  28. package/dist/runtime.cjs +10 -186
  29. package/dist/runtime.d.ts +3 -3
  30. package/dist/runtime.js +1 -179
  31. package/dist/tailwind-4T0v_pRK.d.ts +13 -0
  32. package/dist/tailwind-B1Gl9P_t.js +121 -0
  33. package/dist/tailwind-CVspvWID.cjs +129 -0
  34. package/dist/tailwind.cjs +2 -58
  35. package/dist/tailwind.d.ts +2 -16
  36. package/dist/tailwind.js +1 -55
  37. package/dist/{types-CKAFTXX9.d.ts → types-CxNMLBiF.d.ts} +6 -3
  38. package/package.json +9 -8
@@ -0,0 +1,329 @@
1
+ import { n as copyPublication, t as copyManifestSnapshot } from "./manifest-DuhmZ2T9.js";
2
+ import { resolveNativeBoxShadow, resolveNativeTransform } from "@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 = resolveNativeBoxShadow(context.expression, context.bindings, color);
42
+ if (computed) return { boxShadow: computed };
43
+ if (!color && 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 = 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
+ return styleSheetFlattener?.(value);
174
+ }
175
+ function createStyleSheet(manifest) {
176
+ const revision = styleSheetRevision;
177
+ const factory = styleSheetFactory;
178
+ const source = manifest.styleSheet ?? Object.fromEntries(Object.entries(manifest.styleEntries ?? {}).map(([id, rule]) => [id, rule.style]));
179
+ return {
180
+ revision,
181
+ styles: factory?.(JSON.parse(JSON.stringify(source)))
182
+ };
183
+ }
184
+ function flatten(value, result) {
185
+ if (!value) return;
186
+ if (typeof value === "string") {
187
+ result.push(...value.split(/\s+/).filter(Boolean));
188
+ return;
189
+ }
190
+ if (Array.isArray(value)) {
191
+ for (const item of value) flatten(item, result);
192
+ return;
193
+ }
194
+ for (const [className, enabled] of Object.entries(value)) if (enabled) result.push(className);
195
+ }
196
+ function canonicalTokens(value) {
197
+ const tokens = [];
198
+ flatten(value, tokens);
199
+ return [...new Set(tokens)].sort();
200
+ }
201
+ function resolveDynamic(value, manifest, environment, nativeStyleSheet) {
202
+ const classNames = canonicalTokens(value);
203
+ return resolveRules(manifest?.staticLookup ? classNames.flatMap((className) => manifest.staticLookup?.[className] ?? []) : classNames, manifest, environment, nativeStyleSheet);
204
+ }
205
+ function rememberStyle(styleMetadata, style, importantStyle, relativeLineHeight, boxShadow) {
206
+ const important = importantStyle && (typeof importantStyle !== "object" || Object.keys(importantStyle).length) ? importantStyle : void 0;
207
+ if (important !== void 0 || relativeLineHeight || boxShadow) styleMetadata.set(style, {
208
+ important,
209
+ relativeLineHeight,
210
+ boxShadow
211
+ });
212
+ return style;
213
+ }
214
+ function createNativeStyleRuntime(initialManifest, initialPublication) {
215
+ if (!initialManifest && initialPublication) throw new Error("React Native 发布身份必须绑定 manifest");
216
+ let manifest = initialManifest ? copyManifestSnapshot(initialManifest) : void 0;
217
+ let publication = copyPublication(initialPublication);
218
+ let environment = activeEnvironment;
219
+ const cache = /* @__PURE__ */ new Map();
220
+ const styleMetadata = /* @__PURE__ */ new Map();
221
+ const initial = manifest ? createStyleSheet(manifest) : void 0;
222
+ let nativeStyleSheet = initial?.styles;
223
+ let revision = initial?.revision ?? styleSheetRevision;
224
+ const ensureStyleSheet = () => {
225
+ if (revision !== styleSheetRevision) {
226
+ const prepared = manifest ? createStyleSheet(manifest) : void 0;
227
+ nativeStyleSheet = prepared?.styles;
228
+ revision = prepared?.revision ?? styleSheetRevision;
229
+ cache.clear();
230
+ }
231
+ };
232
+ return {
233
+ tw(value, requestedEnvironment = {}) {
234
+ ensureStyleSheet();
235
+ const effectiveEnvironment = {
236
+ ...environment,
237
+ ...requestedEnvironment
238
+ };
239
+ const key = `${canonicalTokens(value).join("")}|${effectiveEnvironment.colorScheme ?? ""}|${effectiveEnvironment.platform ?? ""}|${effectiveEnvironment.fontSize ?? ""}|${effectiveEnvironment.color ?? ""}`;
240
+ const cached = cache.get(key);
241
+ if (cached) return cached;
242
+ const resolved = resolveDynamic(value, manifest, effectiveEnvironment, nativeStyleSheet);
243
+ const style = rememberStyle(styleMetadata, resolved.styleValue, resolved.importantValue, resolved.relativeLineHeight, resolved.boxShadow);
244
+ cache.set(key, style);
245
+ return style;
246
+ },
247
+ getStaticStyle(ids, requestedEnvironment = {}) {
248
+ ensureStyleSheet();
249
+ const effectiveEnvironment = {
250
+ ...environment,
251
+ ...requestedEnvironment
252
+ };
253
+ const resolved = resolveRules(ids, manifest, effectiveEnvironment, nativeStyleSheet);
254
+ return rememberStyle(styleMetadata, resolved.styleValue, resolved.importantValue, resolved.relativeLineHeight, resolved.boxShadow);
255
+ },
256
+ composeStyle(tailwindStyle, inlineStyle) {
257
+ const metadata = styleMetadata.get(tailwindStyle);
258
+ const important = metadata?.important;
259
+ const inline = flattenInlineStyle(inlineStyle, resolveRegisteredStyle);
260
+ const relative = relativeLineHeightStyle(metadata?.relativeLineHeight, inline);
261
+ const boxShadow = inlineBoxShadowStyle(metadata?.boxShadow, inline);
262
+ if (relative || boxShadow) return [
263
+ tailwindStyle,
264
+ inlineStyle,
265
+ {
266
+ ...flattenInlineStyle(important, resolveRegisteredStyle),
267
+ ...relative,
268
+ ...boxShadow
269
+ }
270
+ ];
271
+ return important !== void 0 ? [
272
+ tailwindStyle,
273
+ inlineStyle,
274
+ important
275
+ ] : [tailwindStyle, inlineStyle];
276
+ },
277
+ setManifest(nextManifest, nextPublication) {
278
+ const preparedManifest = copyManifestSnapshot(nextManifest);
279
+ const preparedPublication = copyPublication(nextPublication);
280
+ const preparedStyleSheet = createStyleSheet(preparedManifest);
281
+ manifest = preparedManifest;
282
+ publication = preparedPublication;
283
+ nativeStyleSheet = preparedStyleSheet.styles;
284
+ revision = preparedStyleSheet.revision;
285
+ cache.clear();
286
+ styleMetadata.clear();
287
+ },
288
+ setEnvironment(nextEnvironment) {
289
+ environment = nextEnvironment;
290
+ activeEnvironment = nextEnvironment;
291
+ cache.clear();
292
+ },
293
+ getManifest() {
294
+ return manifest;
295
+ },
296
+ getPublication() {
297
+ return publication;
298
+ }
299
+ };
300
+ }
301
+ const defaultRuntime = createNativeStyleRuntime();
302
+ function setManifest(manifest, publication) {
303
+ defaultRuntime.setManifest(manifest, publication);
304
+ }
305
+ /** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
306
+ function setStyleSheetFactory(factory, flatten) {
307
+ styleSheetFactory = factory;
308
+ styleSheetFlattener = flatten;
309
+ styleSheetRevision += 1;
310
+ }
311
+ function setEnvironment(environment) {
312
+ defaultRuntime.setEnvironment(environment);
313
+ }
314
+ function getManifest() {
315
+ return defaultRuntime.getManifest();
316
+ }
317
+ function getPublication() {
318
+ return defaultRuntime.getPublication();
319
+ }
320
+ function tw(value, environment) {
321
+ return defaultRuntime.tw(value, environment);
322
+ }
323
+ function getStaticStyle(ids, environment) {
324
+ return defaultRuntime.getStaticStyle(ids, environment);
325
+ }
326
+ function composeStyle(tailwindStyle, inlineStyle) {
327
+ return defaultRuntime.composeStyle(tailwindStyle, inlineStyle);
328
+ }
329
+ export { getStaticStyle as a, setStyleSheetFactory as c, getPublication as i, tw as l, createNativeStyleRuntime as n, setEnvironment as o, getManifest as r, setManifest as s, composeStyle as t };
package/dist/runtime.cjs CHANGED
@@ -1,187 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/runtime.ts
3
- let activeManifest;
4
- let activeEnvironment = {};
5
- const styleMetadata = /* @__PURE__ */ new Map();
6
- let styleSheetFactory;
7
- let nativeStyleSheet = {};
8
- function createStyleSheet(manifest) {
9
- const source = manifest.styleSheet ?? Object.fromEntries(Object.entries(manifest.styleEntries ?? {}).map(([id, rule]) => [id, rule.style]));
10
- nativeStyleSheet = styleSheetFactory?.(source) ?? source;
11
- }
12
- function flatten(value, result) {
13
- if (!value) return;
14
- if (typeof value === "string") {
15
- result.push(...value.split(/\s+/).filter(Boolean));
16
- return;
17
- }
18
- if (Array.isArray(value)) {
19
- for (const item of value) flatten(item, result);
20
- return;
21
- }
22
- for (const [className, enabled] of Object.entries(value)) if (enabled) result.push(className);
23
- }
24
- function canonicalTokens(value) {
25
- const tokens = [];
26
- flatten(value, tokens);
27
- return [...new Set(tokens)].sort();
28
- }
29
- function matches(rule, environment) {
30
- if (rule.colorScheme && rule.colorScheme !== environment.colorScheme) return false;
31
- if (!rule.platform) return true;
32
- if (rule.platform === "native") return environment.platform !== "web";
33
- return rule.platform === environment.platform;
34
- }
35
- function resolveRules(ids, manifest, environment) {
36
- const normal = [];
37
- const important = [];
38
- for (const id of ids) {
39
- const rule = manifest?.styleEntries?.[id];
40
- if (rule) {
41
- if (!matches(rule, environment)) continue;
42
- (rule.important ? important : normal).push({
43
- rule,
44
- id
45
- });
46
- continue;
47
- }
48
- const fallbackIds = manifest?.staticLookup?.[id] ?? [];
49
- if (fallbackIds.length) for (const fallbackId of fallbackIds) {
50
- const fallbackRule = manifest?.styleEntries?.[fallbackId];
51
- if (!fallbackRule || !matches(fallbackRule, environment)) continue;
52
- (fallbackRule.important ? important : normal).push({
53
- rule: fallbackRule,
54
- id: fallbackId
55
- });
56
- }
57
- else for (const fallbackRule of manifest?.rules?.[id] ?? []) {
58
- if (!matches(fallbackRule, environment)) continue;
59
- (fallbackRule.important ? important : normal).push({
60
- rule: fallbackRule,
61
- id
62
- });
63
- }
64
- }
65
- const order = (left, right) => (left.rule.order ?? 0) - (right.rule.order ?? 0);
66
- normal.sort(order);
67
- important.sort(order);
68
- const style = {};
69
- const importantStyle = {};
70
- for (const { rule } of normal) Object.assign(style, rule.style);
71
- for (const { rule } of important) {
72
- Object.assign(style, rule.style);
73
- Object.assign(importantStyle, rule.style);
74
- }
75
- const normalIds = normal.map((item) => item.id);
76
- const importantIds = important.map((item) => item.id);
77
- const asStyleValue = (ids, fallback) => {
78
- if (!styleSheetFactory) return fallback;
79
- const values = ids.map((id) => nativeStyleSheet[id]).filter((value) => value !== void 0);
80
- if (values.length === 1) return values[0];
81
- if (values.length > 1) return values;
82
- return fallback;
83
- };
84
- return {
85
- style,
86
- importantStyle,
87
- styleValue: asStyleValue(normalIds, style),
88
- importantValue: asStyleValue(importantIds, importantStyle)
89
- };
90
- }
91
- function resolveDynamic(value, manifest, environment) {
92
- const classNames = canonicalTokens(value);
93
- return resolveRules(manifest?.staticLookup ? classNames.flatMap((className) => manifest.staticLookup?.[className] ?? []) : classNames, manifest, environment);
94
- }
95
- function rememberStyle(style, importantStyle) {
96
- if (importantStyle && (typeof importantStyle !== "object" || Object.keys(importantStyle).length)) styleMetadata.set(style, { important: importantStyle });
97
- return style;
98
- }
99
- function createNativeStyleRuntime(initialManifest) {
100
- let manifest = initialManifest;
101
- let environment = activeEnvironment;
102
- const cache = /* @__PURE__ */ new Map();
103
- const runtime = {
104
- tw(value, requestedEnvironment = {}) {
105
- const effectiveEnvironment = {
106
- ...environment,
107
- ...requestedEnvironment
108
- };
109
- const key = `${canonicalTokens(value).join("")}|${effectiveEnvironment.colorScheme ?? ""}|${effectiveEnvironment.platform ?? ""}`;
110
- const cached = cache.get(key);
111
- if (cached) return cached;
112
- const resolved = resolveDynamic(value, manifest, effectiveEnvironment);
113
- const style = rememberStyle(resolved.styleValue, resolved.importantValue);
114
- cache.set(key, style);
115
- return style;
116
- },
117
- getStaticStyle(ids, requestedEnvironment = {}) {
118
- const effectiveEnvironment = {
119
- ...environment,
120
- ...requestedEnvironment
121
- };
122
- const resolved = resolveRules(ids, manifest, effectiveEnvironment);
123
- return rememberStyle(resolved.styleValue, resolved.importantValue);
124
- },
125
- composeStyle(tailwindStyle, inlineStyle) {
126
- const important = styleMetadata.get(tailwindStyle)?.important;
127
- return important !== void 0 ? [
128
- tailwindStyle,
129
- inlineStyle,
130
- important
131
- ] : [tailwindStyle, inlineStyle];
132
- },
133
- setManifest(nextManifest) {
134
- manifest = nextManifest;
135
- cache.clear();
136
- styleMetadata.clear();
137
- createStyleSheet(nextManifest);
138
- activeManifest = nextManifest;
139
- },
140
- setEnvironment(nextEnvironment) {
141
- environment = nextEnvironment;
142
- activeEnvironment = nextEnvironment;
143
- cache.clear();
144
- },
145
- getManifest() {
146
- return manifest;
147
- }
148
- };
149
- if (initialManifest) {
150
- createStyleSheet(initialManifest);
151
- activeManifest = initialManifest;
152
- }
153
- return runtime;
154
- }
155
- const defaultRuntime = createNativeStyleRuntime();
156
- function setManifest(manifest) {
157
- defaultRuntime.setManifest(manifest);
158
- }
159
- /** 由 Expo virtual module 注入,避免 runtime 引入 Node-only 的 require shim。 */
160
- function setStyleSheetFactory(factory) {
161
- styleSheetFactory = factory;
162
- if (activeManifest) createStyleSheet(activeManifest);
163
- }
164
- function setEnvironment(environment) {
165
- defaultRuntime.setEnvironment(environment);
166
- }
167
- function getManifest() {
168
- return activeManifest ?? defaultRuntime.getManifest();
169
- }
170
- function tw(value, environment) {
171
- return defaultRuntime.tw(value, environment);
172
- }
173
- function getStaticStyle(ids, environment) {
174
- return defaultRuntime.getStaticStyle(ids, environment);
175
- }
176
- function composeStyle(tailwindStyle, inlineStyle) {
177
- return defaultRuntime.composeStyle(tailwindStyle, inlineStyle);
178
- }
179
- //#endregion
180
- exports.composeStyle = composeStyle;
181
- exports.createNativeStyleRuntime = createNativeStyleRuntime;
182
- exports.getManifest = getManifest;
183
- exports.getStaticStyle = getStaticStyle;
184
- exports.setEnvironment = setEnvironment;
185
- exports.setManifest = setManifest;
186
- exports.setStyleSheetFactory = setStyleSheetFactory;
187
- exports.tw = tw;
2
+ const require_runtime = require("./runtime-BivP43Uy.cjs");
3
+ exports.composeStyle = require_runtime.composeStyle;
4
+ exports.createNativeStyleRuntime = require_runtime.createNativeStyleRuntime;
5
+ exports.getManifest = require_runtime.getManifest;
6
+ exports.getPublication = require_runtime.getPublication;
7
+ exports.getStaticStyle = require_runtime.getStaticStyle;
8
+ exports.setEnvironment = require_runtime.setEnvironment;
9
+ exports.setManifest = require_runtime.setManifest;
10
+ exports.setStyleSheetFactory = require_runtime.setStyleSheetFactory;
11
+ exports.tw = require_runtime.tw;
package/dist/runtime.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { i as NativeStyleManifest, r as NativePlatform } from "./types-CKAFTXX9.js";
2
- import { a as setEnvironment, c as tw, f as NativeStyleValue, i as getStaticStyle, l as NativeClassValue, n as createNativeStyleRuntime, o as setManifest, r as getManifest, s as setStyleSheetFactory, t as composeStyle, u as NativeStyleEnvironment } from "./runtime-B3hAisFx.js";
3
- export { type NativeClassValue, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleValue, composeStyle, createNativeStyleRuntime, getManifest, getStaticStyle, setEnvironment, setManifest, setStyleSheetFactory, tw };
1
+ import { a as NativeStyleManifest, i as NativePlatform, r as NativeManifestPublication } from "./types-CxNMLBiF.js";
2
+ import { a as getStaticStyle, c as setStyleSheetFactory, d as NativeStyleEnvironment, i as getPublication, l as tw, n as createNativeStyleRuntime, o as setEnvironment, p as NativeStyleValue, r as getManifest, s as setManifest, t as composeStyle, u as NativeClassValue } from "./runtime-Bm9mAKDC.js";
3
+ export { type NativeClassValue, type NativeManifestPublication, type NativePlatform, type NativeStyleEnvironment, type NativeStyleManifest, type NativeStyleValue, composeStyle, createNativeStyleRuntime, getManifest, getPublication, getStaticStyle, setEnvironment, setManifest, setStyleSheetFactory, tw };