@tamagui/tailwind 3.0.0-beta.765.1 → 3.0.0-beta.804.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/candidate.cjs +69 -82
- package/dist/cjs/candidate.native.cjs +74 -86
- package/dist/cjs/candidate.native.js +74 -86
- package/dist/cjs/candidate.native.js.map +1 -1
- package/dist/cjs/frontend.cjs +9 -12
- package/dist/cjs/frontend.native.cjs +10 -13
- package/dist/cjs/frontend.native.js +10 -13
- package/dist/cjs/frontend.native.js.map +1 -1
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.native.cjs +0 -2
- package/dist/cjs/index.native.js +0 -2
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/candidate.mjs +70 -84
- package/dist/esm/candidate.mjs.map +1 -1
- package/dist/esm/candidate.native.js +75 -88
- package/dist/esm/candidate.native.js.map +1 -1
- package/dist/esm/frontend.mjs +10 -13
- package/dist/esm/frontend.mjs.map +1 -1
- package/dist/esm/frontend.native.js +11 -14
- package/dist/esm/frontend.native.js.map +1 -1
- package/dist/esm/index.mjs +1 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -2
- package/dist/esm/index.native.js.map +1 -1
- package/package.json +13 -13
- package/src/candidate.ts +77 -121
- package/src/frontend.ts +10 -21
- package/src/index.tsx +0 -1
- package/src/types.ts +1 -1
- package/types/candidate.d.ts +3 -9
- package/types/candidate.d.ts.map +1 -1
- package/types/frontend.d.ts +2 -2
- package/types/frontend.d.ts.map +1 -1
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/types/types.d.ts +1 -1
- package/types/types.d.ts.map +1 -1
package/dist/cjs/candidate.cjs
CHANGED
|
@@ -21,8 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var candidate_exports = {};
|
|
22
22
|
__export(candidate_exports, {
|
|
23
23
|
getStyleGrammarConfig: () => getStyleGrammarConfig,
|
|
24
|
+
getTailwindClassPlan: () => getTailwindClassPlan,
|
|
24
25
|
isTokenValueProp: () => isTokenValueProp,
|
|
25
|
-
|
|
26
|
+
resolveTailwindClassName: () => resolveTailwindClassName,
|
|
26
27
|
setInAuthoredOrder: () => setInAuthoredOrder
|
|
27
28
|
});
|
|
28
29
|
module.exports = __toCommonJS(candidate_exports);
|
|
@@ -32,9 +33,13 @@ var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
|
32
33
|
const styleGrammarConfigCache = /* @__PURE__ */ new WeakMap();
|
|
33
34
|
function getStyleGrammarConfig(config) {
|
|
34
35
|
const cached = styleGrammarConfigCache.get(config);
|
|
35
|
-
|
|
36
|
+
const revision = config[import_runtime.configRevisionSymbol]?.revision || 0;
|
|
37
|
+
if (cached && cached.revision === revision) return cached.value;
|
|
36
38
|
const view = (0, import_runtime.createGrammarConfigView)(config);
|
|
37
|
-
styleGrammarConfigCache.set(config,
|
|
39
|
+
styleGrammarConfigCache.set(config, {
|
|
40
|
+
revision,
|
|
41
|
+
value: view
|
|
42
|
+
});
|
|
38
43
|
return view;
|
|
39
44
|
}
|
|
40
45
|
function isTokenValueProp(prop) {
|
|
@@ -238,13 +243,17 @@ function createPlanEntry(property, value, modifiers) {
|
|
|
238
243
|
if (modifiers.length === 0) return [property, value];
|
|
239
244
|
const payload = (0, import_internal_runtime.plainValueToPayload)(value, property);
|
|
240
245
|
if (payload === null) return null;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
let condition = "";
|
|
247
|
+
for (let index = 0; index < modifiers.length; index++) {
|
|
248
|
+
if (index) condition += ":";
|
|
249
|
+
condition += modifiers[index];
|
|
250
|
+
}
|
|
251
|
+
return [
|
|
252
|
+
property,
|
|
253
|
+
payload,
|
|
254
|
+
condition,
|
|
255
|
+
modifiers
|
|
256
|
+
];
|
|
248
257
|
}
|
|
249
258
|
function computeClassPlan(cls, grammarConfig) {
|
|
250
259
|
const groupMarker = /^group(?:\/([A-Za-z0-9_-]+))?$/.exec(cls);
|
|
@@ -259,13 +268,9 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
259
268
|
const isSize = containerMarker[1] !== void 0;
|
|
260
269
|
const name = containerMarker[2];
|
|
261
270
|
const entries = [];
|
|
262
|
-
|
|
271
|
+
entries.push(["container", name || true]);
|
|
263
272
|
if (isSize) {
|
|
264
273
|
entries.push(["containerType", "size"]);
|
|
265
|
-
} else if (name) {
|
|
266
|
-
entries.push(["containerType", "inline-size"]);
|
|
267
|
-
} else {
|
|
268
|
-
entries.push(["container", true]);
|
|
269
274
|
}
|
|
270
275
|
return {
|
|
271
276
|
entries,
|
|
@@ -304,81 +309,63 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
304
309
|
}
|
|
305
310
|
return "raw";
|
|
306
311
|
}
|
|
307
|
-
|
|
308
|
-
function setInAuthoredOrder(target, key, value) {
|
|
309
|
-
if (key in target) delete target[key];
|
|
310
|
-
target[key] = value;
|
|
311
|
-
}
|
|
312
|
-
function preprocessTailwindClassName(props, config, preservePassthroughPosition = false) {
|
|
313
|
-
const className = props.className;
|
|
314
|
-
if (!className || typeof className !== "string") {
|
|
315
|
-
return props;
|
|
316
|
-
}
|
|
317
|
-
const classes = className.split(/\s+/).filter(Boolean);
|
|
318
|
-
const result = {};
|
|
312
|
+
function getTailwindClassPlan(candidate, config) {
|
|
319
313
|
const grammarConfig = getStyleGrammarConfig(config);
|
|
320
314
|
const plans = getClassPlanCache(grammarConfig);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
let
|
|
331
|
-
let
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
} else {
|
|
337
|
-
regularClasses.push(cls);
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
const applyEntry = ([key, value]) => {
|
|
341
|
-
if (key === null) {
|
|
342
|
-
result[`__tamagui_frontend_program_${frontendProgramIndex++}`] = value;
|
|
343
|
-
} else {
|
|
344
|
-
setInAuthoredOrder(result, key, value);
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
for (const key in props) {
|
|
348
|
-
if (key !== "className") {
|
|
349
|
-
setInAuthoredOrder(result, key, props[key]);
|
|
315
|
+
let plan = plans.get(candidate);
|
|
316
|
+
if (plan === void 0) {
|
|
317
|
+
plan = computeClassPlan(candidate, grammarConfig);
|
|
318
|
+
plans.set(candidate, plan);
|
|
319
|
+
}
|
|
320
|
+
return plan;
|
|
321
|
+
}
|
|
322
|
+
function resolveTailwindClassName(className, config) {
|
|
323
|
+
const result = {};
|
|
324
|
+
let rawClassName = "";
|
|
325
|
+
let start = 0;
|
|
326
|
+
for (let index = 0; index <= className.length; index++) {
|
|
327
|
+
if (index !== className.length && className.charCodeAt(index) > 32) continue;
|
|
328
|
+
if (start === index) {
|
|
329
|
+
start = index + 1;
|
|
350
330
|
continue;
|
|
351
331
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
if (plan === "raw") {
|
|
363
|
-
preserveRawClass(cls);
|
|
364
|
-
continue;
|
|
332
|
+
const candidate = className.slice(start, index);
|
|
333
|
+
const plan = getTailwindClassPlan(candidate, config);
|
|
334
|
+
if (plan === "raw") {
|
|
335
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
336
|
+
} else if (plan) {
|
|
337
|
+
const parentPlan = plan;
|
|
338
|
+
if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
|
|
339
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
365
340
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
341
|
+
const entries = Array.isArray(plan) ? plan : parentPlan.entries;
|
|
342
|
+
for (let entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
343
|
+
const [key, value, condition] = entries[entryIndex];
|
|
344
|
+
const previous = result[key];
|
|
345
|
+
let next = value;
|
|
346
|
+
if (condition !== void 0) {
|
|
347
|
+
next = previous && typeof previous === "object" && !Array.isArray(previous) ? {
|
|
348
|
+
...previous,
|
|
349
|
+
[condition]: value
|
|
350
|
+
} : previous === void 0 ? { [condition]: value } : {
|
|
351
|
+
default: previous,
|
|
352
|
+
[condition]: value
|
|
353
|
+
};
|
|
354
|
+
} else if (previous && typeof previous === "object" && !Array.isArray(previous)) {
|
|
355
|
+
next = {
|
|
356
|
+
...previous,
|
|
357
|
+
default: value
|
|
358
|
+
};
|
|
369
359
|
}
|
|
370
|
-
|
|
371
|
-
applyEntry(plan.entries[i]);
|
|
372
|
-
}
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
for (let i = 0; i < plan.length; i++) {
|
|
376
|
-
applyEntry(plan[i]);
|
|
360
|
+
setInAuthoredOrder(result, key, next);
|
|
377
361
|
}
|
|
378
362
|
}
|
|
379
|
-
|
|
380
|
-
result.className = regularClasses.join(" ");
|
|
381
|
-
}
|
|
363
|
+
start = index + 1;
|
|
382
364
|
}
|
|
365
|
+
if (rawClassName) result.className = rawClassName;
|
|
383
366
|
return result;
|
|
384
367
|
}
|
|
368
|
+
function setInAuthoredOrder(target, key, value) {
|
|
369
|
+
if (key in target) delete target[key];
|
|
370
|
+
target[key] = value;
|
|
371
|
+
}
|
|
@@ -23,20 +23,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var candidate_exports = {};
|
|
24
24
|
__export(candidate_exports, {
|
|
25
25
|
getStyleGrammarConfig: () => getStyleGrammarConfig,
|
|
26
|
+
getTailwindClassPlan: () => getTailwindClassPlan,
|
|
26
27
|
isTokenValueProp: () => isTokenValueProp,
|
|
27
|
-
|
|
28
|
+
resolveTailwindClassName: () => resolveTailwindClassName,
|
|
28
29
|
setInAuthoredOrder: () => setInAuthoredOrder
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(candidate_exports);
|
|
31
32
|
var import_constants = require("@tamagui/constants");
|
|
32
33
|
var import_internal_runtime = require("@tamagui/core/internal-runtime");
|
|
33
34
|
var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
35
|
+
function _type_of(obj) {
|
|
36
|
+
"@swc/helpers - typeof";
|
|
37
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
38
|
+
}
|
|
34
39
|
var styleGrammarConfigCache = /* @__PURE__ */ new WeakMap();
|
|
35
40
|
function getStyleGrammarConfig(config) {
|
|
41
|
+
var _config_configRevisionSymbol;
|
|
36
42
|
var cached = styleGrammarConfigCache.get(config);
|
|
37
|
-
|
|
43
|
+
var revision = ((_config_configRevisionSymbol = config[import_runtime.configRevisionSymbol]) === null || _config_configRevisionSymbol === void 0 ? void 0 : _config_configRevisionSymbol.revision) || 0;
|
|
44
|
+
if (cached && cached.revision === revision) return cached.value;
|
|
38
45
|
var view = (0, import_runtime.createGrammarConfigView)(config);
|
|
39
|
-
styleGrammarConfigCache.set(config,
|
|
46
|
+
styleGrammarConfigCache.set(config, {
|
|
47
|
+
revision,
|
|
48
|
+
value: view
|
|
49
|
+
});
|
|
40
50
|
return view;
|
|
41
51
|
}
|
|
42
52
|
function isTokenValueProp(prop) {
|
|
@@ -280,13 +290,17 @@ function createPlanEntry(property, value, modifiers) {
|
|
|
280
290
|
if (modifiers.length === 0) return [property, value];
|
|
281
291
|
var payload = (0, import_internal_runtime.plainValueToPayload)(value, property);
|
|
282
292
|
if (payload === null) return null;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
var condition = "";
|
|
294
|
+
for (var index = 0; index < modifiers.length; index++) {
|
|
295
|
+
if (index) condition += ":";
|
|
296
|
+
condition += modifiers[index];
|
|
297
|
+
}
|
|
298
|
+
return [
|
|
299
|
+
property,
|
|
300
|
+
payload,
|
|
301
|
+
condition,
|
|
302
|
+
modifiers
|
|
303
|
+
];
|
|
290
304
|
}
|
|
291
305
|
function computeClassPlan(cls, grammarConfig) {
|
|
292
306
|
var groupMarker = /^group(?:\/([A-Za-z0-9_-]+))?$/.exec(cls);
|
|
@@ -301,13 +315,9 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
301
315
|
var isSize = containerMarker[1] !== void 0;
|
|
302
316
|
var name = containerMarker[2];
|
|
303
317
|
var entries = [];
|
|
304
|
-
|
|
318
|
+
entries.push(["container", name || true]);
|
|
305
319
|
if (isSize) {
|
|
306
320
|
entries.push(["containerType", "size"]);
|
|
307
|
-
} else if (name) {
|
|
308
|
-
entries.push(["containerType", "inline-size"]);
|
|
309
|
-
} else {
|
|
310
|
-
entries.push(["container", true]);
|
|
311
321
|
}
|
|
312
322
|
return {
|
|
313
323
|
entries,
|
|
@@ -346,85 +356,63 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
346
356
|
}
|
|
347
357
|
return "raw";
|
|
348
358
|
}
|
|
349
|
-
|
|
350
|
-
function setInAuthoredOrder(target, key, value) {
|
|
351
|
-
if (key in target) delete target[key];
|
|
352
|
-
target[key] = value;
|
|
353
|
-
}
|
|
354
|
-
function preprocessTailwindClassName(props, config) {
|
|
355
|
-
var preservePassthroughPosition = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
356
|
-
var className = props.className;
|
|
357
|
-
if (!className || typeof className !== "string") {
|
|
358
|
-
return props;
|
|
359
|
-
}
|
|
360
|
-
var classes = className.split(/\s+/).filter(Boolean);
|
|
361
|
-
var result = {};
|
|
359
|
+
function getTailwindClassPlan(candidate, config) {
|
|
362
360
|
var grammarConfig = getStyleGrammarConfig(config);
|
|
363
361
|
var plans = getClassPlanCache(grammarConfig);
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
var
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (hasOwnedStyleCandidate) {
|
|
380
|
-
result[`${import_internal_runtime.STYLE_FRONTEND_PASSTHROUGH_PREFIX}${passthroughIndex++}`] = cls2;
|
|
381
|
-
} else {
|
|
382
|
-
regularClasses.push(cls2);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
var applyEntry = function(param) {
|
|
386
|
-
var [key2, value] = param;
|
|
387
|
-
if (key2 === null) {
|
|
388
|
-
result[`__tamagui_frontend_program_${frontendProgramIndex++}`] = value;
|
|
389
|
-
} else {
|
|
390
|
-
setInAuthoredOrder(result, key2, value);
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
for (var key in props) {
|
|
394
|
-
if (key !== "className") {
|
|
395
|
-
setInAuthoredOrder(result, key, props[key]);
|
|
362
|
+
var plan = plans.get(candidate);
|
|
363
|
+
if (plan === void 0) {
|
|
364
|
+
plan = computeClassPlan(candidate, grammarConfig);
|
|
365
|
+
plans.set(candidate, plan);
|
|
366
|
+
}
|
|
367
|
+
return plan;
|
|
368
|
+
}
|
|
369
|
+
function resolveTailwindClassName(className, config) {
|
|
370
|
+
var result = {};
|
|
371
|
+
var rawClassName = "";
|
|
372
|
+
var start = 0;
|
|
373
|
+
for (var index = 0; index <= className.length; index++) {
|
|
374
|
+
if (index !== className.length && className.charCodeAt(index) > 32) continue;
|
|
375
|
+
if (start === index) {
|
|
376
|
+
start = index + 1;
|
|
396
377
|
continue;
|
|
397
378
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
if (plan === "raw") {
|
|
409
|
-
preserveRawClass(cls);
|
|
410
|
-
continue;
|
|
379
|
+
var candidate = className.slice(start, index);
|
|
380
|
+
var plan = getTailwindClassPlan(candidate, config);
|
|
381
|
+
if (plan === "raw") {
|
|
382
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
383
|
+
} else if (plan) {
|
|
384
|
+
var parentPlan = plan;
|
|
385
|
+
if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
|
|
386
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
411
387
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
388
|
+
var entries = Array.isArray(plan) ? plan : parentPlan.entries;
|
|
389
|
+
for (var entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
390
|
+
var [key, value, condition] = entries[entryIndex];
|
|
391
|
+
var previous = result[key];
|
|
392
|
+
var next = value;
|
|
393
|
+
if (condition !== void 0) {
|
|
394
|
+
next = previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous) ? {
|
|
395
|
+
...previous,
|
|
396
|
+
[condition]: value
|
|
397
|
+
} : previous === void 0 ? { [condition]: value } : {
|
|
398
|
+
default: previous,
|
|
399
|
+
[condition]: value
|
|
400
|
+
};
|
|
401
|
+
} else if (previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous)) {
|
|
402
|
+
next = {
|
|
403
|
+
...previous,
|
|
404
|
+
default: value
|
|
405
|
+
};
|
|
415
406
|
}
|
|
416
|
-
|
|
417
|
-
applyEntry(plan.entries[i]);
|
|
418
|
-
}
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
for (var i1 = 0; i1 < plan.length; i1++) {
|
|
422
|
-
applyEntry(plan[i1]);
|
|
407
|
+
setInAuthoredOrder(result, key, next);
|
|
423
408
|
}
|
|
424
409
|
}
|
|
425
|
-
|
|
426
|
-
result.className = regularClasses.join(" ");
|
|
427
|
-
}
|
|
410
|
+
start = index + 1;
|
|
428
411
|
}
|
|
412
|
+
if (rawClassName) result.className = rawClassName;
|
|
429
413
|
return result;
|
|
430
414
|
}
|
|
415
|
+
function setInAuthoredOrder(target, key, value) {
|
|
416
|
+
if (key in target) delete target[key];
|
|
417
|
+
target[key] = value;
|
|
418
|
+
}
|
|
@@ -23,20 +23,30 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
var candidate_exports = {};
|
|
24
24
|
__export(candidate_exports, {
|
|
25
25
|
getStyleGrammarConfig: () => getStyleGrammarConfig,
|
|
26
|
+
getTailwindClassPlan: () => getTailwindClassPlan,
|
|
26
27
|
isTokenValueProp: () => isTokenValueProp,
|
|
27
|
-
|
|
28
|
+
resolveTailwindClassName: () => resolveTailwindClassName,
|
|
28
29
|
setInAuthoredOrder: () => setInAuthoredOrder
|
|
29
30
|
});
|
|
30
31
|
module.exports = __toCommonJS(candidate_exports);
|
|
31
32
|
var import_constants = require("@tamagui/constants");
|
|
32
33
|
var import_internal_runtime = require("@tamagui/core/internal-runtime");
|
|
33
34
|
var import_runtime = require("@tamagui/style-grammar/runtime");
|
|
35
|
+
function _type_of(obj) {
|
|
36
|
+
"@swc/helpers - typeof";
|
|
37
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
38
|
+
}
|
|
34
39
|
var styleGrammarConfigCache = /* @__PURE__ */ new WeakMap();
|
|
35
40
|
function getStyleGrammarConfig(config) {
|
|
41
|
+
var _config_configRevisionSymbol;
|
|
36
42
|
var cached = styleGrammarConfigCache.get(config);
|
|
37
|
-
|
|
43
|
+
var revision = ((_config_configRevisionSymbol = config[import_runtime.configRevisionSymbol]) === null || _config_configRevisionSymbol === void 0 ? void 0 : _config_configRevisionSymbol.revision) || 0;
|
|
44
|
+
if (cached && cached.revision === revision) return cached.value;
|
|
38
45
|
var view = (0, import_runtime.createGrammarConfigView)(config);
|
|
39
|
-
styleGrammarConfigCache.set(config,
|
|
46
|
+
styleGrammarConfigCache.set(config, {
|
|
47
|
+
revision,
|
|
48
|
+
value: view
|
|
49
|
+
});
|
|
40
50
|
return view;
|
|
41
51
|
}
|
|
42
52
|
function isTokenValueProp(prop) {
|
|
@@ -280,13 +290,17 @@ function createPlanEntry(property, value, modifiers) {
|
|
|
280
290
|
if (modifiers.length === 0) return [property, value];
|
|
281
291
|
var payload = (0, import_internal_runtime.plainValueToPayload)(value, property);
|
|
282
292
|
if (payload === null) return null;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
var condition = "";
|
|
294
|
+
for (var index = 0; index < modifiers.length; index++) {
|
|
295
|
+
if (index) condition += ":";
|
|
296
|
+
condition += modifiers[index];
|
|
297
|
+
}
|
|
298
|
+
return [
|
|
299
|
+
property,
|
|
300
|
+
payload,
|
|
301
|
+
condition,
|
|
302
|
+
modifiers
|
|
303
|
+
];
|
|
290
304
|
}
|
|
291
305
|
function computeClassPlan(cls, grammarConfig) {
|
|
292
306
|
var groupMarker = /^group(?:\/([A-Za-z0-9_-]+))?$/.exec(cls);
|
|
@@ -301,13 +315,9 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
301
315
|
var isSize = containerMarker[1] !== void 0;
|
|
302
316
|
var name = containerMarker[2];
|
|
303
317
|
var entries = [];
|
|
304
|
-
|
|
318
|
+
entries.push(["container", name || true]);
|
|
305
319
|
if (isSize) {
|
|
306
320
|
entries.push(["containerType", "size"]);
|
|
307
|
-
} else if (name) {
|
|
308
|
-
entries.push(["containerType", "inline-size"]);
|
|
309
|
-
} else {
|
|
310
|
-
entries.push(["container", true]);
|
|
311
321
|
}
|
|
312
322
|
return {
|
|
313
323
|
entries,
|
|
@@ -346,87 +356,65 @@ function computeClassPlan(cls, grammarConfig) {
|
|
|
346
356
|
}
|
|
347
357
|
return "raw";
|
|
348
358
|
}
|
|
349
|
-
|
|
350
|
-
function setInAuthoredOrder(target, key, value) {
|
|
351
|
-
if (key in target) delete target[key];
|
|
352
|
-
target[key] = value;
|
|
353
|
-
}
|
|
354
|
-
function preprocessTailwindClassName(props, config) {
|
|
355
|
-
var preservePassthroughPosition = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
356
|
-
var className = props.className;
|
|
357
|
-
if (!className || typeof className !== "string") {
|
|
358
|
-
return props;
|
|
359
|
-
}
|
|
360
|
-
var classes = className.split(/\s+/).filter(Boolean);
|
|
361
|
-
var result = {};
|
|
359
|
+
function getTailwindClassPlan(candidate, config) {
|
|
362
360
|
var grammarConfig = getStyleGrammarConfig(config);
|
|
363
361
|
var plans = getClassPlanCache(grammarConfig);
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
var
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (hasOwnedStyleCandidate) {
|
|
380
|
-
result[`${import_internal_runtime.STYLE_FRONTEND_PASSTHROUGH_PREFIX}${passthroughIndex++}`] = cls2;
|
|
381
|
-
} else {
|
|
382
|
-
regularClasses.push(cls2);
|
|
383
|
-
}
|
|
384
|
-
};
|
|
385
|
-
var applyEntry = function(param) {
|
|
386
|
-
var [key2, value] = param;
|
|
387
|
-
if (key2 === null) {
|
|
388
|
-
result[`__tamagui_frontend_program_${frontendProgramIndex++}`] = value;
|
|
389
|
-
} else {
|
|
390
|
-
setInAuthoredOrder(result, key2, value);
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
for (var key in props) {
|
|
394
|
-
if (key !== "className") {
|
|
395
|
-
setInAuthoredOrder(result, key, props[key]);
|
|
362
|
+
var plan = plans.get(candidate);
|
|
363
|
+
if (plan === void 0) {
|
|
364
|
+
plan = computeClassPlan(candidate, grammarConfig);
|
|
365
|
+
plans.set(candidate, plan);
|
|
366
|
+
}
|
|
367
|
+
return plan;
|
|
368
|
+
}
|
|
369
|
+
function resolveTailwindClassName(className, config) {
|
|
370
|
+
var result = {};
|
|
371
|
+
var rawClassName = "";
|
|
372
|
+
var start = 0;
|
|
373
|
+
for (var index = 0; index <= className.length; index++) {
|
|
374
|
+
if (index !== className.length && className.charCodeAt(index) > 32) continue;
|
|
375
|
+
if (start === index) {
|
|
376
|
+
start = index + 1;
|
|
396
377
|
continue;
|
|
397
378
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
if (plan === "raw") {
|
|
409
|
-
preserveRawClass(cls);
|
|
410
|
-
continue;
|
|
379
|
+
var candidate = className.slice(start, index);
|
|
380
|
+
var plan = getTailwindClassPlan(candidate, config);
|
|
381
|
+
if (plan === "raw") {
|
|
382
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
383
|
+
} else if (plan) {
|
|
384
|
+
var parentPlan = plan;
|
|
385
|
+
if (!Array.isArray(plan) && parentPlan.preserveRawClass) {
|
|
386
|
+
rawClassName = rawClassName ? `${rawClassName} ${candidate}` : candidate;
|
|
411
387
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
388
|
+
var entries = Array.isArray(plan) ? plan : parentPlan.entries;
|
|
389
|
+
for (var entryIndex = 0; entryIndex < entries.length; entryIndex++) {
|
|
390
|
+
var [key, value, condition] = entries[entryIndex];
|
|
391
|
+
var previous = result[key];
|
|
392
|
+
var next = value;
|
|
393
|
+
if (condition !== void 0) {
|
|
394
|
+
next = previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous) ? {
|
|
395
|
+
...previous,
|
|
396
|
+
[condition]: value
|
|
397
|
+
} : previous === void 0 ? { [condition]: value } : {
|
|
398
|
+
default: previous,
|
|
399
|
+
[condition]: value
|
|
400
|
+
};
|
|
401
|
+
} else if (previous && (typeof previous === "undefined" ? "undefined" : _type_of(previous)) === "object" && !Array.isArray(previous)) {
|
|
402
|
+
next = {
|
|
403
|
+
...previous,
|
|
404
|
+
default: value
|
|
405
|
+
};
|
|
415
406
|
}
|
|
416
|
-
|
|
417
|
-
applyEntry(plan.entries[i]);
|
|
418
|
-
}
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
for (var i1 = 0; i1 < plan.length; i1++) {
|
|
422
|
-
applyEntry(plan[i1]);
|
|
407
|
+
setInAuthoredOrder(result, key, next);
|
|
423
408
|
}
|
|
424
409
|
}
|
|
425
|
-
|
|
426
|
-
result.className = regularClasses.join(" ");
|
|
427
|
-
}
|
|
410
|
+
start = index + 1;
|
|
428
411
|
}
|
|
412
|
+
if (rawClassName) result.className = rawClassName;
|
|
429
413
|
return result;
|
|
430
414
|
}
|
|
415
|
+
function setInAuthoredOrder(target, key, value) {
|
|
416
|
+
if (key in target) delete target[key];
|
|
417
|
+
target[key] = value;
|
|
418
|
+
}
|
|
431
419
|
|
|
432
420
|
//# sourceMappingURL=candidate.native.js.map
|