All files / packages/fds-uif/generator-static/src index.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95                                                                                                                                                                                             
/**
 * @fds-uif/generator-static
 *
 * Static usage generator for UIF (Universal Interface Format). Emits markup
 * that uses components in a target language (HTML today; designed to extend
 * to JSX and other targets), with two orthogonal options:
 *
 *   - `target`  — output language.
 *   - `compose` — composition strategy: `'reference'` emits external library
 *                 tags; `'expand'` recursively inlines child UIFs into a
 *                 self-contained snapshot.
 *
 * For the HTML target, the defaults (`target: 'html'`, `compose: 'reference'`)
 * produce Pure LBC for components with a 1:1 LBC mapping and LBC Recipes for
 * compositions without one. `compose: 'expand'` produces Pure Blueprints.
 *
 * ## Usage
 *
 * ```typescript
 * import { generateStaticComponent } from '@fds-uif/generator-static';
 *
 * const result = await generateStaticComponent(resolvedUif);
 * console.log(result.artifacts.code);
 * ```
 *
 * @packageDocumentation
 */
 
// Re-export types from generator-base for convenience
export type {
  ResolvedUIF,
  ComponentMetadata,
  StructureMetadata,
  PropMetadata,
  SlotMetadata,
  GeneratedCode,
  GeneratedFile,
} from '@fds-uif/generator-base/browser';
 
// Static-generator-specific types
export type {
  StaticTarget,
  StaticCompose,
  StaticGeneratorOptions,
  StaticGeneratedCode,
  StaticGenerationContext,
  PermutationState,
  VariantPermutation,
} from './types.js';
export { DEFAULT_OPTIONS } from './types.js';
 
// Generator entry points
export { generateStaticComponent, generateStaticComponents } from './generator.js';
 
// Attribute utilities
export {
  formatAttribute,
  formatStateAttribute,
  escapeAttributeValue,
  toLbcTagName,
  toKebabCase,
  humanize,
} from './attribute-utils.js';
 
// LBC builder (HTML target's reference-mode tag emitters)
export {
  buildLbcRootElement,
  renderLbcElement,
  buildLbcTag,
  isReferenceMode,
  buildStaticPropAttributes,
  buildBoundPropAttributes,
  resolveBoundPropDefault,
  findSlotInChildren,
} from './lbc-tags.js';
 
// Component resolver
export { resolveComponentHtml, applyStaticProps, indentBlock } from './component-resolver.js';
 
// HTML builder — core element rendering
export {
  buildHtmlFragment,
  buildLbcSlotChildren,
  buildElement,
  buildAttributeString,
  renderSlot,
  renderComponentPlaceholder,
} from './html-builder.js';
 
// Class resolver
export { resolveClasses, evaluateCondition } from './class-resolver.js';
 
// Variant matrix
export { generatePermutations, buildDefaultState, buildPermutationLabel } from './variant-matrix.js';