unit Space_pen;

interface

type
  JJQuery = class external
    function view: Variant;
    function views: array of Variant;
  end;

  JJQuery = class external
    function scrollBottom: Float;
    function scrollBottom(newValue: Float): JJQuery;
    function scrollDown: JJQuery;
    function scrollUp: JJQuery;
    function scrollToTop: JJQuery;
    function scrollToBottom: JJQuery;
    function scrollRight: Float;
    function scrollRight(newValue: Float): JJQuery;
    function pageUp: JJQuery;
    function pageDown: JJQuery;
    function isOnDom: Boolean;
    function isVisible: Boolean;
    function isHidden: Boolean;
    function isDisabled: Boolean;
    function enable: JJQuery;
    function disable: JJQuery;
    function insertAt(index: Float; element: Variant): JJQuery;
    function removeAt(index: Float): JJQuery;
    function indexOf(child: Variant): Variant;
    function containsElement(element: Variant): Boolean;
    function preempt(eventName: Variant; handler: JFunction): Variant;
    function handlers(eventName: Variant): Variant;
    function hasParent: Boolean;
    function hasFocus: Boolean;
    function flashError: Float;
    function trueHeight: Variant;
    function trueWidth: Variant;
    function document(eventName: Variant; docString: String): Variant;
    function events: Variant;
    function command(eventName: Variant; handler: Variant): Variant;
    function command(eventName: Variant; selector: Variant; handler: Variant): Variant;
    function command(eventName: Variant; selector: Variant; options: Variant; handler: Variant): Variant;
    procedure iconSize(size: Float);
    function intValue: Float;
  end;

type
  JView = class external 'View'
    class var builderStack: array of JBuilder;
    procedure subview(name: Variant; view: Variant);
    procedure text(str: String);
    procedure tag(tagName: Variant; args: array of Variant);
    procedure raw(str: String);
    procedure pushBuilder;
    function popBuilder: JBuilder;
    function buildHtml(fn: procedure): array of String;
    function render(fn: procedure): JJQuery;
    procedure content(args: array of Variant);
    procedure a(args: array of Variant);
    procedure abbr(args: array of Variant);
    procedure address(args: array of Variant);
    procedure article(args: array of Variant);
    procedure aside(args: array of Variant);
    procedure audio(args: array of Variant);
    procedure b(args: array of Variant);
    procedure bdi(args: array of Variant);
    procedure bdo(args: array of Variant);
    procedure blockquote(args: array of Variant);
    procedure body(args: array of Variant);
    procedure button(args: array of Variant);
    procedure canvas(args: array of Variant);
    procedure caption(args: array of Variant);
    procedure cite(args: array of Variant);
    procedure code(args: array of Variant);
    procedure colgroup(args: array of Variant);
    procedure datalist(args: array of Variant);
    procedure dd(args: array of Variant);
    procedure del(args: array of Variant);
    procedure details(args: array of Variant);
    procedure dfn(args: array of Variant);
    procedure &div(args: array of Variant);
    procedure dl(args: array of Variant);
    procedure dt(args: array of Variant);
    procedure em(args: array of Variant);
    procedure fieldset(args: array of Variant);
    procedure figcaption(args: array of Variant);
    procedure figure(args: array of Variant);
    procedure footer(args: array of Variant);
    procedure form(args: array of Variant);
    procedure h1(args: array of Variant);
    procedure h2(args: array of Variant);
    procedure h3(args: array of Variant);
    procedure h4(args: array of Variant);
    procedure h5(args: array of Variant);
    procedure h6(args: array of Variant);
    procedure head(args: array of Variant);
    procedure header(args: array of Variant);
    procedure hgroup(args: array of Variant);
    procedure html(args: array of Variant);
    procedure i(args: array of Variant);
    procedure iframe(args: array of Variant);
    procedure ins(args: array of Variant);
    procedure kbd(args: array of Variant);
    procedure &label(args: array of Variant);
    procedure legend(args: array of Variant);
    procedure li(args: array of Variant);
    procedure map(args: array of Variant);
    procedure mark(args: array of Variant);
    procedure menu(args: array of Variant);
    procedure meter(args: array of Variant);
    procedure nav(args: array of Variant);
    procedure noscript(args: array of Variant);
    procedure &object(args: array of Variant);
    procedure ol(args: array of Variant);
    procedure optgroup(args: array of Variant);
    procedure option(args: array of Variant);
    procedure output(args: array of Variant);
    procedure p(args: array of Variant);
    procedure pre(args: array of Variant);
    procedure progress(args: array of Variant);
    procedure q(args: array of Variant);
    procedure rp(args: array of Variant);
    procedure rt(args: array of Variant);
    procedure ruby(args: array of Variant);
    procedure s(args: array of Variant);
    procedure samp(args: array of Variant);
    procedure script(args: array of Variant);
    procedure section(args: array of Variant);
    procedure select(args: array of Variant);
    procedure small(args: array of Variant);
    procedure span(args: array of Variant);
    procedure strong(args: array of Variant);
    procedure style(args: array of Variant);
    procedure sub(args: array of Variant);
    procedure summary(args: array of Variant);
    procedure sup(args: array of Variant);
    procedure table(args: array of Variant);
    procedure tbody(args: array of Variant);
    procedure td(args: array of Variant);
    procedure textarea(args: array of Variant);
    procedure tfoot(args: array of Variant);
    procedure th(args: array of Variant);
    procedure thead(args: array of Variant);
    procedure time(args: array of Variant);
    procedure title(args: array of Variant);
    procedure tr(args: array of Variant);
    procedure u(args: array of Variant);
    procedure ul(args: array of Variant);
    procedure video(args: array of Variant);
    procedure area(args: array of Variant);
    procedure base(args: array of Variant);
    procedure br(args: array of Variant);
    procedure col(args: array of Variant);
    procedure command(args: array of Variant);
    procedure embed(args: array of Variant);
    procedure hr(args: array of Variant);
    procedure img(args: array of Variant);
    procedure input(args: array of Variant);
    procedure keygen(args: array of Variant);
    procedure link(args: array of Variant);
    procedure meta(args: array of Variant);
    procedure param(args: array of Variant);
    procedure source(args: array of Variant);
    procedure track(args: array of Variant);
    procedure wbrk(args: array of Variant);
    procedure initialize(view: JView; args: Variant);
    constructor Create(args: array of Variant));
    function buildHtml(params: Variant): Variant;
    procedure wireOutlets(view: JView);
    procedure bindEventHandlers(view: JView);
    function pushStack(elems: Variant): Variant;
    function &end: Variant;
    function command(commandName: Variant; selector: Variant; options: Variant; handler: Variant): Variant;
    function preempt(eventName: Variant; handler: Variant): Variant;
  end;

type
  JBuilder = class external 'Builder'
    document: array of Variant;
    postProcessingSteps: array of Variant;
    function buildHtml: array of Variant;
    procedure tag(name: String; args: array of Variant);
    procedure openTag(name: String; attributes: Variant);
    procedure closeTag(name: String);
    procedure text(str: String);
    procedure raw(str: String);
    procedure subview(outletName: Variant; subview: JView);
    function extractOptions(args: Variant): Variant;
  end;

//"space-pen"

type
  JView = class external 'View'
    builderStack: array of JBuilder;
    procedure subview(name: Variant; view: Variant);
    procedure text(str: String);
    procedure tag(tagName: Variant; args: array of Variant);
    procedure raw(str: String);
    procedure pushBuilder;
    function popBuilder: JBuilder;
    function buildHtml(fn: procedure): array of String;
    function render(fn: procedure): JJQuery;
    procedure content(args: array of Variant);
    function a(args: array of Variant): Variant;
    function abbr(args: array of Variant): Variant;
    function address(args: array of Variant): Variant;
    function article(args: array of Variant): Variant;
    function aside(args: array of Variant): Variant;
    function audio(args: array of Variant): Variant;
    function b(args: array of Variant): Variant;
    function bdi(args: array of Variant): Variant;
    function bdo(args: array of Variant): Variant;
    function blockquote(args: array of Variant): Variant;
    function body(args: array of Variant): Variant;
    function button(args: array of Variant): Variant;
    function canvas(args: array of Variant): Variant;
    function caption(args: array of Variant): Variant;
    function cite(args: array of Variant): Variant;
    function code(args: array of Variant): Variant;
    function colgroup(args: array of Variant): Variant;
    function datalist(args: array of Variant): Variant;
    function dd(args: array of Variant): Variant;
    function del(args: array of Variant): Variant;
    function details(args: array of Variant): Variant;
    function dfn(args: array of Variant): Variant;
    function &div(args: array of Variant): Variant;
    function dl(args: array of Variant): Variant;
    function dt(args: array of Variant): Variant;
    function em(args: array of Variant): Variant;
    function fieldset(args: array of Variant): Variant;
    function figcaption(args: array of Variant): Variant;
    function figure(args: array of Variant): Variant;
    function footer(args: array of Variant): Variant;
    function form(args: array of Variant): Variant;
    function h1(args: array of Variant): Variant;
    function h2(args: array of Variant): Variant;
    function h3(args: array of Variant): Variant;
    function h4(args: array of Variant): Variant;
    function h5(args: array of Variant): Variant;
    function h6(args: array of Variant): Variant;
    function head(args: array of Variant): Variant;
    function header(args: array of Variant): Variant;
    function hgroup(args: array of Variant): Variant;
    function html(args: array of Variant): Variant;
    function i(args: array of Variant): Variant;
    function iframe(args: array of Variant): Variant;
    function ins(args: array of Variant): Variant;
    function kbd(args: array of Variant): Variant;
    function &label(args: array of Variant): Variant;
    function legend(args: array of Variant): Variant;
    function li(args: array of Variant): Variant;
    function map(args: array of Variant): Variant;
    function mark(args: array of Variant): Variant;
    function menu(args: array of Variant): Variant;
    function meter(args: array of Variant): Variant;
    function nav(args: array of Variant): Variant;
    function noscript(args: array of Variant): Variant;
    function &object(args: array of Variant): Variant;
    function ol(args: array of Variant): Variant;
    function optgroup(args: array of Variant): Variant;
    function option(args: array of Variant): Variant;
    function output(args: array of Variant): Variant;
    function p(args: array of Variant): Variant;
    function pre(args: array of Variant): Variant;
    function progress(args: array of Variant): Variant;
    function q(args: array of Variant): Variant;
    function rp(args: array of Variant): Variant;
    function rt(args: array of Variant): Variant;
    function ruby(args: array of Variant): Variant;
    function s(args: array of Variant): Variant;
    function samp(args: array of Variant): Variant;
    function script(args: array of Variant): Variant;
    function section(args: array of Variant): Variant;
    function select(args: array of Variant): Variant;
    function small(args: array of Variant): Variant;
    function span(args: array of Variant): Variant;
    function strong(args: array of Variant): Variant;
    function style(args: array of Variant): Variant;
    function sub(args: array of Variant): Variant;
    function summary(args: array of Variant): Variant;
    function sup(args: array of Variant): Variant;
    function table(args: array of Variant): Variant;
    function tbody(args: array of Variant): Variant;
    function td(args: array of Variant): Variant;
    function textarea(args: array of Variant): Variant;
    function tfoot(args: array of Variant): Variant;
    function th(args: array of Variant): Variant;
    function thead(args: array of Variant): Variant;
    function time(args: array of Variant): Variant;
    function title(args: array of Variant): Variant;
    function tr(args: array of Variant): Variant;
    function u(args: array of Variant): Variant;
    function ul(args: array of Variant): Variant;
    function video(args: array of Variant): Variant;
    function area(args: array of Variant): Variant;
    function base(args: array of Variant): Variant;
    function br(args: array of Variant): Variant;
    function col(args: array of Variant): Variant;
    function command(args: array of Variant): Variant;
    function embed(args: array of Variant): Variant;
    function hr(args: array of Variant): Variant;
    function img(args: array of Variant): Variant;
    function input(args: array of Variant): Variant;
    function keygen(args: array of Variant): Variant;
    function link(args: array of Variant): Variant;
    function meta(args: array of Variant): Variant;
    function param(args: array of Variant): Variant;
    function source(args: array of Variant): Variant;
    function track(args: array of Variant): Variant;
    function wbrk(args: array of Variant): Variant;
    procedure initialize(view: JView; args: Variant);
    constructor Create(args: array of Variant);
    function buildHtml(params: Variant): Variant;
    procedure wireOutlets(view: JView);
    procedure bindEventHandlers(view: JView);
    function pushStack(elems: Variant): Variant;
    function &end: Variant;
    function command(eventName: String; handler: Variant): Variant;
    function command(eventName: String; selector: Variant; handler: Variant): Variant;
    function command(eventName: String; selector: Variant; options: Variant; handler: Variant): Variant;
    function preempt(eventName: Variant; handler: Variant): Variant;
  end;

  JBuilder = class external 'Builder'
    document: array of Variant;
    postProcessingSteps: array of Variant;
    function buildHtml: array of Variant;
    procedure tag(name: String; args: array of Variant);
    procedure openTag(name: String; attributes: Variant);
    procedure closeTag(name: String);
    procedure text(str: String);
    procedure raw(str: String);
    procedure subview(outletName: Variant; subview: JView);
    function extractOptions(args: Variant): Variant;
  end;

var
  jQuery: JJQueryStatic;
  $: JJQueryStatic;
  $$: (fn: JFunction): JJQuery;
  $$$: (fn: JFunction): Variant;


