@barefootjs/go-template 0.10.1 → 0.12.0
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/adapter/go-template-adapter.d.ts +21 -0
- package/dist/adapter/go-template-adapter.d.ts.map +1 -1
- package/dist/adapter/index.js +51 -4
- package/dist/build.js +51 -4
- package/dist/index.js +51 -4
- package/package.json +2 -2
- package/src/__tests__/go-template-adapter.test.ts +14 -21
- package/src/adapter/go-template-adapter.ts +98 -3
|
@@ -77,6 +77,11 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
77
77
|
private inLoop;
|
|
78
78
|
private loopParamStack;
|
|
79
79
|
private loopVarRefCount;
|
|
80
|
+
/** Stack of destructure-param binding maps (binding name → Go accessor on the
|
|
81
|
+
* range var, e.g. `id` → `$__bf_item0.Id`, `rest` → `$__bf_item0`). Innermost last.
|
|
82
|
+
* Lets `.map(({ id, ...rest }) => …)` resolve `id` / `rest.flag` instead of
|
|
83
|
+
* refusing with BF104. (#1310) */
|
|
84
|
+
private loopBindingStack;
|
|
80
85
|
private errors;
|
|
81
86
|
private propsObjectName;
|
|
82
87
|
/**
|
|
@@ -1015,6 +1020,13 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
1015
1020
|
*/
|
|
1016
1021
|
private convertConditionToGo;
|
|
1017
1022
|
private renderConditionExpr;
|
|
1023
|
+
/**
|
|
1024
|
+
* Map each destructure binding to its Go accessor on the range var: a named
|
|
1025
|
+
* binding → `$<rangeVar>.<Field>`, an object-rest binding → the bare
|
|
1026
|
+
* `$<rangeVar>` so the member emitter renders `rest.flag` → `$<rangeVar>.Flag`.
|
|
1027
|
+
* (#1310)
|
|
1028
|
+
*/
|
|
1029
|
+
private buildDestructureBindingMap;
|
|
1018
1030
|
renderLoop(loop: IRLoop): string;
|
|
1019
1031
|
/**
|
|
1020
1032
|
* Per-item `<!--bf-loop-i-->` / `<!--bf-loop-i:KEY-->` start marker emitted
|
|
@@ -1055,6 +1067,15 @@ export declare class GoTemplateAdapter extends BaseAdapter implements ParsedExpr
|
|
|
1055
1067
|
* intrinsic-attribute one.
|
|
1056
1068
|
*/
|
|
1057
1069
|
private readonly elementAttrEmitter;
|
|
1070
|
+
/**
|
|
1071
|
+
* Lower a `style={{ … }}` object-literal value to a CSS string with dynamic
|
|
1072
|
+
* values interpolated as Go template actions, e.g.
|
|
1073
|
+
* `{ backgroundColor: color, padding: '8px' }` →
|
|
1074
|
+
* `background-color:{{.Color}};padding:8px`. Returns null when the object
|
|
1075
|
+
* shape is unsupported or any value expression can't be lowered (the caller
|
|
1076
|
+
* then falls through to the generic BF101 path). (#1322)
|
|
1077
|
+
*/
|
|
1078
|
+
private tryLowerStyleObject;
|
|
1058
1079
|
private renderAttributes;
|
|
1059
1080
|
/**
|
|
1060
1081
|
* Replace `${EXPR}` JS-template-literal interpolations in a static
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAON,UAAU,EAEV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EAehB,MAAM,iBAAiB,CAAA;AAGxB;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACjB,uBAAuB,C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A0B;IAuClC,iBAAiB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAKjD;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvC;IAED,OAAO,CAAC,kBAAkB;CAmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"go-template-adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/go-template-adapter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,YAAY,EACZ,aAAa,EACb,MAAM,EAEN,WAAW,EACX,UAAU,EACV,MAAM,EAON,UAAU,EAEV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,UAAU,EACV,OAAO,EAEP,yBAAyB,EAC1B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,UAAU,EAiBhB,MAAM,iBAAiB,CAAA;AAGxB;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC,CAAA;AA2GD,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAyMD,qBAAa,iBAAkB,SAAQ,WAAY,YAAW,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC;IACzG,IAAI,SAAgB;IACpB,SAAS,SAAU;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AkB;CAmB3B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAA"}
|
package/dist/adapter/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
BaseAdapter,
|
|
28
28
|
isBooleanAttr,
|
|
29
29
|
parseExpression,
|
|
30
|
+
parseStyleObjectEntries,
|
|
30
31
|
isSupported,
|
|
31
32
|
exprToString,
|
|
32
33
|
identifierPath,
|
|
@@ -35,7 +36,8 @@ import {
|
|
|
35
36
|
emitAttrValue,
|
|
36
37
|
augmentInheritedPropAccesses,
|
|
37
38
|
parseRecordIndexAccess,
|
|
38
|
-
collectContextConsumers
|
|
39
|
+
collectContextConsumers,
|
|
40
|
+
isLowerableObjectRestDestructure
|
|
39
41
|
} from "@barefootjs/jsx";
|
|
40
42
|
import { findInterpolationEnd } from "@barefootjs/jsx/scanner";
|
|
41
43
|
function wrapIfMultiToken(rendered) {
|
|
@@ -148,6 +150,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
148
150
|
inLoop = false;
|
|
149
151
|
loopParamStack = [];
|
|
150
152
|
loopVarRefCount = new Map;
|
|
153
|
+
loopBindingStack = [];
|
|
151
154
|
errors = [];
|
|
152
155
|
propsObjectName = null;
|
|
153
156
|
restPropsName = null;
|
|
@@ -2282,6 +2285,11 @@ ${goFields.join(`
|
|
|
2282
2285
|
return emitParsedExpr(expr, this);
|
|
2283
2286
|
}
|
|
2284
2287
|
identifier(name) {
|
|
2288
|
+
for (let i = this.loopBindingStack.length - 1;i >= 0; i--) {
|
|
2289
|
+
const acc = this.loopBindingStack[i].get(name);
|
|
2290
|
+
if (acc !== undefined)
|
|
2291
|
+
return acc;
|
|
2292
|
+
}
|
|
2285
2293
|
const inlined = this.resolveModuleStringConst(name);
|
|
2286
2294
|
if (inlined !== null)
|
|
2287
2295
|
return inlined;
|
|
@@ -3371,11 +3379,24 @@ ${goFields.join(`
|
|
|
3371
3379
|
return plain(expr.raw);
|
|
3372
3380
|
}
|
|
3373
3381
|
}
|
|
3382
|
+
buildDestructureBindingMap(loop, rangeVar) {
|
|
3383
|
+
const m = new Map;
|
|
3384
|
+
for (const b of loop.paramBindings ?? []) {
|
|
3385
|
+
if (b.rest) {
|
|
3386
|
+
m.set(b.name, `$${rangeVar}`);
|
|
3387
|
+
} else {
|
|
3388
|
+
m.set(b.name, `$${rangeVar}.${this.capitalizeFieldName(b.path.slice(1))}`);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
return m;
|
|
3392
|
+
}
|
|
3374
3393
|
renderLoop(loop) {
|
|
3375
3394
|
if (loop.clientOnly) {
|
|
3376
3395
|
return `{{bfComment "loop:${loop.markerId}"}}{{bfComment "/loop:${loop.markerId}"}}`;
|
|
3377
3396
|
}
|
|
3378
|
-
|
|
3397
|
+
const destructure = !!(loop.paramBindings && loop.paramBindings.length > 0);
|
|
3398
|
+
const supportableDestructure = destructure && isLowerableObjectRestDestructure(loop);
|
|
3399
|
+
if (destructure && !supportableDestructure) {
|
|
3379
3400
|
this.errors.push({
|
|
3380
3401
|
code: "BF104",
|
|
3381
3402
|
severity: "error",
|
|
@@ -3393,7 +3414,7 @@ ${goFields.join(`
|
|
|
3393
3414
|
const param = loop.param;
|
|
3394
3415
|
let index = loop.index || "_";
|
|
3395
3416
|
let rangeIndex = index;
|
|
3396
|
-
let rangeValue = param;
|
|
3417
|
+
let rangeValue = supportableDestructure ? `__bf_item${this.loopBindingStack.length}` : param;
|
|
3397
3418
|
if (loop.iterationShape === "keys") {
|
|
3398
3419
|
rangeIndex = param;
|
|
3399
3420
|
rangeValue = "_";
|
|
@@ -3404,7 +3425,16 @@ ${goFields.join(`
|
|
|
3404
3425
|
}
|
|
3405
3426
|
this.inLoop = true;
|
|
3406
3427
|
const addedLoopVars = [];
|
|
3407
|
-
|
|
3428
|
+
let pushedBindingMap = false;
|
|
3429
|
+
if (supportableDestructure) {
|
|
3430
|
+
this.loopBindingStack.push(this.buildDestructureBindingMap(loop, rangeValue));
|
|
3431
|
+
pushedBindingMap = true;
|
|
3432
|
+
this.loopParamStack.push("");
|
|
3433
|
+
if (rangeIndex !== "_") {
|
|
3434
|
+
this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
|
|
3435
|
+
addedLoopVars.push(rangeIndex);
|
|
3436
|
+
}
|
|
3437
|
+
} else if (loop.iterationShape === "keys") {
|
|
3408
3438
|
this.loopParamStack.push("");
|
|
3409
3439
|
this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1);
|
|
3410
3440
|
addedLoopVars.push(param);
|
|
@@ -3425,6 +3455,8 @@ ${goFields.join(`
|
|
|
3425
3455
|
this.loopVarRefCount.set(v, rc);
|
|
3426
3456
|
}
|
|
3427
3457
|
this.loopParamStack.pop();
|
|
3458
|
+
if (pushedBindingMap)
|
|
3459
|
+
this.loopBindingStack.pop();
|
|
3428
3460
|
this.inLoop = false;
|
|
3429
3461
|
if (loop.sortComparator) {
|
|
3430
3462
|
goArray = `(${emitBfSort(goArray, loop.sortComparator)})`;
|
|
@@ -3520,6 +3552,11 @@ ${children}`;
|
|
|
3520
3552
|
elementAttrEmitter = {
|
|
3521
3553
|
emitLiteral: (value, name) => `${name}="${value.value}"`,
|
|
3522
3554
|
emitExpression: (value, name) => {
|
|
3555
|
+
if (name === "style") {
|
|
3556
|
+
const css = this.tryLowerStyleObject(value.expr);
|
|
3557
|
+
if (css !== null)
|
|
3558
|
+
return `style="${css}"`;
|
|
3559
|
+
}
|
|
3523
3560
|
if (isBooleanAttr(name) || value.presenceOrUndefined) {
|
|
3524
3561
|
const { condition: goCond, preamble } = this.convertConditionToGo(value.expr);
|
|
3525
3562
|
return `${preamble}{{if ${goCond}}}${name}{{end}}`;
|
|
@@ -3565,6 +3602,16 @@ ${children}`;
|
|
|
3565
3602
|
emitBooleanShorthand: () => "",
|
|
3566
3603
|
emitJsxChildren: () => ""
|
|
3567
3604
|
};
|
|
3605
|
+
tryLowerStyleObject(expr) {
|
|
3606
|
+
const entries = parseStyleObjectEntries(expr);
|
|
3607
|
+
if (!entries)
|
|
3608
|
+
return null;
|
|
3609
|
+
for (const e of entries) {
|
|
3610
|
+
if (e.kind === "expr" && !isSupported(parseExpression(e.expr)).supported)
|
|
3611
|
+
return null;
|
|
3612
|
+
}
|
|
3613
|
+
return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:{{${this.convertExpressionToGo(e.expr)}}}`).join(";");
|
|
3614
|
+
}
|
|
3568
3615
|
renderAttributes(element) {
|
|
3569
3616
|
const parts = [];
|
|
3570
3617
|
for (const attr of element.attrs) {
|
package/dist/build.js
CHANGED
|
@@ -367,6 +367,7 @@ import {
|
|
|
367
367
|
BaseAdapter,
|
|
368
368
|
isBooleanAttr,
|
|
369
369
|
parseExpression,
|
|
370
|
+
parseStyleObjectEntries,
|
|
370
371
|
isSupported,
|
|
371
372
|
exprToString,
|
|
372
373
|
identifierPath,
|
|
@@ -375,7 +376,8 @@ import {
|
|
|
375
376
|
emitAttrValue,
|
|
376
377
|
augmentInheritedPropAccesses,
|
|
377
378
|
parseRecordIndexAccess,
|
|
378
|
-
collectContextConsumers
|
|
379
|
+
collectContextConsumers,
|
|
380
|
+
isLowerableObjectRestDestructure
|
|
379
381
|
} from "@barefootjs/jsx";
|
|
380
382
|
import { findInterpolationEnd } from "@barefootjs/jsx/scanner";
|
|
381
383
|
function wrapIfMultiToken(rendered) {
|
|
@@ -488,6 +490,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
488
490
|
inLoop = false;
|
|
489
491
|
loopParamStack = [];
|
|
490
492
|
loopVarRefCount = new Map;
|
|
493
|
+
loopBindingStack = [];
|
|
491
494
|
errors = [];
|
|
492
495
|
propsObjectName = null;
|
|
493
496
|
restPropsName = null;
|
|
@@ -2622,6 +2625,11 @@ ${goFields.join(`
|
|
|
2622
2625
|
return emitParsedExpr(expr, this);
|
|
2623
2626
|
}
|
|
2624
2627
|
identifier(name) {
|
|
2628
|
+
for (let i = this.loopBindingStack.length - 1;i >= 0; i--) {
|
|
2629
|
+
const acc = this.loopBindingStack[i].get(name);
|
|
2630
|
+
if (acc !== undefined)
|
|
2631
|
+
return acc;
|
|
2632
|
+
}
|
|
2625
2633
|
const inlined = this.resolveModuleStringConst(name);
|
|
2626
2634
|
if (inlined !== null)
|
|
2627
2635
|
return inlined;
|
|
@@ -3711,11 +3719,24 @@ ${goFields.join(`
|
|
|
3711
3719
|
return plain(expr.raw);
|
|
3712
3720
|
}
|
|
3713
3721
|
}
|
|
3722
|
+
buildDestructureBindingMap(loop, rangeVar) {
|
|
3723
|
+
const m = new Map;
|
|
3724
|
+
for (const b of loop.paramBindings ?? []) {
|
|
3725
|
+
if (b.rest) {
|
|
3726
|
+
m.set(b.name, `$${rangeVar}`);
|
|
3727
|
+
} else {
|
|
3728
|
+
m.set(b.name, `$${rangeVar}.${this.capitalizeFieldName(b.path.slice(1))}`);
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
return m;
|
|
3732
|
+
}
|
|
3714
3733
|
renderLoop(loop) {
|
|
3715
3734
|
if (loop.clientOnly) {
|
|
3716
3735
|
return `{{bfComment "loop:${loop.markerId}"}}{{bfComment "/loop:${loop.markerId}"}}`;
|
|
3717
3736
|
}
|
|
3718
|
-
|
|
3737
|
+
const destructure = !!(loop.paramBindings && loop.paramBindings.length > 0);
|
|
3738
|
+
const supportableDestructure = destructure && isLowerableObjectRestDestructure(loop);
|
|
3739
|
+
if (destructure && !supportableDestructure) {
|
|
3719
3740
|
this.errors.push({
|
|
3720
3741
|
code: "BF104",
|
|
3721
3742
|
severity: "error",
|
|
@@ -3733,7 +3754,7 @@ ${goFields.join(`
|
|
|
3733
3754
|
const param = loop.param;
|
|
3734
3755
|
let index = loop.index || "_";
|
|
3735
3756
|
let rangeIndex = index;
|
|
3736
|
-
let rangeValue = param;
|
|
3757
|
+
let rangeValue = supportableDestructure ? `__bf_item${this.loopBindingStack.length}` : param;
|
|
3737
3758
|
if (loop.iterationShape === "keys") {
|
|
3738
3759
|
rangeIndex = param;
|
|
3739
3760
|
rangeValue = "_";
|
|
@@ -3744,7 +3765,16 @@ ${goFields.join(`
|
|
|
3744
3765
|
}
|
|
3745
3766
|
this.inLoop = true;
|
|
3746
3767
|
const addedLoopVars = [];
|
|
3747
|
-
|
|
3768
|
+
let pushedBindingMap = false;
|
|
3769
|
+
if (supportableDestructure) {
|
|
3770
|
+
this.loopBindingStack.push(this.buildDestructureBindingMap(loop, rangeValue));
|
|
3771
|
+
pushedBindingMap = true;
|
|
3772
|
+
this.loopParamStack.push("");
|
|
3773
|
+
if (rangeIndex !== "_") {
|
|
3774
|
+
this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
|
|
3775
|
+
addedLoopVars.push(rangeIndex);
|
|
3776
|
+
}
|
|
3777
|
+
} else if (loop.iterationShape === "keys") {
|
|
3748
3778
|
this.loopParamStack.push("");
|
|
3749
3779
|
this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1);
|
|
3750
3780
|
addedLoopVars.push(param);
|
|
@@ -3765,6 +3795,8 @@ ${goFields.join(`
|
|
|
3765
3795
|
this.loopVarRefCount.set(v, rc);
|
|
3766
3796
|
}
|
|
3767
3797
|
this.loopParamStack.pop();
|
|
3798
|
+
if (pushedBindingMap)
|
|
3799
|
+
this.loopBindingStack.pop();
|
|
3768
3800
|
this.inLoop = false;
|
|
3769
3801
|
if (loop.sortComparator) {
|
|
3770
3802
|
goArray = `(${emitBfSort(goArray, loop.sortComparator)})`;
|
|
@@ -3860,6 +3892,11 @@ ${children}`;
|
|
|
3860
3892
|
elementAttrEmitter = {
|
|
3861
3893
|
emitLiteral: (value, name) => `${name}="${value.value}"`,
|
|
3862
3894
|
emitExpression: (value, name) => {
|
|
3895
|
+
if (name === "style") {
|
|
3896
|
+
const css = this.tryLowerStyleObject(value.expr);
|
|
3897
|
+
if (css !== null)
|
|
3898
|
+
return `style="${css}"`;
|
|
3899
|
+
}
|
|
3863
3900
|
if (isBooleanAttr(name) || value.presenceOrUndefined) {
|
|
3864
3901
|
const { condition: goCond, preamble } = this.convertConditionToGo(value.expr);
|
|
3865
3902
|
return `${preamble}{{if ${goCond}}}${name}{{end}}`;
|
|
@@ -3905,6 +3942,16 @@ ${children}`;
|
|
|
3905
3942
|
emitBooleanShorthand: () => "",
|
|
3906
3943
|
emitJsxChildren: () => ""
|
|
3907
3944
|
};
|
|
3945
|
+
tryLowerStyleObject(expr) {
|
|
3946
|
+
const entries = parseStyleObjectEntries(expr);
|
|
3947
|
+
if (!entries)
|
|
3948
|
+
return null;
|
|
3949
|
+
for (const e of entries) {
|
|
3950
|
+
if (e.kind === "expr" && !isSupported(parseExpression(e.expr)).supported)
|
|
3951
|
+
return null;
|
|
3952
|
+
}
|
|
3953
|
+
return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:{{${this.convertExpressionToGo(e.expr)}}}`).join(";");
|
|
3954
|
+
}
|
|
3908
3955
|
renderAttributes(element) {
|
|
3909
3956
|
const parts = [];
|
|
3910
3957
|
for (const attr of element.attrs) {
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
BaseAdapter,
|
|
28
28
|
isBooleanAttr,
|
|
29
29
|
parseExpression,
|
|
30
|
+
parseStyleObjectEntries,
|
|
30
31
|
isSupported,
|
|
31
32
|
exprToString,
|
|
32
33
|
identifierPath,
|
|
@@ -35,7 +36,8 @@ import {
|
|
|
35
36
|
emitAttrValue,
|
|
36
37
|
augmentInheritedPropAccesses,
|
|
37
38
|
parseRecordIndexAccess,
|
|
38
|
-
collectContextConsumers
|
|
39
|
+
collectContextConsumers,
|
|
40
|
+
isLowerableObjectRestDestructure
|
|
39
41
|
} from "@barefootjs/jsx";
|
|
40
42
|
import { findInterpolationEnd } from "@barefootjs/jsx/scanner";
|
|
41
43
|
function wrapIfMultiToken(rendered) {
|
|
@@ -148,6 +150,7 @@ class GoTemplateAdapter extends BaseAdapter {
|
|
|
148
150
|
inLoop = false;
|
|
149
151
|
loopParamStack = [];
|
|
150
152
|
loopVarRefCount = new Map;
|
|
153
|
+
loopBindingStack = [];
|
|
151
154
|
errors = [];
|
|
152
155
|
propsObjectName = null;
|
|
153
156
|
restPropsName = null;
|
|
@@ -2282,6 +2285,11 @@ ${goFields.join(`
|
|
|
2282
2285
|
return emitParsedExpr(expr, this);
|
|
2283
2286
|
}
|
|
2284
2287
|
identifier(name) {
|
|
2288
|
+
for (let i = this.loopBindingStack.length - 1;i >= 0; i--) {
|
|
2289
|
+
const acc = this.loopBindingStack[i].get(name);
|
|
2290
|
+
if (acc !== undefined)
|
|
2291
|
+
return acc;
|
|
2292
|
+
}
|
|
2285
2293
|
const inlined = this.resolveModuleStringConst(name);
|
|
2286
2294
|
if (inlined !== null)
|
|
2287
2295
|
return inlined;
|
|
@@ -3371,11 +3379,24 @@ ${goFields.join(`
|
|
|
3371
3379
|
return plain(expr.raw);
|
|
3372
3380
|
}
|
|
3373
3381
|
}
|
|
3382
|
+
buildDestructureBindingMap(loop, rangeVar) {
|
|
3383
|
+
const m = new Map;
|
|
3384
|
+
for (const b of loop.paramBindings ?? []) {
|
|
3385
|
+
if (b.rest) {
|
|
3386
|
+
m.set(b.name, `$${rangeVar}`);
|
|
3387
|
+
} else {
|
|
3388
|
+
m.set(b.name, `$${rangeVar}.${this.capitalizeFieldName(b.path.slice(1))}`);
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
return m;
|
|
3392
|
+
}
|
|
3374
3393
|
renderLoop(loop) {
|
|
3375
3394
|
if (loop.clientOnly) {
|
|
3376
3395
|
return `{{bfComment "loop:${loop.markerId}"}}{{bfComment "/loop:${loop.markerId}"}}`;
|
|
3377
3396
|
}
|
|
3378
|
-
|
|
3397
|
+
const destructure = !!(loop.paramBindings && loop.paramBindings.length > 0);
|
|
3398
|
+
const supportableDestructure = destructure && isLowerableObjectRestDestructure(loop);
|
|
3399
|
+
if (destructure && !supportableDestructure) {
|
|
3379
3400
|
this.errors.push({
|
|
3380
3401
|
code: "BF104",
|
|
3381
3402
|
severity: "error",
|
|
@@ -3393,7 +3414,7 @@ ${goFields.join(`
|
|
|
3393
3414
|
const param = loop.param;
|
|
3394
3415
|
let index = loop.index || "_";
|
|
3395
3416
|
let rangeIndex = index;
|
|
3396
|
-
let rangeValue = param;
|
|
3417
|
+
let rangeValue = supportableDestructure ? `__bf_item${this.loopBindingStack.length}` : param;
|
|
3397
3418
|
if (loop.iterationShape === "keys") {
|
|
3398
3419
|
rangeIndex = param;
|
|
3399
3420
|
rangeValue = "_";
|
|
@@ -3404,7 +3425,16 @@ ${goFields.join(`
|
|
|
3404
3425
|
}
|
|
3405
3426
|
this.inLoop = true;
|
|
3406
3427
|
const addedLoopVars = [];
|
|
3407
|
-
|
|
3428
|
+
let pushedBindingMap = false;
|
|
3429
|
+
if (supportableDestructure) {
|
|
3430
|
+
this.loopBindingStack.push(this.buildDestructureBindingMap(loop, rangeValue));
|
|
3431
|
+
pushedBindingMap = true;
|
|
3432
|
+
this.loopParamStack.push("");
|
|
3433
|
+
if (rangeIndex !== "_") {
|
|
3434
|
+
this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1);
|
|
3435
|
+
addedLoopVars.push(rangeIndex);
|
|
3436
|
+
}
|
|
3437
|
+
} else if (loop.iterationShape === "keys") {
|
|
3408
3438
|
this.loopParamStack.push("");
|
|
3409
3439
|
this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1);
|
|
3410
3440
|
addedLoopVars.push(param);
|
|
@@ -3425,6 +3455,8 @@ ${goFields.join(`
|
|
|
3425
3455
|
this.loopVarRefCount.set(v, rc);
|
|
3426
3456
|
}
|
|
3427
3457
|
this.loopParamStack.pop();
|
|
3458
|
+
if (pushedBindingMap)
|
|
3459
|
+
this.loopBindingStack.pop();
|
|
3428
3460
|
this.inLoop = false;
|
|
3429
3461
|
if (loop.sortComparator) {
|
|
3430
3462
|
goArray = `(${emitBfSort(goArray, loop.sortComparator)})`;
|
|
@@ -3520,6 +3552,11 @@ ${children}`;
|
|
|
3520
3552
|
elementAttrEmitter = {
|
|
3521
3553
|
emitLiteral: (value, name) => `${name}="${value.value}"`,
|
|
3522
3554
|
emitExpression: (value, name) => {
|
|
3555
|
+
if (name === "style") {
|
|
3556
|
+
const css = this.tryLowerStyleObject(value.expr);
|
|
3557
|
+
if (css !== null)
|
|
3558
|
+
return `style="${css}"`;
|
|
3559
|
+
}
|
|
3523
3560
|
if (isBooleanAttr(name) || value.presenceOrUndefined) {
|
|
3524
3561
|
const { condition: goCond, preamble } = this.convertConditionToGo(value.expr);
|
|
3525
3562
|
return `${preamble}{{if ${goCond}}}${name}{{end}}`;
|
|
@@ -3565,6 +3602,16 @@ ${children}`;
|
|
|
3565
3602
|
emitBooleanShorthand: () => "",
|
|
3566
3603
|
emitJsxChildren: () => ""
|
|
3567
3604
|
};
|
|
3605
|
+
tryLowerStyleObject(expr) {
|
|
3606
|
+
const entries = parseStyleObjectEntries(expr);
|
|
3607
|
+
if (!entries)
|
|
3608
|
+
return null;
|
|
3609
|
+
for (const e of entries) {
|
|
3610
|
+
if (e.kind === "expr" && !isSupported(parseExpression(e.expr)).supported)
|
|
3611
|
+
return null;
|
|
3612
|
+
}
|
|
3613
|
+
return entries.map((e) => e.kind === "literal" ? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}` : `${this.escapeAttrText(e.cssKey)}:{{${this.convertExpressionToGo(e.expr)}}}`).join(";");
|
|
3614
|
+
}
|
|
3568
3615
|
renderAttributes(element) {
|
|
3569
3616
|
const parts = [];
|
|
3570
3617
|
for (const attr of element.attrs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barefootjs/go-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Go html/template adapter for BarefootJS - generates Go template files from IR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@barefootjs/adapter-tests": "0.1.0",
|
|
57
|
-
"@barefootjs/jsx": "0.
|
|
57
|
+
"@barefootjs/jsx": "0.12.0"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -44,10 +44,10 @@ runAdapterConformanceTests({
|
|
|
44
44
|
// any cross-adapter file — every adapter declares its own
|
|
45
45
|
// refusal set against the canonical fixture corpus.
|
|
46
46
|
expectedDiagnostics: {
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
|
|
47
|
+
// `style-object-dynamic` / `style-3-signals` no longer pinned — a
|
|
48
|
+
// `style={{ … }}` object literal now lowers to a CSS string with dynamic
|
|
49
|
+
// values interpolated (`background-color:{{.Color}};padding:8px`) via
|
|
50
|
+
// `tryLowerStyleObject` (#1322).
|
|
51
51
|
// Sibling-imported child component inside a loop body: the adapter
|
|
52
52
|
// emits `{{template "X" .}}` which only resolves if the user has
|
|
53
53
|
// compiled the sibling file and registered the template on the
|
|
@@ -71,27 +71,20 @@ runAdapterConformanceTests({
|
|
|
71
71
|
{ code: 'BF103', severity: 'error' },
|
|
72
72
|
{ code: 'BF104', severity: 'error' },
|
|
73
73
|
],
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// attribute position can't lower into Go template syntax, so the
|
|
77
|
-
// adapter surfaces BF101 instead of emitting invalid template.
|
|
78
|
-
'style-3-signals': [{ code: 'BF101', severity: 'error' }],
|
|
74
|
+
// (`style-3-signals` graduated alongside `style-object-dynamic` — see note
|
|
75
|
+
// above; the `style={{ … }}` object now lowers to a CSS string.)
|
|
79
76
|
// #1244 stress catalog: tagged-template-literal callees
|
|
80
77
|
// (`cn\`base \${tone()}\``) likewise can't lower into Go template
|
|
81
78
|
// syntax — same BF101 refusal.
|
|
82
79
|
'tagged-template-classname': [{ code: 'BF101', severity: 'error' }],
|
|
83
|
-
// #1310: rest destructure in .map() callback.
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
'rest-destructure-object-in-map': [{ code: 'BF104', severity: 'error' }],
|
|
92
|
-
// #1244 catalog: rest spread back onto the root element. Same
|
|
93
|
-
// refusal shape as the read-only variant above — `paramBindings`
|
|
94
|
-
// is non-empty so BF104 fires regardless of how `rest` is used.
|
|
80
|
+
// #1310: rest destructure in .map() callback. The object-rest shape read
|
|
81
|
+
// via member access (`rest-destructure-object-in-map`) now lowers — each
|
|
82
|
+
// binding resolves to a field on a synthetic `$__bf_item0` range var (the
|
|
83
|
+
// reserved `__bf_item` name, depth-suffixed) and `rest.flag` →
|
|
84
|
+
// `$__bf_item0.Flag` (`destructureBindingsSupportable`). The
|
|
85
|
+
// other three stay refused: rest SPREAD (`{...rest}`) needs a residual
|
|
86
|
+
// object, and array-index / nested paths (`[a, ...t]`, `{ cells: [h] }`)
|
|
87
|
+
// need index/slice machinery Go's `{{range}}` can't express inline.
|
|
95
88
|
'rest-destructure-object-spread-in-map': [{ code: 'BF104', severity: 'error' }],
|
|
96
89
|
'rest-destructure-array-in-map': [{ code: 'BF104', severity: 'error' }],
|
|
97
90
|
'rest-destructure-nested-in-map': [{ code: 'BF104', severity: 'error' }],
|
|
@@ -52,6 +52,7 @@ import {
|
|
|
52
52
|
type SupportResult,
|
|
53
53
|
isBooleanAttr,
|
|
54
54
|
parseExpression,
|
|
55
|
+
parseStyleObjectEntries,
|
|
55
56
|
isSupported,
|
|
56
57
|
exprToString,
|
|
57
58
|
identifierPath,
|
|
@@ -61,6 +62,7 @@ import {
|
|
|
61
62
|
augmentInheritedPropAccesses,
|
|
62
63
|
parseRecordIndexAccess,
|
|
63
64
|
collectContextConsumers,
|
|
65
|
+
isLowerableObjectRestDestructure,
|
|
64
66
|
type ContextConsumer,
|
|
65
67
|
} from '@barefootjs/jsx'
|
|
66
68
|
import { findInterpolationEnd } from '@barefootjs/jsx/scanner'
|
|
@@ -467,6 +469,11 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
467
469
|
private inLoop: boolean = false
|
|
468
470
|
private loopParamStack: string[] = []
|
|
469
471
|
private loopVarRefCount: Map<string, number> = new Map()
|
|
472
|
+
/** Stack of destructure-param binding maps (binding name → Go accessor on the
|
|
473
|
+
* range var, e.g. `id` → `$__bf_item0.Id`, `rest` → `$__bf_item0`). Innermost last.
|
|
474
|
+
* Lets `.map(({ id, ...rest }) => …)` resolve `id` / `rest.flag` instead of
|
|
475
|
+
* refusing with BF104. (#1310) */
|
|
476
|
+
private loopBindingStack: Array<Map<string, string>> = []
|
|
470
477
|
private errors: CompilerError[] = []
|
|
471
478
|
private propsObjectName: string | null = null
|
|
472
479
|
/**
|
|
@@ -3884,6 +3891,14 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
3884
3891
|
// Module pure-string const (e.g. `const baseClasses = '...'` used in a
|
|
3885
3892
|
// className template literal): inline the literal value rather than
|
|
3886
3893
|
// emit `{{.BaseClasses}}` against a Props field that never exists.
|
|
3894
|
+
// Destructure-param bindings (`.map(({ id, ...rest }) => …)`): resolve the
|
|
3895
|
+
// binding name to its accessor on the range var. Innermost loop wins, and
|
|
3896
|
+
// this runs *before* module-const inlining so a binding whose name collides
|
|
3897
|
+
// with a module string const still resolves to the loop item. (#1310)
|
|
3898
|
+
for (let i = this.loopBindingStack.length - 1; i >= 0; i--) {
|
|
3899
|
+
const acc = this.loopBindingStack[i].get(name)
|
|
3900
|
+
if (acc !== undefined) return acc
|
|
3901
|
+
}
|
|
3887
3902
|
const inlined = this.resolveModuleStringConst(name)
|
|
3888
3903
|
if (inlined !== null) return inlined
|
|
3889
3904
|
const currentLoopParam = this.loopParamStack[this.loopParamStack.length - 1]
|
|
@@ -5599,6 +5614,24 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5599
5614
|
}
|
|
5600
5615
|
}
|
|
5601
5616
|
|
|
5617
|
+
/**
|
|
5618
|
+
* Map each destructure binding to its Go accessor on the range var: a named
|
|
5619
|
+
* binding → `$<rangeVar>.<Field>`, an object-rest binding → the bare
|
|
5620
|
+
* `$<rangeVar>` so the member emitter renders `rest.flag` → `$<rangeVar>.Flag`.
|
|
5621
|
+
* (#1310)
|
|
5622
|
+
*/
|
|
5623
|
+
private buildDestructureBindingMap(loop: IRLoop, rangeVar: string): Map<string, string> {
|
|
5624
|
+
const m = new Map<string, string>()
|
|
5625
|
+
for (const b of loop.paramBindings ?? []) {
|
|
5626
|
+
if (b.rest) {
|
|
5627
|
+
m.set(b.name, `$${rangeVar}`)
|
|
5628
|
+
} else {
|
|
5629
|
+
m.set(b.name, `$${rangeVar}.${this.capitalizeFieldName(b.path.slice(1))}`)
|
|
5630
|
+
}
|
|
5631
|
+
}
|
|
5632
|
+
return m
|
|
5633
|
+
}
|
|
5634
|
+
|
|
5602
5635
|
renderLoop(loop: IRLoop): string {
|
|
5603
5636
|
// clientOnly loops: emit SSR markers so client can insert DOM nodes.
|
|
5604
5637
|
// The marker id disambiguates sibling `.map()` calls under the same parent (#1087).
|
|
@@ -5620,7 +5653,15 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5620
5653
|
// iff the param is a destructure pattern (array or object); a
|
|
5621
5654
|
// simple identifier leaves it `undefined`. The structured check is
|
|
5622
5655
|
// robust to whitespace / formatting variants in the source.
|
|
5623
|
-
|
|
5656
|
+
// A destructure loop param is lowerable only for the object-rest /
|
|
5657
|
+
// simple-field shape (`.map(({ id, title, ...rest }) => …)`, where `rest`
|
|
5658
|
+
// is read via member access): each binding resolves to a field on a named
|
|
5659
|
+
// range var (`$__bf_item0.Id`, and `rest.flag` → `$__bf_item0.Flag`). Array-index
|
|
5660
|
+
// / nested / rest-spread shapes (`[a, ...t]`, `{ cells: [h] }`, `{...rest}`)
|
|
5661
|
+
// still need machinery Go's `{{range}}` can't express inline → BF104. (#1310)
|
|
5662
|
+
const destructure = !!(loop.paramBindings && loop.paramBindings.length > 0)
|
|
5663
|
+
const supportableDestructure = destructure && isLowerableObjectRestDestructure(loop)
|
|
5664
|
+
if (destructure && !supportableDestructure) {
|
|
5624
5665
|
this.errors.push({
|
|
5625
5666
|
code: 'BF104',
|
|
5626
5667
|
severity: 'error',
|
|
@@ -5644,7 +5685,14 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5644
5685
|
// the value. Swap into the Go range's first binding slot so
|
|
5645
5686
|
// `{{range $k, $_ := .Arr}}` makes `$k` the 0-based index.
|
|
5646
5687
|
let rangeIndex = index
|
|
5647
|
-
|
|
5688
|
+
// A supported destructure param can't be the Go range var verbatim
|
|
5689
|
+
// (`$__bf_itemN` is a synthetic single name; bindings resolve against it via
|
|
5690
|
+
// `loopBindingStack`); otherwise the value var is the param itself. The
|
|
5691
|
+
// reserved `__bf_item` prefix avoids colliding with a user binding, and the
|
|
5692
|
+
// nesting-depth suffix keeps an inner destructure loop from shadowing an
|
|
5693
|
+
// outer one's range var (a binding referenced across levels keeps resolving
|
|
5694
|
+
// against its own item).
|
|
5695
|
+
let rangeValue = supportableDestructure ? `__bf_item${this.loopBindingStack.length}` : param
|
|
5648
5696
|
if (loop.iterationShape === 'keys') {
|
|
5649
5697
|
rangeIndex = param
|
|
5650
5698
|
rangeValue = '_'
|
|
@@ -5672,7 +5720,18 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5672
5720
|
// same index var name don't clobber the outer loop's entry on
|
|
5673
5721
|
// cleanup.
|
|
5674
5722
|
const addedLoopVars: string[] = []
|
|
5675
|
-
|
|
5723
|
+
let pushedBindingMap = false
|
|
5724
|
+
if (supportableDestructure) {
|
|
5725
|
+
// Bindings resolve against the synthetic `$__bf_item` range var; don't push
|
|
5726
|
+
// a loop param (the param is a pattern, not a name).
|
|
5727
|
+
this.loopBindingStack.push(this.buildDestructureBindingMap(loop, rangeValue))
|
|
5728
|
+
pushedBindingMap = true
|
|
5729
|
+
this.loopParamStack.push('')
|
|
5730
|
+
if (rangeIndex !== '_') {
|
|
5731
|
+
this.loopVarRefCount.set(rangeIndex, (this.loopVarRefCount.get(rangeIndex) ?? 0) + 1)
|
|
5732
|
+
addedLoopVars.push(rangeIndex)
|
|
5733
|
+
}
|
|
5734
|
+
} else if (loop.iterationShape === 'keys') {
|
|
5676
5735
|
this.loopParamStack.push('')
|
|
5677
5736
|
this.loopVarRefCount.set(param, (this.loopVarRefCount.get(param) ?? 0) + 1)
|
|
5678
5737
|
addedLoopVars.push(param)
|
|
@@ -5695,6 +5754,7 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5695
5754
|
else this.loopVarRefCount.set(v, rc)
|
|
5696
5755
|
}
|
|
5697
5756
|
this.loopParamStack.pop()
|
|
5757
|
+
if (pushedBindingMap) this.loopBindingStack.pop()
|
|
5698
5758
|
this.inLoop = false
|
|
5699
5759
|
|
|
5700
5760
|
// Apply sort if present: wrap array with bf_sort pipeline. The
|
|
@@ -5880,6 +5940,12 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5880
5940
|
private readonly elementAttrEmitter: AttrValueEmitter = {
|
|
5881
5941
|
emitLiteral: (value, name) => `${name}="${value.value}"`,
|
|
5882
5942
|
emitExpression: (value, name) => {
|
|
5943
|
+
// `style={{ … }}` object literal → a CSS string with dynamic values
|
|
5944
|
+
// interpolated, instead of refusing the bare object with BF101.
|
|
5945
|
+
if (name === 'style') {
|
|
5946
|
+
const css = this.tryLowerStyleObject(value.expr)
|
|
5947
|
+
if (css !== null) return `style="${css}"`
|
|
5948
|
+
}
|
|
5883
5949
|
if (isBooleanAttr(name) || value.presenceOrUndefined) {
|
|
5884
5950
|
const { condition: goCond, preamble } = this.convertConditionToGo(value.expr)
|
|
5885
5951
|
return `${preamble}{{if ${goCond}}}${name}{{end}}`
|
|
@@ -5974,6 +6040,35 @@ export class GoTemplateAdapter extends BaseAdapter implements ParsedExprEmitter,
|
|
|
5974
6040
|
emitJsxChildren: () => '',
|
|
5975
6041
|
}
|
|
5976
6042
|
|
|
6043
|
+
/**
|
|
6044
|
+
* Lower a `style={{ … }}` object-literal value to a CSS string with dynamic
|
|
6045
|
+
* values interpolated as Go template actions, e.g.
|
|
6046
|
+
* `{ backgroundColor: color, padding: '8px' }` →
|
|
6047
|
+
* `background-color:{{.Color}};padding:8px`. Returns null when the object
|
|
6048
|
+
* shape is unsupported or any value expression can't be lowered (the caller
|
|
6049
|
+
* then falls through to the generic BF101 path). (#1322)
|
|
6050
|
+
*/
|
|
6051
|
+
private tryLowerStyleObject(expr: string): string | null {
|
|
6052
|
+
const entries = parseStyleObjectEntries(expr)
|
|
6053
|
+
if (!entries) return null
|
|
6054
|
+
// Pre-check every dynamic value so an unsupported one bails the whole
|
|
6055
|
+
// object (rather than recording a partial BF101 mid-build).
|
|
6056
|
+
for (const e of entries) {
|
|
6057
|
+
if (e.kind === 'expr' && !isSupported(parseExpression(e.expr)).supported) return null
|
|
6058
|
+
}
|
|
6059
|
+
// The static CSS key + literal value are inlined into a double-quoted
|
|
6060
|
+
// `style="..."` attribute, so HTML-attr escape them (a value like `'"'`
|
|
6061
|
+
// would otherwise terminate the attribute / inject markup). The dynamic
|
|
6062
|
+
// arm's `{{…}}` action is escaped by `html/template`'s attribute context.
|
|
6063
|
+
return entries
|
|
6064
|
+
.map(e =>
|
|
6065
|
+
e.kind === 'literal'
|
|
6066
|
+
? `${this.escapeAttrText(e.cssKey)}:${this.escapeAttrText(e.value)}`
|
|
6067
|
+
: `${this.escapeAttrText(e.cssKey)}:{{${this.convertExpressionToGo(e.expr)}}}`,
|
|
6068
|
+
)
|
|
6069
|
+
.join(';')
|
|
6070
|
+
}
|
|
6071
|
+
|
|
5977
6072
|
private renderAttributes(element: IRElement): string {
|
|
5978
6073
|
const parts: string[] = []
|
|
5979
6074
|
|