yumemi/gen/reader/front

面 package の front model。

back の reader.gleam と出入口を分ける。ここでは面の const / type / function から、次段の emit が使う構造だけを拾う。まだ file は出さない。

Types

#(service.X, live.After(ok: .., error: ..)) の 1 組。

pub type AfterRow {
  AfterRow(service: String, ok: Then, error: Then)
}

Constructors

  • AfterRow(service: String, ok: Then, error: Then)
pub type Area {
  Area(
    name: String,
    flow: String,
    grid_tracks: option.Option(GridTracks),
    flow_layout: option.Option(AreaFlow),
    pin: String,
    anchor: option.Option(OverlayAnchor),
    style: List(String),
  )
}

Constructors

Area の flow のうち、生成する grid の CSS へ写すもの(GridTracks は grid_tracks が持つ)。gap は literal か style の定数を読んだ値。

pub type AreaFlow {
  StackFlow(gap: Length)
  RowFlow(gap: Length, wrap: Bool)
  GridFlow(cols: Int, gap: Length)
  ScrollerFlow
}

Constructors

  • StackFlow(gap: Length)
  • RowFlow(gap: Length, wrap: Bool)
  • GridFlow(cols: Int, gap: Length)
  • ScrollerFlow
pub type Block {
  Block(
    name: String,
    module: String,
    input: option.Option(String),
    input_module: option.Option(String),
    input_definition: option.Option(glance.CustomType),
    input_imports: List(glance.Definition(glance.Import)),
    input_kind: BlockInput,
    args: List(BlockArg),
    view_arity: Int,
    view_arg_type: option.Option(String),
    arg_type_valid: Bool,
    source: glance.Module,
    has_view: Bool,
    has_sample: Bool,
  )
}

Constructors

pub type BlockArg {
  BlockArg(name: String, type_: BlockArgType)
}

Constructors

pub type BlockArgType {
  StringArg
  OptionalStringArg
  OtherArg(String)
}

Constructors

  • StringArg
  • OptionalStringArg
  • OtherArg(String)
pub type BlockInput {
  ServiceOut(String)
  NilInput
  OtherInput(String)
}

Constructors

  • ServiceOut(String)
  • NilInput
  • OtherInput(String)
pub type CallTarget {
  ServiceCall(String)
  AttachedCall(String)
}

Constructors

  • ServiceCall(String)
  • AttachedCall(String)
pub type Cell {
  Flow
  Span(cols: Int, rows: Int)
  At(col: Int, row: Int, span: CellSpan)
}

Constructors

  • Flow
  • Span(cols: Int, rows: Int)
  • At(col: Int, row: Int, span: CellSpan)
pub type CellSpan {
  CellSpan(cols: Int, rows: Int)
}

Constructors

  • CellSpan(cols: Int, rows: Int)

interactive Component(0.12、51 v6「interactive Component」)。宣言は calls・after_send・任意の reloads と view だけ。検査(第 9〜22 条)は component_notes と、Service の model の要る分は emit の interactive_notes が持つ。

pub type Component {
  Component(
    name: String,
    module: String,
    calls: List(CallTarget),
    calls_literal: Bool,
    reloads: option.Option(Reloads),
    reloads_unreadable: Bool,
    has_view: Bool,
    after_send: List(AfterRow),
    after_send_unreadable: Bool,
    nested_island: Bool,
    has_app: Bool,
    view_params: List(ViewParam),
    with_fields: option.Option(List(#(String, glance.Type))),
    with_forbidden: List(String),
    live_imports: List(String),
    aliases: List(#(String, String)),
    live_calls: List(LiveCall),
    escape_calls: Int,
    notes: List(String),
  )
}

Constructors

  • Component(
      name: String,
      module: String,
      calls: List(CallTarget),
      calls_literal: Bool,
      reloads: option.Option(Reloads),
      reloads_unreadable: Bool,
      has_view: Bool,
      after_send: List(AfterRow),
      after_send_unreadable: Bool,
      nested_island: Bool,
      has_app: Bool,
      view_params: List(ViewParam),
      with_fields: option.Option(List(#(String, glance.Type))),
      with_forbidden: List(String),
      live_imports: List(String),
      aliases: List(#(String, String)),
      live_calls: List(LiveCall),
      escape_calls: Int,
      notes: List(String),
    )

    Arguments

    calls_literal

    calls が const の List で、どの要素も構成子の literal(第 10 条)

    reloads_unreadable

    reloads の const があるが形が読めない(第 17 条)

    after_send_unreadable

    after_send の const があるが形が読めない(第 12 条)

    has_app

    pub fn app がある(第 9 条)

    view_params

    view の引数(順に、型の module の道と型名、引数の名)

    with_fields

    同じ module の pub type With の欄(view が with を受けるとき)

    with_forbidden

    With の欄のうち、型に live の型・el.Element・el.Attribute・関数を含むもの(第 22 条。unqualified の import・同じ module の型の欄・型の別名を辿る)

    live_imports

    import した gen/live/* の module 名

    aliases

    import の別名 → module の道(第 22 条で With の欄の型を解く)

    live_calls

    view の中の live の口の呼び出し

    escape_calls

    逃げ道(gen/escapes)の呼び出しの数

    notes

    生成器が止める形(第 9・10・11・13・19・21・22 条)

pub type Error {
  Unsupported(where: String, detail: String)
}

Constructors

  • Unsupported(where: String, detail: String)
pub type Frame {
  Frame(
    media: String,
    areas: List(Area),
    placements: List(Placement),
    cols: List(Track),
    rows: List(Track),
    template: List(List(String)),
    style: FrameStyle,
  )
}

Constructors

StyledFrame(style:) ── 格子の要素(data-yumemi-grid)に掛ける Style。Area の style と同じく style の定数で書く。Frame と style: [] は NoFrameStyle (出力は 0.11.9 と同じ)。

pub type FrameStyle {
  NoFrameStyle
  FrameStyleList(names: List(String))
  FrameStyleConstant(name: String)
  FrameStyleInvalid
}

Constructors

  • NoFrameStyle
  • FrameStyleList(names: List(String))

    style: [style.a, style.b](各要素が css.Style の定数)。

  • FrameStyleConstant(name: String)

    style: style.shell(List(css.Style) の定数)。

  • FrameStyleInvalid

    style の定数でない要素を含む(frame_notes が止める)。

pub type From {
  Path(String)
  Query(String)
  Session(String)
  Origin(String)
  AuthOrigin
  CurrentRoute
  InvalidFrom(String)
}

Constructors

  • Path(String)
  • Query(String)
  • Session(String)
  • Origin(String)
  • AuthOrigin
  • CurrentRoute
  • InvalidFrom(String)
pub type Front {
  Front(
    face: String,
    package_name: String,
    layout: Layout,
    shell: Shell,
    pages: List(Page),
    blocks: List(Block),
    components: List(Component),
    style: Style,
    services: List(String),
    http_entries: List(HttpEntry),
    page_service_args: List(PageServiceArgs),
    violations: List(Violation),
    overlay_calls: List(OverlayCall),
    surface_notes: List(stop.Note),
    static_sheets: List(#(String, String)),
  )
}

Constructors

  • Front(
      face: String,
      package_name: String,
      layout: Layout,
      shell: Shell,
      pages: List(Page),
      blocks: List(Block),
      components: List(Component),
      style: Style,
      services: List(String),
      http_entries: List(HttpEntry),
      page_service_args: List(PageServiceArgs),
      violations: List(Violation),
      overlay_calls: List(OverlayCall),
      surface_notes: List(stop.Note),
      static_sheets: List(#(String, String)),
    )

    Arguments

    surface_notes

    記述面と Css の条文(第 1〜3・7・8・23〜25・31 条)の停止。

    static_sheets

    el.static_sheet の path(第 28〜30 条の file の検査と規則の数えは emit が持つ)。

pub type GridTracks {
  GridTracks(cols: List(Track), gap: Length)
}

Constructors

pub type HttpEntry {
  HttpEntry(name: String, authenticated: Bool)
}

Constructors

  • HttpEntry(name: String, authenticated: Bool)
pub type Layout {
  Layout(
    name: String,
    sp: option.Option(Frame),
    pc: option.Option(Frame),
    tablet: option.Option(Frame),
    vars: List(Var),
    nested: Bool,
  )
}

Constructors

pub type Length {
  RemLength(Float)
  PxLength(Float)
  VarLength(String)
  EnvLength(String)
  DvhLength(Float)
}

Constructors

  • RemLength(Float)
  • PxLength(Float)
  • VarLength(String)

    css.Var(name)。名の検査([a-z0-9-])は length_notes が止める。

  • EnvLength(String)

    css.Env(edge)。辺は top・right・bottom・left。

  • DvhLength(Float)

<live>.bind(..) ほかの呼び出し。field は構成子の literal のときだけ。

pub type LiveCall {
  LiveCall(
    live: String,
    function: String,
    field: option.Option(String),
  )
}

Constructors

  • LiveCall(
      live: String,
      function: String,
      field: option.Option(String),
    )

pin: css.AnchoredOverlay(side:, align:) ── 開いた el.opener の下か上へ寄せる。 side は Below・Above、align は AlignStart・AlignEnd。

pub type OverlayAnchor {
  OverlayAnchor(side: String, align: String)
}

Constructors

  • OverlayAnchor(side: String, align: String)
pub type OverlayCall {
  OverlayCall(
    module: String,
    function: String,
    literal: option.Option(String),
  )
}

Constructors

  • OverlayCall(
      module: String,
      function: String,
      literal: option.Option(String),
    )
pub type Page {
  Page(
    module: String,
    path: List(String),
    url: String,
    of: option.Option(String),
    layout: option.Option(String),
    theme: option.Option(String),
    vars: List(Var),
    sp: option.Option(Frame),
    pc: option.Option(Frame),
    tablet: option.Option(Frame),
  )
}

Constructors

pub type PageServiceArgs {
  PageServiceArgs(page: String, services: List(ServiceArgs))
}

Constructors

  • PageServiceArgs(page: String, services: List(ServiceArgs))
pub type Placement {
  Fixed(area: String, block: String, cell: Cell)
  Widget(area: String, service: String, render: Render)
}

Constructors

  • Fixed(area: String, block: String, cell: Cell)
  • Widget(area: String, service: String, render: Render)
pub type Reloads {
  Reloads(read: String, on: List(String))
}

Constructors

  • Reloads(read: String, on: List(String))
pub type Render {
  One(block: String)
  ByKind(by: String, table: List(#(String, String)))
  UnknownRender
}

Constructors

  • One(block: String)
  • ByKind(by: String, table: List(#(String, String)))
  • UnknownRender
pub type ResolvedArg {
  ResolvedArg(name: String, source: ResolvedArgSource)
}

Constructors

pub type ResolvedArgSource {
  VariableSource(name: String, from: From)
}

Constructors

  • VariableSource(name: String, from: From)
pub type ServiceArgs {
  ServiceArgs(service: String, args: List(ResolvedArg))
}

Constructors

  • ServiceArgs(service: String, args: List(ResolvedArg))
pub type Shell {
  Shell(
    lang: String,
    title: String,
    background: String,
    background_image: String,
    text: String,
    accent: String,
    present: Bool,
    missing: List(String),
    head: ShellHead,
  )
}

Constructors

  • Shell(
      lang: String,
      title: String,
      background: String,
      background_image: String,
      text: String,
      accent: String,
      present: Bool,
      missing: List(String),
      head: ShellHead,
    )

shell の任意の const(0.11.12)。在れば head(と client.mjs)に出す。無ければ 0.11.11 と同じ出力。 invalid は在るのに空でない String の定数でない const の名(title と同じく宣言の不足で止める)。

pub type ShellHead {
  ShellHead(
    manifest: option.Option(String),
    theme_color: option.Option(String),
    icon: option.Option(String),
    apple_touch_icon: option.Option(String),
    service_worker: option.Option(String),
    stylesheets: List(String),
    invalid: List(String),
  )
}

Constructors

  • ShellHead(
      manifest: option.Option(String),
      theme_color: option.Option(String),
      icon: option.Option(String),
      apple_touch_icon: option.Option(String),
      service_worker: option.Option(String),
      stylesheets: List(String),
      invalid: List(String),
    )

    Arguments

    stylesheets

    0.11.15:<head> に出す stylesheet の href(並びの順)。const が無ければ空。

pub type Style {
  Style(
    tokens: List(String),
    media_variants: List(#(String, List(String))),
  )
}

Constructors

  • Style(
      tokens: List(String),
      media_variants: List(#(String, List(String))),
    )
pub type Then {
  ThenStay
  ThenReload(notice: option.Option(String))
  ThenGoTo(route: String, notice: option.Option(String))
}

Constructors

pub type Track {
  Auto
  Fr(Int)
  Rem(Float)
  Px(Float)
  Minmax(min: TrackSize, max: TrackSize)
}

Constructors

pub type TrackSize {
  AutoSize
  FrSize(Int)
  RemSize(Float)
  PxSize(Float)
}

Constructors

  • AutoSize
  • FrSize(Int)
  • RemSize(Float)
  • PxSize(Float)
pub type Var {
  Var(name: String, from: From)
}

Constructors

  • Var(name: String, from: From)
pub type ViewParam {
  ViewParam(
    name: String,
    module: option.Option(String),
    type_name: option.Option(String),
  )
}

Constructors

pub type Violation {
  DirectCall(module: String, target: String)
  InternalImport(module: String, imported: String)
  NestedIsland(module: String)
}

Constructors

  • DirectCall(module: String, target: String)
  • InternalImport(module: String, imported: String)
  • NestedIsland(module: String)

Values

pub fn block_pages(
  front: Front,
  block: Block,
) -> List(#(Page, List(Var)))

Block を載せる Page と、その Page の Var(Layout の Block なら全 Page、Var は Layout の分も)。

pub fn call_target_name(target: CallTarget) -> String
pub fn component_tag(component: Component) -> String

Component のタグ名(module 名の _ を -)。

pub const empty_shell_head: ShellHead
pub fn is_attribute_name(name: String) -> Bool

[a-z][a-z0-9-]*。

pub fn is_hex_color(value: String) -> Bool

# と 16 進 6 桁。

pub fn live_module(target: CallTarget) -> String

Component の Service(calls の要素)の live module の名。

pub fn module_references(unit: source.Unit) -> List(String)

unit の中の関数・構成子の参照の module の道(逃げ道の呼び出しの数え)。

pub fn notes(
  front: Front,
  services: List(model.Service),
) -> List(stop.Note)

model に対する停止診断。検査はここに集め、emit は呼ばない。

pub fn placing_blocks(
  front: Front,
  component: Component,
) -> List(Block)

Component を置く Block(gen/interactive.<名>(..) を呼ぶ Block)。第 17 条の一覧の読みの検査に使う。

pub fn read(
  face: String,
  units: List(source.Unit),
  services: List(model.Service),
) -> Result(Front, Error)

面の source units を model にする。Service の variant と Args は back reader の model を受け取るが、back の読み方そのものは呼ばない。

pub fn read_with_package(
  face: String,
  package_name: String,
  units: List(source.Unit),
  services: List(model.Service),
) -> Result(Front, Error)
pub fn read_with_package_and_entries(
  face: String,
  package_name: String,
  units: List(source.Unit),
  services: List(model.Service),
  entries: List(model.Entry),
) -> Result(Front, Error)
pub fn route_path(path: List(String)) -> String

Page の route 表だけが使う URL。back の HTTP route は {name}、面の browser route は :name と表記が違うため、同じ page path からここで分ける。

pub fn static_src_paths(
  unit: source.Unit,
) -> List(#(String, String))

el.static_src("..") の literal の path(#(module, path))。

pub fn valid_var_name(name: String) -> Bool

css.Var の名が [a-z0-9-] だけで、空でないか(root の sketch_css と同じ規則)。

pub fn view_ok(component: Component) -> Bool

view が calls の順の Args(と任意の末尾の with: With)を受ける(第 11 条)。生成器はこの形の Component に だけ置く関数と表を出す。

✨ Search Document