diff --git a/demo/playground-b64.html b/demo/playground-b64.html index a9f5c79..b8fbfc7 100644 --- a/demo/playground-b64.html +++ b/demo/playground-b64.html @@ -17,7 +17,16 @@

demo biscuit

} - + + + + + + + + + + diff --git a/src/bc-datalog-playground-base64.ts b/src/bc-datalog-playground-base64.ts index 12e8f75..be56a8b 100644 --- a/src/bc-datalog-playground-base64.ts +++ b/src/bc-datalog-playground-base64.ts @@ -19,6 +19,8 @@ import { export class BCDatalogPlayground extends LitElement { @property() fromHash = null; @property() showBlocks = false; + @property() displayFacts = false; + @property() displayExternalKeys = false; @state() code = ""; @state() blocks: Array<{ code: string; externalKey: string | null }> = []; @state() private started = false; @@ -67,6 +69,14 @@ export class BCDatalogPlayground extends LitElement { console.log(newval) this.showBlocks = newval === "true"; } + + if (name === "displayfacts") { + this.displayFacts = newval === "true"; + } + + if (name === "displayexternalkeys") { + this.displayExternalKeys = newval === "true"; + } } addBlock() { @@ -141,28 +151,33 @@ export class BCDatalogPlayground extends LitElement { ) ?? []; } + + const factContent = html`

Facts

+ `; + + const facts = this.displayFacts ? factContent : html``; + return html` ${this.renderBlocks(markers.blocks, parseErrors.blocks)} ${this.renderAuthorizer(markers.authorizer, parseErrors.authorizer)}

Result

-

Facts

- + ${facts} `; } renderExternalKeyInput(blockId: number) { if (blockId <= 0) return; - return html` + return this.displayExternalKeys ? html`: this.onUpdatedExternalKey(blockId, e)} value=${this.blocks[blockId].externalKey} /> - `; + ` : html``; } renderBlock( @@ -174,7 +189,7 @@ export class BCDatalogPlayground extends LitElement { return html`

${ blockId == 0 ? "Authority block" : "Block " + blockId - }: ${this.renderExternalKeyInput(blockId)}

+ } ${this.renderExternalKeyInput(blockId)}