How to use @glimmer/util - 10 common examples

To help you get started, we’ve selected a few @glimmer/util 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 / runtime / lib / compat / svg-inner-html-fix.ts View on Github external
function fixSVG(parent: Element, div: HTMLElement, html: string, reference: Node): Bounds {
  assert(html !== '', 'html cannot be empty');

  let source: Node;

  // This is important, because decendants of the 
github glimmerjs / glimmer-vm / packages / @glimmer / runtime / lib / compiled / opcodes / expressions.ts View on Github external
APPEND_OPCODES.add(Op.HasBlockParams, vm => {
  // FIXME(mmun): should only need to push the symbol table
  let block = vm.stack.pop();
  let scope = vm.stack.pop();
  check(block, CheckOption(CheckOr(CheckHandle, CheckCompilableBlock)));
  check(scope, CheckOption(CheckScope));
  let table = check(vm.stack.pop(), CheckOption(CheckBlockSymbolTable));

  assert(
    table === null || (table && typeof table === 'object' && Array.isArray(table.parameters)),
    stackAssert('Option', table)
  );

  let hasBlockParams = table && table.parameters.length;
  vm.stack.push(hasBlockParams ? TRUE_REFERENCE : FALSE_REFERENCE);
});
github glimmerjs / glimmer.js / packages / @glimmer / application / src / application.ts View on Github external
protected async _render(): Promise {
    const env = expect(this.env, 'Unexpected missing environment during render');

    // Create the template context for the root `main` template, which just
    // contains the array of component roots. Any property references in that
    // template will be looked up from this object.
    let self = (this._self = new UpdatableReference({ roots: this._roots }));

    // Create an empty root scope.
    let dynamicScope = new DefaultDynamicScope();

    let builder = this.builder.getBuilder(env);

    let templateIterator = await this.loader.getTemplateIterator(
      this,
      env,
      builder,
      dynamicScope,
github emberjs / ember.js / packages / @ember / -internals / glimmer / lib / syntax / outlet.ts View on Github external
constructor(
    private outletRef: VersionedPathReference,
    env: Environment
  ) {
    // The router always dirties the root state.
    let tag = (this.tag = outletRef.tag);

    if (EMBER_ROUTING_MODEL_ARG) {
      let modelRef = new OutletModelReference(outletRef, env);
      let map = dict();
      map.model = modelRef;

      // TODO: the functionailty to create a proper CapturedArgument should be
      // exported by glimmer, or that it should provide an overload for `curry`
      // that takes `PreparedArguments`
      this.args = {
        tag,
        positional: EMPTY_ARGS.positional,
        named: {
          tag,
          map,
          names: ['model'],
          references: [modelRef],
          length: 1,
          has(key: string): boolean {
            return key === 'model';
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),

  StringLiteral: tuple(),
  BooleanLiteral: tuple(),
  NumberLiteral: tuple(),
  NullLiteral: tuple(),
  UndefinedLiteral: tuple(),

  Hash: tuple('pairs'),
  HashPair: tuple('value'),
};
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import { tuple } from '@glimmer/util';
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),

  StringLiteral: tuple(),
  BooleanLiteral: tuple(),
  NumberLiteral: tuple(),
  NullLiteral: tuple(),
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import { tuple } from '@glimmer/util';
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),

  StringLiteral: tuple(),
  BooleanLiteral: tuple(),
  NumberLiteral: tuple(),
  NullLiteral: tuple(),
  UndefinedLiteral: tuple(),
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import { tuple } from '@glimmer/util';
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),

  StringLiteral: tuple(),
  BooleanLiteral: tuple(),
  NumberLiteral: tuple(),
  NullLiteral: tuple(),
  UndefinedLiteral: tuple(),

  Hash: tuple('pairs'),
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import { tuple } from '@glimmer/util';
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),
github glimmerjs / glimmer-vm / packages / @glimmer / syntax / lib / types / visitor-keys.ts View on Github external
import { tuple } from '@glimmer/util';
import * as AST from '../types/nodes';

// ensure stays in sync with typing
// ParentNode and ChildKey types are derived from VisitorKeysMap
const visitorKeys = {
  Program: tuple('body'),
  Template: tuple('body'),
  Block: tuple('body'),

  MustacheStatement: tuple('path', 'params', 'hash'),
  BlockStatement: tuple('path', 'params', 'hash', 'program', 'inverse'),
  ElementModifierStatement: tuple('path', 'params', 'hash'),
  PartialStatement: tuple('name', 'params', 'hash'),
  CommentStatement: tuple(),
  MustacheCommentStatement: tuple(),
  ElementNode: tuple('attributes', 'modifiers', 'children', 'comments'),
  AttrNode: tuple('value'),
  TextNode: tuple(),

  ConcatStatement: tuple('parts'),
  SubExpression: tuple('path', 'params', 'hash'),
  PathExpression: tuple(),

  StringLiteral: tuple(),
  BooleanLiteral: tuple(),
  NumberLiteral: tuple(),
  NullLiteral: tuple(),
  UndefinedLiteral: tuple(),