tw-framework 1.0.1 → 1.0.2
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/tw.mjs +63 -4
- package/package.json +1 -1
package/dist/tw.mjs
CHANGED
|
@@ -7596,6 +7596,7 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7596
7596
|
if (token.type === "DOT") {
|
|
7597
7597
|
cursor.advance();
|
|
7598
7598
|
let classVal = "";
|
|
7599
|
+
let prevWasMinus = false;
|
|
7599
7600
|
const classStart = cursor.peek()?.pos;
|
|
7600
7601
|
while (!cursor.done) {
|
|
7601
7602
|
const ct = cursor.peek();
|
|
@@ -7604,8 +7605,12 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7604
7605
|
const after = cursor.peek(1);
|
|
7605
7606
|
if (after && after.type === "COLON") break;
|
|
7606
7607
|
}
|
|
7608
|
+
if (ct.type === "IDENT" && !prevWasMinus && classVal.length > 0 && (CLASS_BOUNDARY_BOOLEAN_ATTRS.has(ct.value) || inlineAttrStartsAt(cursor))) {
|
|
7609
|
+
break;
|
|
7610
|
+
}
|
|
7607
7611
|
if (ct.type === "IDENT" || ct.type === "TEXT" || ct.type === "KEYWORD") {
|
|
7608
7612
|
classVal += ct.value;
|
|
7613
|
+
prevWasMinus = false;
|
|
7609
7614
|
cursor.advance();
|
|
7610
7615
|
} else if (ct.type === "NUMBER") {
|
|
7611
7616
|
classVal += ct.value;
|
|
@@ -7615,6 +7620,7 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7615
7620
|
cursor.advance();
|
|
7616
7621
|
} else if (ct.type === "MINUS") {
|
|
7617
7622
|
classVal += "-";
|
|
7623
|
+
prevWasMinus = true;
|
|
7618
7624
|
cursor.advance();
|
|
7619
7625
|
} else {
|
|
7620
7626
|
break;
|
|
@@ -7623,11 +7629,16 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7623
7629
|
while (!cursor.done && cursor.peek()?.type === "DOT") {
|
|
7624
7630
|
cursor.advance();
|
|
7625
7631
|
let nextClass = "";
|
|
7632
|
+
let nextPrevMinus = false;
|
|
7626
7633
|
while (!cursor.done) {
|
|
7627
7634
|
const ct = cursor.peek();
|
|
7628
7635
|
if (!ct) break;
|
|
7636
|
+
if (ct.type === "IDENT" && !nextPrevMinus && nextClass.length > 0 && (CLASS_BOUNDARY_BOOLEAN_ATTRS.has(ct.value) || inlineAttrStartsAt(cursor))) {
|
|
7637
|
+
break;
|
|
7638
|
+
}
|
|
7629
7639
|
if (ct.type === "IDENT" || ct.type === "TEXT" || ct.type === "KEYWORD") {
|
|
7630
7640
|
nextClass += ct.value;
|
|
7641
|
+
nextPrevMinus = false;
|
|
7631
7642
|
cursor.advance();
|
|
7632
7643
|
} else if (ct.type === "NUMBER") {
|
|
7633
7644
|
nextClass += ct.value;
|
|
@@ -7665,7 +7676,7 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7665
7676
|
const t2 = cursor.peek();
|
|
7666
7677
|
if (!t2) break;
|
|
7667
7678
|
if (t2.type === "LBRACE" || t2.type === "STRING") break;
|
|
7668
|
-
if (t2.type === "IDENT" && VOID_HEAD_TAGS_ATTR.has(t2.value)) {
|
|
7679
|
+
if (t2.type === "IDENT" && VOID_HEAD_TAGS_ATTR.has(t2.value) && (el.voidElement || VOID_HEAD_TAGS_ATTR.has(tag.toLowerCase()))) {
|
|
7669
7680
|
const after = cursor.peek(1);
|
|
7670
7681
|
if (after && (after.type === "IDENT" || after.type === "STRING")) break;
|
|
7671
7682
|
}
|
|
@@ -7734,13 +7745,21 @@ function parseTWSelector(cursor, errors, state, parseBody) {
|
|
|
7734
7745
|
}
|
|
7735
7746
|
if (t2.type === "IDENT" || t2.type === "KEYWORD") {
|
|
7736
7747
|
if (t2.pos.line > tagToken.pos.line) break;
|
|
7737
|
-
|
|
7748
|
+
let attrName = t2.value;
|
|
7738
7749
|
cursor.advance();
|
|
7750
|
+
while (cursor.peek() && cursor.peek().type === "MINUS") {
|
|
7751
|
+
const hyphNext = cursor.peek(1);
|
|
7752
|
+
if (hyphNext && (hyphNext.type === "IDENT" || hyphNext.type === "TEXT" || hyphNext.type === "KEYWORD")) {
|
|
7753
|
+
cursor.advance();
|
|
7754
|
+
cursor.advance();
|
|
7755
|
+
attrName += "-" + hyphNext.value;
|
|
7756
|
+
} else break;
|
|
7757
|
+
}
|
|
7739
7758
|
const vToken = cursor.peek();
|
|
7740
7759
|
if (vToken && (vToken.type === "STRING" || vToken.type === "NUMBER")) {
|
|
7741
7760
|
cursor.advance();
|
|
7742
7761
|
el.attrs.push(createAttribute(attrName, vToken.value, t2.pos.line, t2.pos.col));
|
|
7743
|
-
} else if (vToken && (vToken.type === "IDENT" || vToken.type === "KEYWORD")) {
|
|
7762
|
+
} else if (vToken && (vToken.type === "IDENT" || vToken.type === "KEYWORD") && vToken.pos.line === t2.pos.line) {
|
|
7744
7763
|
cursor.advance();
|
|
7745
7764
|
el.attrs.push(createAttribute(attrName, vToken.value, t2.pos.line, t2.pos.col));
|
|
7746
7765
|
} else {
|
|
@@ -7931,6 +7950,19 @@ function parseTextFromString(cursor) {
|
|
|
7931
7950
|
if (!token) return null;
|
|
7932
7951
|
return createText(token.value, token.pos.line, token.pos.col, false);
|
|
7933
7952
|
}
|
|
7953
|
+
function inlineAttrStartsAt(cursor) {
|
|
7954
|
+
let k = 1;
|
|
7955
|
+
for (; ; ) {
|
|
7956
|
+
const a = cursor.peek(k);
|
|
7957
|
+
if (!a) return false;
|
|
7958
|
+
if (a.type === "STRING") return true;
|
|
7959
|
+
if (a.type === "MINUS") {
|
|
7960
|
+
k += 2;
|
|
7961
|
+
continue;
|
|
7962
|
+
}
|
|
7963
|
+
return false;
|
|
7964
|
+
}
|
|
7965
|
+
}
|
|
7934
7966
|
function parseElement(cursor, errors, state, parseBody) {
|
|
7935
7967
|
const tagToken = cursor.advance();
|
|
7936
7968
|
if (!tagToken) return null;
|
|
@@ -8607,12 +8639,37 @@ function parseBlockBody2(cursor, parseBody) {
|
|
|
8607
8639
|
}
|
|
8608
8640
|
return parseBody(["KEYWORD", "RBRACE"]);
|
|
8609
8641
|
}
|
|
8642
|
+
var CLASS_BOUNDARY_BOOLEAN_ATTRS;
|
|
8610
8643
|
var init_statements = __esm({
|
|
8611
8644
|
"../../packages/compiler/tw/parser/statements/index.ts"() {
|
|
8612
8645
|
init_nodes();
|
|
8613
8646
|
init_recovery();
|
|
8614
8647
|
init_directives();
|
|
8615
8648
|
init_tw();
|
|
8649
|
+
CLASS_BOUNDARY_BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
|
|
8650
|
+
"disabled",
|
|
8651
|
+
"required",
|
|
8652
|
+
"readonly",
|
|
8653
|
+
"checked",
|
|
8654
|
+
"selected",
|
|
8655
|
+
"autofocus",
|
|
8656
|
+
"hidden",
|
|
8657
|
+
"multiple",
|
|
8658
|
+
"muted",
|
|
8659
|
+
"loop",
|
|
8660
|
+
"controls",
|
|
8661
|
+
"defer",
|
|
8662
|
+
"async",
|
|
8663
|
+
"autoplay",
|
|
8664
|
+
"reversed",
|
|
8665
|
+
"open",
|
|
8666
|
+
"inert",
|
|
8667
|
+
"itemscope",
|
|
8668
|
+
"novalidate",
|
|
8669
|
+
"allowfullscreen",
|
|
8670
|
+
"formnovalidate",
|
|
8671
|
+
"playsinline"
|
|
8672
|
+
]);
|
|
8616
8673
|
}
|
|
8617
8674
|
});
|
|
8618
8675
|
|
|
@@ -54439,7 +54496,9 @@ var helpText = `
|
|
|
54439
54496
|
|
|
54440
54497
|
ship [target] Deploy to platform
|
|
54441
54498
|
adapter [name] Generate deployment adapter files (node, bun, docker, vercel)
|
|
54442
|
-
targets: vercel, netlify, cloudflare,
|
|
54499
|
+
targets: node, bun, docker, vercel, netlify, cloudflare,
|
|
54500
|
+
aws, digitalocean, render, railway, fly,
|
|
54501
|
+
github-pages, firebase, nginx, caddy
|
|
54443
54502
|
(default: auto-detect)
|
|
54444
54503
|
|
|
54445
54504
|
plugin <action> Manage plugins
|
package/package.json
CHANGED