@jay-framework/compiler-jay-html 0.15.4 → 0.15.5
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.d.cts +123 -1
- package/dist/index.js +177 -22
- package/package.json +9 -9
package/dist/index.d.cts
CHANGED
|
@@ -281,6 +281,128 @@ declare function injectHeadfullFSTemplates(html: string, sourceDir: string, impo
|
|
|
281
281
|
declare function parseJayFile(html: string, filename: string, filePath: string, options: ResolveTsConfigOptions, linkedContractResolver: JayImportResolver, projectRoot: string): Promise<WithValidations<JayHtmlSourceFile>>;
|
|
282
282
|
declare function getJayHtmlImports(html: string): string[];
|
|
283
283
|
|
|
284
|
+
declare const htmlElementTagNameMap: {
|
|
285
|
+
a: string;
|
|
286
|
+
abbr: string;
|
|
287
|
+
address: string;
|
|
288
|
+
applet: string;
|
|
289
|
+
area: string;
|
|
290
|
+
article: string;
|
|
291
|
+
aside: string;
|
|
292
|
+
audio: string;
|
|
293
|
+
b: string;
|
|
294
|
+
base: string;
|
|
295
|
+
basefont: string;
|
|
296
|
+
bdi: string;
|
|
297
|
+
bdo: string;
|
|
298
|
+
blockquote: string;
|
|
299
|
+
body: string;
|
|
300
|
+
br: string;
|
|
301
|
+
button: string;
|
|
302
|
+
canvas: string;
|
|
303
|
+
caption: string;
|
|
304
|
+
cite: string;
|
|
305
|
+
code: string;
|
|
306
|
+
col: string;
|
|
307
|
+
colgroup: string;
|
|
308
|
+
data: string;
|
|
309
|
+
datalist: string;
|
|
310
|
+
dd: string;
|
|
311
|
+
del: string;
|
|
312
|
+
details: string;
|
|
313
|
+
dfn: string;
|
|
314
|
+
dialog: string;
|
|
315
|
+
dir: string;
|
|
316
|
+
div: string;
|
|
317
|
+
dl: string;
|
|
318
|
+
dt: string;
|
|
319
|
+
em: string;
|
|
320
|
+
embed: string;
|
|
321
|
+
fieldset: string;
|
|
322
|
+
figcaption: string;
|
|
323
|
+
figure: string;
|
|
324
|
+
font: string;
|
|
325
|
+
footer: string;
|
|
326
|
+
form: string;
|
|
327
|
+
frame: string;
|
|
328
|
+
frameset: string;
|
|
329
|
+
h1: string;
|
|
330
|
+
h2: string;
|
|
331
|
+
h3: string;
|
|
332
|
+
h4: string;
|
|
333
|
+
h5: string;
|
|
334
|
+
h6: string;
|
|
335
|
+
head: string;
|
|
336
|
+
header: string;
|
|
337
|
+
hgroup: string;
|
|
338
|
+
hr: string;
|
|
339
|
+
html: string;
|
|
340
|
+
i: string;
|
|
341
|
+
iframe: string;
|
|
342
|
+
img: string;
|
|
343
|
+
input: string;
|
|
344
|
+
ins: string;
|
|
345
|
+
kbd: string;
|
|
346
|
+
label: string;
|
|
347
|
+
legend: string;
|
|
348
|
+
li: string;
|
|
349
|
+
link: string;
|
|
350
|
+
main: string;
|
|
351
|
+
map: string;
|
|
352
|
+
mark: string;
|
|
353
|
+
marquee: string;
|
|
354
|
+
menu: string;
|
|
355
|
+
meta: string;
|
|
356
|
+
meter: string;
|
|
357
|
+
nav: string;
|
|
358
|
+
noscript: string;
|
|
359
|
+
object: string;
|
|
360
|
+
ol: string;
|
|
361
|
+
optgroup: string;
|
|
362
|
+
option: string;
|
|
363
|
+
output: string;
|
|
364
|
+
p: string;
|
|
365
|
+
param: string;
|
|
366
|
+
picture: string;
|
|
367
|
+
pre: string;
|
|
368
|
+
progress: string;
|
|
369
|
+
q: string;
|
|
370
|
+
rp: string;
|
|
371
|
+
rt: string;
|
|
372
|
+
ruby: string;
|
|
373
|
+
s: string;
|
|
374
|
+
samp: string;
|
|
375
|
+
script: string;
|
|
376
|
+
section: string;
|
|
377
|
+
select: string;
|
|
378
|
+
slot: string;
|
|
379
|
+
small: string;
|
|
380
|
+
source: string;
|
|
381
|
+
span: string;
|
|
382
|
+
strong: string;
|
|
383
|
+
style: string;
|
|
384
|
+
sub: string;
|
|
385
|
+
summary: string;
|
|
386
|
+
sup: string;
|
|
387
|
+
table: string;
|
|
388
|
+
tbody: string;
|
|
389
|
+
td: string;
|
|
390
|
+
template: string;
|
|
391
|
+
textarea: string;
|
|
392
|
+
tfoot: string;
|
|
393
|
+
th: string;
|
|
394
|
+
thead: string;
|
|
395
|
+
time: string;
|
|
396
|
+
title: string;
|
|
397
|
+
tr: string;
|
|
398
|
+
track: string;
|
|
399
|
+
u: string;
|
|
400
|
+
ul: string;
|
|
401
|
+
var: string;
|
|
402
|
+
video: string;
|
|
403
|
+
wbr: string;
|
|
404
|
+
};
|
|
405
|
+
|
|
284
406
|
declare function generateTypes(types: JayType): string;
|
|
285
407
|
|
|
286
408
|
/**
|
|
@@ -456,4 +578,4 @@ declare function resolveHeadlessInstances(preRenderedJayHtml: string, instanceDa
|
|
|
456
578
|
*/
|
|
457
579
|
declare function hasSlowPhaseProperties(contract: Contract | undefined): boolean;
|
|
458
580
|
|
|
459
|
-
export { type ActionDefinition, type AssignCoordinatesOptions, type AssignCoordinatesResult, type Contract, type ContractImportInfo, type ContractParam, type ContractParamKind, type ContractProp, type ContractResolver, type ContractTag, ContractTagType, type DiscoveredHeadlessInstance, type EnumToImport, type ForEachHeadlessInstance, type HeadlessContractInfo, type HeadlessInstanceDiscoveryResult, type HeadlessInstanceResolvedData, JAY_IMPORT_RESOLVER, type JayContractImportLink, type JayHtmlSourceFile, type JayImportResolver, type PhaseViewStates, type RenderingPhase, type ServerElementOptions, type SlowRenderInput, type SlowRenderOutput, assignCoordinates, assignCoordinatesToJayHtml, buildInstanceCoordinateKey, compileAction, compileContract, contractToAllPhaseViewStates, contractToImportsViewStateAndRefs, contractToPhaseViewState, createPhaseContract, defaultContractResolver, discoverHeadlessInstances, filterTagsByPhase, generateElementBridgeFile, generateElementDefinitionFile, generateElementFile, generateElementFileReactTarget, generateElementHydrateFile, generateSandboxRootFile, generateServerElementFile, generateTypes, getEffectivePhase, getJayHtmlImports, getLinkedContractDir, hasSlowPhaseProperties, injectHeadfullFSTemplates, isTagInPhase, loadLinkedContract, parseAction, parseContract, parseEnumValues, parseIsEnum, parseJayFile, renderRefsType, resolveHeadlessInstances, slowRenderTransform, validateContractPhases };
|
|
581
|
+
export { type ActionDefinition, type AssignCoordinatesOptions, type AssignCoordinatesResult, type Contract, type ContractImportInfo, type ContractParam, type ContractParamKind, type ContractProp, type ContractResolver, type ContractTag, ContractTagType, type DiscoveredHeadlessInstance, type EnumToImport, type ForEachHeadlessInstance, type HeadlessContractInfo, type HeadlessInstanceDiscoveryResult, type HeadlessInstanceResolvedData, JAY_IMPORT_RESOLVER, type JayContractImportLink, type JayHtmlSourceFile, type JayImportResolver, type PhaseViewStates, type RenderingPhase, type ServerElementOptions, type SlowRenderInput, type SlowRenderOutput, assignCoordinates, assignCoordinatesToJayHtml, buildInstanceCoordinateKey, compileAction, compileContract, contractToAllPhaseViewStates, contractToImportsViewStateAndRefs, contractToPhaseViewState, createPhaseContract, defaultContractResolver, discoverHeadlessInstances, filterTagsByPhase, generateElementBridgeFile, generateElementDefinitionFile, generateElementFile, generateElementFileReactTarget, generateElementHydrateFile, generateSandboxRootFile, generateServerElementFile, generateTypes, getEffectivePhase, getJayHtmlImports, getLinkedContractDir, hasSlowPhaseProperties, htmlElementTagNameMap, injectHeadfullFSTemplates, isTagInPhase, loadLinkedContract, parseAction, parseContract, parseEnumValues, parseIsEnum, parseJayFile, renderRefsType, resolveHeadlessInstances, slowRenderTransform, validateContractPhases };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JayImportedType, isObjectType as isObjectType$1, isImportedType, isRecursiveType, JayUnknown, RenderFragment, Imports, Import, WithValidations, isArrayType as isArrayType$1, isAtomicType, isPromiseType, isEnumType, hasRefs, GenerateTarget, JayTypeAlias, JayUnionType, mkRefsTree, JayComponentType, JayHTMLType, mkRef, equalJayTypes, getModeFileExtension, RuntimeMode, nestRefs, mergeRefsTrees, SourceFileFormat, JayObjectType, JayArrayType, JayPromiseType, resolvePrimitiveType,
|
|
1
|
+
import { JayImportedType, isObjectType as isObjectType$1, isImportedType, isRecursiveType, JayUnknown, RenderFragment, Imports, Import, WithValidations, isArrayType as isArrayType$1, isAtomicType, isPromiseType, isEnumType, hasRefs, GenerateTarget, JayTypeAlias, JayUnionType, mkRefsTree, JayComponentType, JayHTMLType, mkRef, equalJayTypes, getModeFileExtension, RuntimeMode, nestRefs, mergeRefsTrees, SourceFileFormat, JayEnumType, JayObjectType, JayArrayType, JayPromiseType, resolvePrimitiveType, JayRecursiveType, JAY_CONTRACT_EXTENSION as JAY_CONTRACT_EXTENSION$1, ImportsFor, JAY_FULLSTACK_COMPONENTS, computeInstanceKey, JayErrorType, isStaticCoordinate, compileCoordinateExpr, JayOptionalType, JayRecordType, isOptionalType, isRecordType, resolvePluginComponent, resolvePluginManifest } from "@jay-framework/compiler-shared";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { getLogger } from "@jay-framework/logger";
|
|
4
4
|
import fs from "fs/promises";
|
|
@@ -6727,7 +6727,12 @@ function peg$parse(input, options) {
|
|
|
6727
6727
|
}, peg$c137 = function(head, oper, val) {
|
|
6728
6728
|
if (oper.length === 2)
|
|
6729
6729
|
oper = oper + "=";
|
|
6730
|
-
|
|
6730
|
+
const enumName = head.resolvedType.alias || head.resolvedType.name;
|
|
6731
|
+
const fragment = head.render().map((_) => `${_} ${oper} ${enumName}.${val}`);
|
|
6732
|
+
if (head.resolvedType.values && !head.resolvedType.values.includes(val)) {
|
|
6733
|
+
fragment.validations = [...fragment.validations, `Unknown enum value "${val}" for type ${head.resolvedType.name}. Valid values: ${head.resolvedType.values.join(", ")}`];
|
|
6734
|
+
}
|
|
6735
|
+
return fragment;
|
|
6731
6736
|
}, peg$c138 = function() {
|
|
6732
6737
|
return vars.resolveAccessor(["."]);
|
|
6733
6738
|
}, peg$c139 = function(head, tail) {
|
|
@@ -17733,6 +17738,46 @@ function resolveImportedType(imports, type2) {
|
|
|
17733
17738
|
} else
|
|
17734
17739
|
return JayUnknown;
|
|
17735
17740
|
}
|
|
17741
|
+
function deduplicateEnums(enums) {
|
|
17742
|
+
const seen = /* @__PURE__ */ new Set();
|
|
17743
|
+
return enums.filter((e2) => {
|
|
17744
|
+
const key = `${e2.declaringModule}::${e2.type.name}`;
|
|
17745
|
+
if (seen.has(key))
|
|
17746
|
+
return false;
|
|
17747
|
+
seen.add(key);
|
|
17748
|
+
return true;
|
|
17749
|
+
});
|
|
17750
|
+
}
|
|
17751
|
+
function resolveEnumCollisions(allHeadlessImports) {
|
|
17752
|
+
const enumsByName = /* @__PURE__ */ new Map();
|
|
17753
|
+
for (const headless of allHeadlessImports) {
|
|
17754
|
+
for (const link of headless.contractLinks) {
|
|
17755
|
+
for (const importName of link.names) {
|
|
17756
|
+
if (importName.type instanceof JayEnumType) {
|
|
17757
|
+
const entries = enumsByName.get(importName.type.name) || [];
|
|
17758
|
+
entries.push({ importName, module: link.module });
|
|
17759
|
+
enumsByName.set(importName.type.name, entries);
|
|
17760
|
+
}
|
|
17761
|
+
}
|
|
17762
|
+
}
|
|
17763
|
+
}
|
|
17764
|
+
for (const [, entries] of enumsByName) {
|
|
17765
|
+
if (entries.length <= 1)
|
|
17766
|
+
continue;
|
|
17767
|
+
let counter = 0;
|
|
17768
|
+
const firstEntry = entries[0];
|
|
17769
|
+
for (let i = 1; i < entries.length; i++) {
|
|
17770
|
+
const entry = entries[i];
|
|
17771
|
+
const entryEnum = entry.importName.type;
|
|
17772
|
+
if (entry.module === firstEntry.module)
|
|
17773
|
+
continue;
|
|
17774
|
+
counter++;
|
|
17775
|
+
const alias = `${entryEnum.name}$${counter}`;
|
|
17776
|
+
entryEnum.alias = alias;
|
|
17777
|
+
entry.importName.as = alias;
|
|
17778
|
+
}
|
|
17779
|
+
}
|
|
17780
|
+
}
|
|
17736
17781
|
function isRecursiveReference$1(typeString) {
|
|
17737
17782
|
return typeof typeString === "string" && typeString.startsWith("$/");
|
|
17738
17783
|
}
|
|
@@ -18133,8 +18178,10 @@ async function parseHeadlessImports(elements, validations, filePath, importResol
|
|
|
18133
18178
|
...enumsFromContract.map((_) => ({ name: _.name, type: _ }))
|
|
18134
18179
|
]
|
|
18135
18180
|
};
|
|
18136
|
-
const enumsFromOtherContracts =
|
|
18137
|
-
(
|
|
18181
|
+
const enumsFromOtherContracts = deduplicateEnums(
|
|
18182
|
+
enumsToImportRelativeToJayHtml.filter(
|
|
18183
|
+
(_) => _.declaringModule !== relativeContractPath
|
|
18184
|
+
)
|
|
18138
18185
|
);
|
|
18139
18186
|
const enumImportLinks = Object.entries(
|
|
18140
18187
|
enumsFromOtherContracts.reduce(
|
|
@@ -18341,8 +18388,10 @@ async function parseHeadfullFSImports(elements, validations, filePath, importRes
|
|
|
18341
18388
|
...enumsFromContract.map((_) => ({ name: _.name, type: _ }))
|
|
18342
18389
|
]
|
|
18343
18390
|
};
|
|
18344
|
-
const enumsFromOtherContracts =
|
|
18345
|
-
(
|
|
18391
|
+
const enumsFromOtherContracts = deduplicateEnums(
|
|
18392
|
+
enumsToImportRelativeToJayHtml.filter(
|
|
18393
|
+
(_) => _.declaringModule !== relativeContractPath
|
|
18394
|
+
)
|
|
18346
18395
|
);
|
|
18347
18396
|
const enumImportLinks = Object.entries(
|
|
18348
18397
|
enumsFromOtherContracts.reduce(
|
|
@@ -18533,6 +18582,7 @@ async function parseJayFile(html2, filename, filePath, options, linkedContractRe
|
|
|
18533
18582
|
projectRoot
|
|
18534
18583
|
);
|
|
18535
18584
|
const allHeadlessImports = [...headlessImports, ...headfullFSResult.headlessImports];
|
|
18585
|
+
resolveEnumCollisions(allHeadlessImports);
|
|
18536
18586
|
const importNames = headfullImports.flatMap((_) => _.names);
|
|
18537
18587
|
const types2 = await parseTypes(
|
|
18538
18588
|
jayYaml,
|
|
@@ -19487,28 +19537,94 @@ ${context.indent.firstLine} ${createBody})`,
|
|
|
19487
19537
|
insideFastForEach: true,
|
|
19488
19538
|
varMappings: { ...context.varMappings, [trackBy]: trackByExpr }
|
|
19489
19539
|
};
|
|
19490
|
-
const itemContent = mergeHydrateFragments(
|
|
19491
|
-
itemChildNodes.map((child) => renderHydrateNode(child, itemContext)),
|
|
19492
|
-
",\n"
|
|
19493
|
-
);
|
|
19494
19540
|
const itemRenderCtx = buildRenderContext(itemContext);
|
|
19495
19541
|
const itemAttrs = renderDynamicAttributes(element, itemRenderCtx);
|
|
19496
19542
|
const itemHasDynamicAttrs = itemAttrs.imports.has(Import.dynamicAttribute) || itemAttrs.imports.has(Import.dynamicProperty) || itemAttrs.imports.has(Import.booleanAttribute);
|
|
19497
19543
|
const itemRefFragment = renderElementRef$1(element, itemRenderCtx);
|
|
19498
19544
|
const needsItemAdoption = itemHasDynamicAttrs || !!itemRefFragment.rendered.trim();
|
|
19545
|
+
const itemHasInteractiveChildren = itemChildNodes.some(
|
|
19546
|
+
(child) => child.nodeType === NodeType.ELEMENT_NODE && (isConditional(child) && conditionIsInteractive(
|
|
19547
|
+
child.getAttribute("if"),
|
|
19548
|
+
context.interactivePaths
|
|
19549
|
+
) || isForEach(child))
|
|
19550
|
+
);
|
|
19499
19551
|
let adoptBody;
|
|
19500
|
-
|
|
19552
|
+
let itemContent;
|
|
19553
|
+
if (itemHasInteractiveChildren) {
|
|
19554
|
+
const childParts = [];
|
|
19555
|
+
let childImports = Imports.none();
|
|
19556
|
+
const childValidations = [];
|
|
19557
|
+
const childRefs = [];
|
|
19558
|
+
for (const child of itemChildNodes) {
|
|
19559
|
+
if (child.nodeType !== NodeType.ELEMENT_NODE) {
|
|
19560
|
+
const frag = renderHydrateNode(child, itemContext);
|
|
19561
|
+
if (frag.rendered.trim()) {
|
|
19562
|
+
childParts.push(frag.rendered);
|
|
19563
|
+
childImports = childImports.plus(frag.imports);
|
|
19564
|
+
childValidations.push(...frag.validations);
|
|
19565
|
+
if (frag.refs)
|
|
19566
|
+
childRefs.push(frag.refs);
|
|
19567
|
+
}
|
|
19568
|
+
continue;
|
|
19569
|
+
}
|
|
19570
|
+
const htmlChild = child;
|
|
19571
|
+
if (isConditional(htmlChild) && conditionIsInteractive(
|
|
19572
|
+
htmlChild.getAttribute("if"),
|
|
19573
|
+
context.interactivePaths
|
|
19574
|
+
) || isForEach(htmlChild)) {
|
|
19575
|
+
const frag = renderHydrateNode(child, itemContext);
|
|
19576
|
+
if (frag.rendered.trim()) {
|
|
19577
|
+
childParts.push(frag.rendered);
|
|
19578
|
+
childImports = childImports.plus(frag.imports);
|
|
19579
|
+
childValidations.push(...frag.validations);
|
|
19580
|
+
if (frag.refs)
|
|
19581
|
+
childRefs.push(frag.refs);
|
|
19582
|
+
}
|
|
19583
|
+
} else {
|
|
19584
|
+
const frag = renderHydrateNode(child, itemContext);
|
|
19585
|
+
if (frag.rendered.trim()) {
|
|
19586
|
+
childParts.push(frag.rendered);
|
|
19587
|
+
childImports = childImports.plus(frag.imports);
|
|
19588
|
+
childValidations.push(...frag.validations);
|
|
19589
|
+
if (frag.refs)
|
|
19590
|
+
childRefs.push(frag.refs);
|
|
19591
|
+
} else {
|
|
19592
|
+
childParts.push(`${itemContext.indent.firstLine}STATIC`);
|
|
19593
|
+
childImports = childImports.plus(Import.STATIC);
|
|
19594
|
+
}
|
|
19595
|
+
}
|
|
19596
|
+
}
|
|
19501
19597
|
const refSuffix = itemRefFragment.rendered ? `, ${itemRefFragment.rendered}` : "";
|
|
19502
|
-
const childrenArr =
|
|
19503
|
-
${
|
|
19598
|
+
const childrenArr = childParts.length ? `[
|
|
19599
|
+
${childParts.join(",\n")},
|
|
19504
19600
|
${indent.firstLine} ]` : "[]";
|
|
19505
19601
|
adoptBody = `() => [
|
|
19506
|
-
${indent.firstLine}
|
|
19602
|
+
${indent.firstLine} adoptDynamicElement("", ${itemAttrs.rendered}, ${childrenArr}${refSuffix}),
|
|
19507
19603
|
${indent.firstLine} ]`;
|
|
19604
|
+
itemContent = new RenderFragment(
|
|
19605
|
+
"",
|
|
19606
|
+
Imports.for(Import.adoptDynamicElement).plus(childImports),
|
|
19607
|
+
childValidations,
|
|
19608
|
+
mergeRefsTrees(...childRefs)
|
|
19609
|
+
);
|
|
19508
19610
|
} else {
|
|
19509
|
-
|
|
19611
|
+
itemContent = mergeHydrateFragments(
|
|
19612
|
+
itemChildNodes.map((child) => renderHydrateNode(child, itemContext)),
|
|
19613
|
+
",\n"
|
|
19614
|
+
);
|
|
19615
|
+
if (needsItemAdoption) {
|
|
19616
|
+
const refSuffix = itemRefFragment.rendered ? `, ${itemRefFragment.rendered}` : "";
|
|
19617
|
+
const childrenArr = itemContent.rendered.trim() ? `[
|
|
19618
|
+
${itemContent.rendered},
|
|
19619
|
+
${indent.firstLine} ]` : "[]";
|
|
19620
|
+
adoptBody = `() => [
|
|
19621
|
+
${indent.firstLine} adoptElement("", ${itemAttrs.rendered}, ${childrenArr}${refSuffix}),
|
|
19622
|
+
${indent.firstLine} ]`;
|
|
19623
|
+
} else {
|
|
19624
|
+
adoptBody = itemContent.rendered.trim() ? `() => [
|
|
19510
19625
|
${itemContent.rendered},
|
|
19511
19626
|
${indent.firstLine} ]` : "() => []";
|
|
19627
|
+
}
|
|
19512
19628
|
}
|
|
19513
19629
|
const createRenderContext = {
|
|
19514
19630
|
...renderContext,
|
|
@@ -19542,7 +19658,7 @@ ${indent.firstLine} ]` : "() => []";
|
|
|
19542
19658
|
${indent.firstLine} return ${forEachElementFunc}('${element.rawTagName}', ${createAttributes.rendered}, [${createChildren.rendered}]${createRefSuffix});
|
|
19543
19659
|
${indent.firstLine} }`;
|
|
19544
19660
|
let allImports = Imports.for(Import.hydrateForEach).plus(forEachElementImport).plus(forEachFragment.imports).plus(itemContent.imports).plus(createChildren.imports).plus(createAttributes.imports).plus(itemAttrs.imports).plus(itemRefFragment.imports).plus(createItemRef.imports);
|
|
19545
|
-
if (needsItemAdoption) {
|
|
19661
|
+
if (needsItemAdoption && !itemHasInteractiveChildren) {
|
|
19546
19662
|
allImports = allImports.plus(Import.adoptElement);
|
|
19547
19663
|
}
|
|
19548
19664
|
const hydrateForEachFragment = new RenderFragment(
|
|
@@ -21312,10 +21428,8 @@ function generateElementHydrateFile(jayFile, importerMode) {
|
|
|
21312
21428
|
}
|
|
21313
21429
|
const typeOnlyImports = renderedImplementation.imports.minus(renderedHydrate.imports).minus(Import.element).minus(Import.dynamicText).minus(Import.dynamicElement).minus(Import.conditional).minus(Import.forEach);
|
|
21314
21430
|
const hydrateImports = typeOnlyImports.plus(Import.jayElement).plus(renderedHydrate.imports);
|
|
21315
|
-
const cssImport = generateCssImport(jayFile);
|
|
21316
21431
|
const renderedFile = [
|
|
21317
21432
|
renderImports$1(hydrateImports, ImportsFor.implementation, jayFile.imports, importerMode),
|
|
21318
|
-
cssImport,
|
|
21319
21433
|
types2,
|
|
21320
21434
|
renderedRefs,
|
|
21321
21435
|
phaseTypes,
|
|
@@ -22199,8 +22313,22 @@ function renderServerAttributes(element, context) {
|
|
|
22199
22313
|
parts.push(w(indent, `' class="${escaped}"'`));
|
|
22200
22314
|
}
|
|
22201
22315
|
} else if (attrCanonical === "style") {
|
|
22202
|
-
const
|
|
22203
|
-
|
|
22316
|
+
const [fragment, isDynamic] = parseServerTemplateExpression(
|
|
22317
|
+
textEscape$1(attrValue),
|
|
22318
|
+
variables
|
|
22319
|
+
);
|
|
22320
|
+
if (isDynamic) {
|
|
22321
|
+
parts.push(
|
|
22322
|
+
w(
|
|
22323
|
+
indent,
|
|
22324
|
+
`' style="' + escapeAttr(String(${fragment.rendered})) + '"'`,
|
|
22325
|
+
Imports.for(Import.escapeAttr)
|
|
22326
|
+
)
|
|
22327
|
+
);
|
|
22328
|
+
} else {
|
|
22329
|
+
const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
22330
|
+
parts.push(w(indent, `' style="${escaped}"'`));
|
|
22331
|
+
}
|
|
22204
22332
|
} else {
|
|
22205
22333
|
const [fragment, isDynamic] = parseServerTemplateExpression(
|
|
22206
22334
|
textEscape$1(attrValue),
|
|
@@ -22382,8 +22510,21 @@ function renderServerAttributesAsString(element, context) {
|
|
|
22382
22510
|
parts.push(new RenderFragment(`' class="${escaped}"'`));
|
|
22383
22511
|
}
|
|
22384
22512
|
} else if (attrCanonical === "style") {
|
|
22385
|
-
const
|
|
22386
|
-
|
|
22513
|
+
const [fragment, isDynamic] = parseServerTemplateExpression(
|
|
22514
|
+
textEscape$1(attrValue),
|
|
22515
|
+
variables
|
|
22516
|
+
);
|
|
22517
|
+
if (isDynamic) {
|
|
22518
|
+
parts.push(
|
|
22519
|
+
new RenderFragment(
|
|
22520
|
+
`' style="' + escapeAttr(String(${fragment.rendered})) + '"'`,
|
|
22521
|
+
Imports.for(Import.escapeAttr)
|
|
22522
|
+
)
|
|
22523
|
+
);
|
|
22524
|
+
} else {
|
|
22525
|
+
const escaped = attrValue.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
22526
|
+
parts.push(new RenderFragment(`' style="${escaped}"'`));
|
|
22527
|
+
}
|
|
22387
22528
|
} else {
|
|
22388
22529
|
const [fragment, isDynamic] = parseServerTemplateExpression(
|
|
22389
22530
|
textEscape$1(attrValue),
|
|
@@ -22753,6 +22894,13 @@ function resolveStringType(value, importAliases, path2) {
|
|
|
22753
22894
|
const name = path2.length > 0 ? path2[path2.length - 1] : "value";
|
|
22754
22895
|
return new JayEnumType(name, parseEnumValues(value));
|
|
22755
22896
|
}
|
|
22897
|
+
if (value.startsWith("record(") && value.endsWith(")")) {
|
|
22898
|
+
const innerStr = value.slice(7, -1);
|
|
22899
|
+
const innerType = resolveStringType(innerStr, importAliases, path2);
|
|
22900
|
+
if (innerType)
|
|
22901
|
+
return new JayRecordType(innerType);
|
|
22902
|
+
return null;
|
|
22903
|
+
}
|
|
22756
22904
|
if (importAliases.has(value)) {
|
|
22757
22905
|
return new JayImportedType(value, JayUnknown, false);
|
|
22758
22906
|
}
|
|
@@ -22874,6 +23022,8 @@ function collectImportedAliases(type2, aliases2) {
|
|
|
22874
23022
|
}
|
|
22875
23023
|
} else if (isArrayType$1(type2)) {
|
|
22876
23024
|
collectImportedAliases(type2.itemType, aliases2);
|
|
23025
|
+
} else if (isRecordType(type2)) {
|
|
23026
|
+
collectImportedAliases(type2.itemType, aliases2);
|
|
22877
23027
|
}
|
|
22878
23028
|
}
|
|
22879
23029
|
function renderType(type2, aliasToViewState, indent) {
|
|
@@ -22894,6 +23044,10 @@ function renderType(type2, aliasToViewState, indent) {
|
|
|
22894
23044
|
const itemStr = renderType(type2.itemType, aliasToViewState, indent + " ");
|
|
22895
23045
|
return `Array<${itemStr}>`;
|
|
22896
23046
|
}
|
|
23047
|
+
if (isRecordType(type2)) {
|
|
23048
|
+
const valueStr = renderType(type2.itemType, aliasToViewState, indent + " ");
|
|
23049
|
+
return `Record<string, ${valueStr}>`;
|
|
23050
|
+
}
|
|
22897
23051
|
if (isObjectType$1(type2)) {
|
|
22898
23052
|
if (Object.keys(type2.props).length === 0) {
|
|
22899
23053
|
return "Record<string, unknown>";
|
|
@@ -29957,6 +30111,7 @@ export {
|
|
|
29957
30111
|
getJayHtmlImports,
|
|
29958
30112
|
getLinkedContractDir,
|
|
29959
30113
|
hasSlowPhaseProperties,
|
|
30114
|
+
htmlElementTagNameMap,
|
|
29960
30115
|
injectHeadfullFSTemplates,
|
|
29961
30116
|
isTagInPhase,
|
|
29962
30117
|
loadLinkedContract,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/compiler-jay-html",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"author": "",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@jay-framework/compiler-analyze-exported-types": "^0.15.
|
|
38
|
-
"@jay-framework/compiler-shared": "^0.15.
|
|
39
|
-
"@jay-framework/component": "^0.15.
|
|
40
|
-
"@jay-framework/logger": "^0.15.
|
|
41
|
-
"@jay-framework/runtime": "^0.15.
|
|
42
|
-
"@jay-framework/secure": "^0.15.
|
|
37
|
+
"@jay-framework/compiler-analyze-exported-types": "^0.15.5",
|
|
38
|
+
"@jay-framework/compiler-shared": "^0.15.5",
|
|
39
|
+
"@jay-framework/component": "^0.15.5",
|
|
40
|
+
"@jay-framework/logger": "^0.15.5",
|
|
41
|
+
"@jay-framework/runtime": "^0.15.5",
|
|
42
|
+
"@jay-framework/secure": "^0.15.5",
|
|
43
43
|
"@types/js-yaml": "^4.0.9",
|
|
44
44
|
"change-case": "^4.1.2",
|
|
45
45
|
"js-yaml": "^4.1.0",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@caiogondim/strip-margin": "^1.0.0",
|
|
54
|
-
"@jay-framework/4-react": "^0.15.
|
|
55
|
-
"@jay-framework/dev-environment": "^0.15.
|
|
54
|
+
"@jay-framework/4-react": "^0.15.5",
|
|
55
|
+
"@jay-framework/dev-environment": "^0.15.5",
|
|
56
56
|
"@testing-library/jest-dom": "^6.2.0",
|
|
57
57
|
"@types/js-beautify": "^1",
|
|
58
58
|
"@types/node": "^20.11.5",
|