How to use the @glimmer/runtime.DOMTreeConstruction function in @glimmer/runtime

To help you get started, we’ve selected a few @glimmer/runtime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment.ts View on Github external
constructor(options: TestEnvironmentOptions = {}) {
    // let document = options.document || window.document;
    // let appendOperations = options.appendOperations || new DOMTreeConstruction(document);
    super({
      appendOperations: options.appendOperations || new DOMTreeConstruction(options.document as Document || window.document),
      updateOperations: new DOMChanges((options.document || window.document) as Document)
    });

    // recursive field, so "unsafely" set one half late (but before the resolver is actually used)
    this.resolver['options'] = this.compileOptions;
    this.lookup = new LookupResolver(this.resolver);
    let document = options.document || window.document;

    this.uselessAnchor = document.createElement('a') as HTMLAnchorElement;
    this.registerHelper("if", ([cond, yes, no]) => cond ? yes : no);
    this.registerHelper("unless", ([cond, yes, no]) => cond ? no : yes);
    this.registerInternalHelper("-get-dynamic-var", getDynamicVar);
    this.registerModifier("action", new InertModifierManager());

    this.registerInternalHelper("hash", (_vm: VM, args: Arguments) => args.capture().named);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / bundle-compiler.ts View on Github external
constructor(options?: EnvironmentOptions) {
    if (!options) {
      let document = window.document;
      let appendOperations = new DOMTreeConstruction(document);
      let updateOperations = new DOMChanges(document as HTMLDocument);
      options = { appendOperations, updateOperations };
    }

    super(options);
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / modes / lazy / environment.ts View on Github external
function testOptions(options: Maybe) {
  let document: Maybe = options ? options.document : undefined;
  let appendOperations: Maybe = options && options.appendOperations;
  let updateOperations: Maybe = options && options.updateOperations;

  if (!document) document = window.document as SimpleDocument;

  if (!appendOperations) {
    appendOperations = new DOMTreeConstruction(document);
  }

  if (!updateOperations) {
    updateOperations = new DOMChanges(document);
  }

  return { appendOperations, updateOperations };
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / modes / eager / environment.ts View on Github external
constructor(options?: EnvironmentOptions) {
    if (!options) {
      let document = window.document as SimpleDocument;
      let appendOperations = new DOMTreeConstruction(document);
      let updateOperations = new DOMChanges(document);
      options = { appendOperations, updateOperations };
    }

    super(options);
  }
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / lazy-env.ts View on Github external
function testOptions(options: Maybe) {
  let document: Maybe = options ? options.document : undefined;
  let appendOperations: Maybe = options && options.appendOperations;
  let updateOperations: Maybe = options && options.updateOperations;

  if (!document) document = window.document;

  if (!appendOperations) {
    appendOperations = new DOMTreeConstruction(document);
  }

  if (!updateOperations) {
    updateOperations = new DOMChanges(document as HTMLDocument);
  }

  return { appendOperations, updateOperations };
}
github glimmerjs / glimmer.js / packages / @glimmer / application / src / environment.ts View on Github external
static create(options: Partial = {}) {
    options.document = options.document || self.document;
    options.appendOperations =
      options.appendOperations || new DOMTreeConstruction(options.document as SimpleDocument);

    return new EnvironmentImpl(options as EnvironmentOptions);
  }