Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions prototypes/stock-base-dialog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.0.0 - 2026-08-17

- Created the Stock Base Dialog prototype scaffold.
20 changes: 20 additions & 0 deletions prototypes/stock-base-dialog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Stock Base Dialog

A stock base prototype that confirms a Roam extension can load a dialog screen.

## Status

Internal prototype for evaluation by Discourse Graphs.

## Features

- Opens a stock confirmation dialog as soon as the extension loads.
- Closes and cleans up the dialog when the extension unloads.

## Install

Load this developer-extension URL in Roam:

```text
https://discoursegraphs.com/releases/prototypes/stock-base-dialog/
```
21 changes: 21 additions & 0 deletions prototypes/stock-base-dialog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "stock-base-dialog",
"version": "0.0.0",
"private": true,
"description": "A stock base prototype that confirms a Roam extension can load a dialog screen.",
"type": "module",
"scripts": {
"start": "roam-prototype dev",
"build": "roam-prototype build",
"test": "vitest run --passWithNoTests"
},
"dependencies": {
"roamjs-components": "catalog:",
"use-sync-external-store": "catalog:"
},
"devDependencies": {
"@discoursegraphs/extension-base": "workspace:*",
"jsdom": "catalog:",
"vitest": "catalog:"
}
}
23 changes: 23 additions & 0 deletions prototypes/stock-base-dialog/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { render as renderAlert } from "roamjs-components/components/SimpleAlert";
import { runExtension } from "roamjs-components/util";
import "./styles.css";

export default runExtension(async () => {
let closeDialog: (() => void) | undefined;

closeDialog = await renderAlert({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register cleanup before awaiting the dialog

SimpleAlert.render resolves only after the alert is dismissed, so while the dialog is visible this initializer remains pending and has not returned its unload callback. If the extension is disabled or reloaded before the user clicks Close, the overlay therefore remains mounted; the resolved value also is not a dialog disposer to save in closeDialog. Mount the alert without blocking lifecycle initialization and register an actual cleanup operation immediately.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

content: "**Stock Base Dialog is working.**\n\nThe extension loaded successfully.",
confirmText: "Close",
onConfirm: () => {
closeDialog = undefined;
},
});

return {
unload: () => {
const close = closeDialog;
closeDialog = undefined;
close?.();
},
};
});
3 changes: 3 additions & 0 deletions prototypes/stock-base-dialog/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dg-prototype-stock-base-dialog {
--dg-prototype-name: "stock-base-dialog";
}
6 changes: 6 additions & 0 deletions prototypes/stock-base-dialog/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const base = require("../../packages/extension-base/tailwind.config.cjs");

module.exports = {
...base,
content: ["./src/**/*.{js,jsx,ts,tsx}"],
};
16 changes: 16 additions & 0 deletions prototypes/stock-base-dialog/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../packages/extension-base/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"~/*": [
"./src/*"
]
}
},
"include": [
"src",
"tests",
"vitest.config.ts"
]
}
8 changes: 8 additions & 0 deletions prototypes/stock-base-dialog/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
environment: "jsdom",
restoreMocks: true,
},
});