@tamb/gamegrid
    Preparing search index...

    Interface ICell

    Declarative cell definition inside IConfig.matrix.

    After render, hydrated cells decorate current/coords internally.

    { type: cellTypeEnum.OPEN }
    
    {
    type: cellTypeEnum.OPEN,
    render({ cell, coords }) {
    const span = document.createElement('span');
    span.textContent = coords.join(",");
    return span;
    },
    }
    interface ICell {
        cellAttributes?: string[][];
        coords?: number[];
        current?: HTMLDivElement | null;
        eventTypes?: { onEnter: string; onExit: string };
        render?: (context: ICellContext) => HTMLElement;
        type: string;
        [key: string]: unknown;
    }

    Hierarchy

    • IRef
      • ICell

    Indexable

    Index
    cellAttributes?: string[][]
    coords?: number[]
    current?: HTMLDivElement | null
    eventTypes?: { onEnter: string; onExit: string }

    Custom event names dispatched on IOptions.eventTarget when the active cell changes. onExit fires for the previous cell, then onEnter for the landed cell. Extra detail keys: coords, cell. Blocked stays and GameGrid.render do not fire these.

    const door: ICell = {
    type: cellTypeEnum.INTERACTIVE,
    eventTypes: { onEnter: "door:enter", onExit: "door:exit" },
    };
    window.addEventListener("door:enter", (e: Event) => {
    const { coords, cell } = (e as GameGridDOMEvent).detail;
    console.log("entered", coords, cell);
    });
    render?: (context: ICellContext) => HTMLElement
    type: string