@jay-framework/compiler-jay-html 0.15.4 → 0.15.6

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.
Files changed (3) hide show
  1. package/dist/index.d.cts +152 -10
  2. package/dist/index.js +2048 -1785
  3. package/package.json +9 -9
package/dist/index.d.cts CHANGED
@@ -39,6 +39,8 @@ interface ContractParam {
39
39
  }
40
40
  interface Contract {
41
41
  name: string;
42
+ /** Human-readable description of the contract (for agent-kit and validation). */
43
+ description?: string;
42
44
  tags: Array<ContractTag>;
43
45
  props?: Array<ContractProp>;
44
46
  /** URL/load params (e.g. slug for [slug] route). Generates Params extends UrlParams. */
@@ -95,10 +97,16 @@ interface JayImportResolver {
95
97
  /**
96
98
  * Read a jay-html file adjacent to a component module.
97
99
  * Given a module src path (e.g., "./header/header"), resolves to the absolute path
98
- * and reads the corresponding .jay-html file (same base name + .jay-html extension).
99
- * Returns the file content string, or null if not found.
100
+ * and reads the corresponding .jay-html file. Tries two conventions:
101
+ * 1. File-based: `<src>.jay-html` (e.g., `header/header.jay-html`)
102
+ * 2. Directory-based: `<src>/<basename>.jay-html` (e.g., `header/header/header.jay-html`)
103
+ * Returns the file content and the directory containing the jay-html file, or null if not found.
100
104
  */
101
- readJayHtml(importingModuleDir: string, src: string): string | null;
105
+ readJayHtml(importingModuleDir: string, src: string): {
106
+ content: string;
107
+ componentDir: string;
108
+ filePath: string;
109
+ } | null;
102
110
  }
103
111
  declare const JAY_IMPORT_RESOLVER: JayImportResolver;
104
112
 
@@ -185,6 +193,11 @@ interface JayHtmlSourceFile extends CompilerSourceFile {
185
193
  * Used by the dev server to watch these files for changes.
186
194
  */
187
195
  linkedCssFiles?: string[];
196
+ /**
197
+ * Absolute paths to headfull FS component jay-html files included by this page.
198
+ * Includes nested headfull components. Used by the dev server to watch for changes.
199
+ */
200
+ linkedComponentFiles?: string[];
188
201
  filename?: string;
189
202
  contract?: Contract;
190
203
  contractRef?: string;
@@ -229,11 +242,12 @@ declare function generateServerElementFile(jayFile: JayHtmlSourceFile, _options?
229
242
  /**
230
243
  * Coordinate pre-processing for SSR/hydration consistency.
231
244
  *
232
- * Assigns `jay-coordinate-base` attributes to all elements that need coordinates,
233
- * in a single pass before either server or hydrate compilation runs.
234
- * Both compilers read this attribute instead of computing coordinates independently.
245
+ * Assigns `jay-coordinate-base` and `jay-scope` attributes to all elements
246
+ * that need coordinates, in a single pass before either server or hydrate
247
+ * compilation runs. Both compilers read these attributes instead of computing
248
+ * coordinates independently.
235
249
  *
236
- * See Design Log #103, #106.
250
+ * See Design Log #103, #106, #126 (scoped coordinates).
237
251
  */
238
252
 
239
253
  interface AssignCoordinatesOptions {
@@ -254,7 +268,7 @@ interface AssignCoordinatesResult {
254
268
  */
255
269
  declare function assignCoordinatesToJayHtml(jayHtml: string, headlessContractNames: Set<string>): string;
256
270
  /**
257
- * Assign `jay-coordinate-base` attributes to elements in the DOM tree.
271
+ * Assign `jay-coordinate-base` and `jay-scope` attributes to elements in the DOM tree.
258
272
  *
259
273
  * Must run after slow-render (which resolves slow conditions, unrolls slowForEach,
260
274
  * and wraps multi-child headless inline templates).
@@ -278,9 +292,137 @@ declare function assignCoordinates(body: HTMLElement, options: AssignCoordinates
278
292
  * @returns The HTML with headfull FS templates injected (or unchanged if none found)
279
293
  */
280
294
  declare function injectHeadfullFSTemplates(html: string, sourceDir: string, importResolver: JayImportResolver): string;
281
- declare function parseJayFile(html: string, filename: string, filePath: string, options: ResolveTsConfigOptions, linkedContractResolver: JayImportResolver, projectRoot: string): Promise<WithValidations<JayHtmlSourceFile>>;
295
+ declare function parseJayFile(html: string, filename: string, filePath: string, options: ResolveTsConfigOptions, linkedContractResolver: JayImportResolver, projectRoot: string,
296
+ /** Optional source directory for resolving headfull FS files (jay-html, contracts).
297
+ * When parsing pre-rendered files, filePath is in build/pre-rendered/ but headfull
298
+ * relative paths were written for the original source directory. Pass the source
299
+ * directory here so file resolution works correctly while module paths stay relative
300
+ * to the actual filePath. */
301
+ sourceDir?: string): Promise<WithValidations<JayHtmlSourceFile>>;
282
302
  declare function getJayHtmlImports(html: string): string[];
283
303
 
304
+ declare const htmlElementTagNameMap: {
305
+ a: string;
306
+ abbr: string;
307
+ address: string;
308
+ applet: string;
309
+ area: string;
310
+ article: string;
311
+ aside: string;
312
+ audio: string;
313
+ b: string;
314
+ base: string;
315
+ basefont: string;
316
+ bdi: string;
317
+ bdo: string;
318
+ blockquote: string;
319
+ body: string;
320
+ br: string;
321
+ button: string;
322
+ canvas: string;
323
+ caption: string;
324
+ cite: string;
325
+ code: string;
326
+ col: string;
327
+ colgroup: string;
328
+ data: string;
329
+ datalist: string;
330
+ dd: string;
331
+ del: string;
332
+ details: string;
333
+ dfn: string;
334
+ dialog: string;
335
+ dir: string;
336
+ div: string;
337
+ dl: string;
338
+ dt: string;
339
+ em: string;
340
+ embed: string;
341
+ fieldset: string;
342
+ figcaption: string;
343
+ figure: string;
344
+ font: string;
345
+ footer: string;
346
+ form: string;
347
+ frame: string;
348
+ frameset: string;
349
+ h1: string;
350
+ h2: string;
351
+ h3: string;
352
+ h4: string;
353
+ h5: string;
354
+ h6: string;
355
+ head: string;
356
+ header: string;
357
+ hgroup: string;
358
+ hr: string;
359
+ html: string;
360
+ i: string;
361
+ iframe: string;
362
+ img: string;
363
+ input: string;
364
+ ins: string;
365
+ kbd: string;
366
+ label: string;
367
+ legend: string;
368
+ li: string;
369
+ link: string;
370
+ main: string;
371
+ map: string;
372
+ mark: string;
373
+ marquee: string;
374
+ menu: string;
375
+ meta: string;
376
+ meter: string;
377
+ nav: string;
378
+ noscript: string;
379
+ object: string;
380
+ ol: string;
381
+ optgroup: string;
382
+ option: string;
383
+ output: string;
384
+ p: string;
385
+ param: string;
386
+ picture: string;
387
+ pre: string;
388
+ progress: string;
389
+ q: string;
390
+ rp: string;
391
+ rt: string;
392
+ ruby: string;
393
+ s: string;
394
+ samp: string;
395
+ script: string;
396
+ section: string;
397
+ select: string;
398
+ slot: string;
399
+ small: string;
400
+ source: string;
401
+ span: string;
402
+ strong: string;
403
+ style: string;
404
+ sub: string;
405
+ summary: string;
406
+ sup: string;
407
+ table: string;
408
+ tbody: string;
409
+ td: string;
410
+ template: string;
411
+ textarea: string;
412
+ tfoot: string;
413
+ th: string;
414
+ thead: string;
415
+ time: string;
416
+ title: string;
417
+ tr: string;
418
+ track: string;
419
+ u: string;
420
+ ul: string;
421
+ var: string;
422
+ video: string;
423
+ wbr: string;
424
+ };
425
+
284
426
  declare function generateTypes(types: JayType): string;
285
427
 
286
428
  /**
@@ -456,4 +598,4 @@ declare function resolveHeadlessInstances(preRenderedJayHtml: string, instanceDa
456
598
  */
457
599
  declare function hasSlowPhaseProperties(contract: Contract | undefined): boolean;
458
600
 
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 };
601
+ 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 };