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.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
3
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
4
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
@@ -1118,8 +1119,49 @@ function wrapWithSubProxy(component, tagLabel) {
|
|
|
1118
1119
|
});
|
|
1119
1120
|
}
|
|
1120
1121
|
|
|
1122
|
+
// packages/domain/core/src/parseTemplateFallback.ts
|
|
1123
|
+
init_esm_shims();
|
|
1124
|
+
var SUB_RE = /(?:\[([a-zA-Z][a-zA-Z0-9_-]*)\]|([a-zA-Z][a-zA-Z0-9_-]*))\s*\{([^}]*)\}/g;
|
|
1125
|
+
var COMMENT_RE = /\/\/[^\n]*/g;
|
|
1126
|
+
function collapseSpaces(s) {
|
|
1127
|
+
return s.replace(/\s+/g, " ").trim();
|
|
1128
|
+
}
|
|
1129
|
+
function cleanBlock(raw) {
|
|
1130
|
+
const noComments = raw.replace(COMMENT_RE, "");
|
|
1131
|
+
const lines = noComments.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
|
|
1132
|
+
return collapseSpaces(lines.join(" "));
|
|
1133
|
+
}
|
|
1134
|
+
function parseTemplateJs(raw) {
|
|
1135
|
+
const subs = {};
|
|
1136
|
+
let base = raw;
|
|
1137
|
+
for (const match of raw.matchAll(SUB_RE)) {
|
|
1138
|
+
const fullMatch = match[0];
|
|
1139
|
+
const name = match[1] ?? match[2] ?? "";
|
|
1140
|
+
const innerRaw = match[3] ?? "";
|
|
1141
|
+
if (name) {
|
|
1142
|
+
subs[name] = cleanBlock(innerRaw);
|
|
1143
|
+
}
|
|
1144
|
+
base = base.replace(fullMatch, "");
|
|
1145
|
+
}
|
|
1146
|
+
return {
|
|
1147
|
+
base: cleanBlock(base),
|
|
1148
|
+
subs,
|
|
1149
|
+
hasSubs: Object.keys(subs).length > 0
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1121
1153
|
// packages/domain/core/src/twProxy.ts
|
|
1122
1154
|
var _parsedTemplateCache = /* @__PURE__ */ new Map();
|
|
1155
|
+
var warnedParseTemplateFallback = false;
|
|
1156
|
+
function warnParseTemplateFallbackOnce() {
|
|
1157
|
+
if (warnedParseTemplateFallback) return;
|
|
1158
|
+
warnedParseTemplateFallback = true;
|
|
1159
|
+
if (typeof console !== "undefined") {
|
|
1160
|
+
console.warn(
|
|
1161
|
+
"[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."
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1123
1165
|
function parseTemplate(strings, exprs) {
|
|
1124
1166
|
const raw = strings.raw.reduce((acc, str, i) => {
|
|
1125
1167
|
const expr = exprs[i];
|
|
@@ -1129,12 +1171,15 @@ function parseTemplate(strings, exprs) {
|
|
|
1129
1171
|
const cached = _parsedTemplateCache.get(raw);
|
|
1130
1172
|
if (cached) return cached;
|
|
1131
1173
|
const binding = getNativeBinding();
|
|
1132
|
-
|
|
1133
|
-
|
|
1174
|
+
let result;
|
|
1175
|
+
if (binding?.parseTemplate) {
|
|
1176
|
+
const r = binding.parseTemplate(raw);
|
|
1177
|
+
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
1178
|
+
result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
1179
|
+
} else {
|
|
1180
|
+
warnParseTemplateFallbackOnce();
|
|
1181
|
+
result = parseTemplateJs(raw);
|
|
1134
1182
|
}
|
|
1135
|
-
const r = binding.parseTemplate(raw);
|
|
1136
|
-
const subs = r.hasSubs ? JSON.parse(r.subsJson) : {};
|
|
1137
|
-
const result = { base: r.base, subs, hasSubs: r.hasSubs };
|
|
1138
1183
|
_parsedTemplateCache.set(raw, result);
|
|
1139
1184
|
return result;
|
|
1140
1185
|
}
|