tailwind-styled-v4 5.1.11 → 5.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.mjs +48 -5
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -5
- package/dist/index.mjs.map +1 -1
- package/dist/runtime-css.js +1 -0
- package/dist/runtime-css.mjs +1 -0
- package/dist/runtime.js +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/theme.js +1 -0
- package/dist/theme.mjs +1 -0
- package/package.json +1 -1
- package/dist/metafile-cjs.json +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -1184,8 +1185,49 @@ function wrapWithSubProxy(component, tagLabel) {
|
|
|
1184
1185
|
});
|
|
1185
1186
|
}
|
|
1186
1187
|
|
|
1188
|
+
// packages/domain/core/src/parseTemplateFallback.ts
|
|
1189
|
+
init_cjs_shims();
|
|
1190
|
+
var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
|
|
1191
|
+
var COMMENT_RE = /\/\/[^\n]*/g;
|
|
1192
|
+
function collapseSpaces(s) {
|
|
1193
|
+
return s.replace(/\s+/g, " ").trim();
|
|
1194
|
+
}
|
|
1195
|
+
function cleanBlock(raw) {
|
|
1196
|
+
const noComments = raw.replace(COMMENT_RE, "");
|
|
1197
|
+
const lines = noComments.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
1198
|
+
return collapseSpaces(lines.join(" "));
|
|
1199
|
+
}
|
|
1200
|
+
function parseTemplateJs(raw) {
|
|
1201
|
+
const subs = {};
|
|
1202
|
+
let base = raw;
|
|
1203
|
+
for (const match of raw.matchAll(SUB_RE)) {
|
|
1204
|
+
const fullMatch = match[0];
|
|
1205
|
+
const name = match[1] ?? match[2] ?? "";
|
|
1206
|
+
const innerRaw = match[3] ?? "";
|
|
1207
|
+
if (name) {
|
|
1208
|
+
subs[name] = cleanBlock(innerRaw);
|
|
1209
|
+
}
|
|
1210
|
+
base = base.replace(fullMatch, "");
|
|
1211
|
+
}
|
|
1212
|
+
return {
|
|
1213
|
+
base: cleanBlock(base),
|
|
1214
|
+
subs,
|
|
1215
|
+
hasSubs: Object.keys(subs).length > 0
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1187
1219
|
// packages/domain/core/src/twProxy.ts
|
|
1188
1220
|
var _parsedTemplateCache = /* @__PURE__ */ new Map();
|
|
1221
|
+
var warnedParseTemplateFallback = false;
|
|
1222
|
+
function warnParseTemplateFallbackOnce() {
|
|
1223
|
+
if (warnedParseTemplateFallback) return;
|
|
1224
|
+
warnedParseTemplateFallback = true;
|
|
1225
|
+
if (typeof console !== "undefined") {
|
|
1226
|
+
console.warn(
|
|
1227
|
+
"[tailwind-styled-v4] Native binding 'parseTemplate' tidak tersedia (normal di browser, untuk komponen yang di-chain dengan .extend/.withVariants/.animate/.withSub) \u2014 pakai pure-TS port dari algoritma Rust-nya. Hasil tetap benar; ini cuma informasi, bukan error."
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1189
1231
|
function parseTemplate(strings, exprs) {
|
|
1190
1232
|
const raw = strings.raw.reduce((acc, str, i) => {
|
|
1191
1233
|
const expr = exprs[i];
|
|
@@ -1195,12 +1237,15 @@ function parseTemplate(strings, exprs) {
|
|
|
1195
1237
|
const cached = _parsedTemplateCache.get(raw);
|
|
1196
1238
|
if (cached) return cached;
|
|
1197
1239
|
const binding = getNativeBinding();
|
|
1198
|
-
|
|
1199
|
-
|
|
1240
|
+
let result;
|
|
1241
|
+
if (binding?.parseTemplate) {
|
|
1242
|
+
const r = binding.parseTemplate(raw);
|
|
1243
|
+
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
1244
|
+
result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
1245
|
+
} else {
|
|
1246
|
+
warnParseTemplateFallbackOnce();
|
|
1247
|
+
result = parseTemplateJs(raw);
|
|
1200
1248
|
}
|
|
1201
|
-
const r = binding.parseTemplate(raw);
|
|
1202
|
-
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
1203
|
-
const result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
1204
1249
|
_parsedTemplateCache.set(raw, result);
|
|
1205
1250
|
return result;
|
|
1206
1251
|
}
|