diff --git a/packages/ui/package.json b/packages/ui/package.json index 8995ff4..29f8446 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "sequoia-ui", - "version": "0.1.0", + "version": "0.0.2", "type": "module", "files": [ "dist", @@ -8,8 +8,14 @@ ], "main": "./dist/index.js", "exports": { - ".": "./dist/index.js", - "./comments": "./dist/index.js" + ".": { + "import": "./dist/index.js", + "default": "./dist/index.js" + }, + "./comments": { + "import": "./dist/index.js", + "default": "./dist/index.js" + } }, "scripts": { "lint": "biome lint --write", diff --git a/packages/ui/src/components/sequoia-comments/sequoia-comments.ts b/packages/ui/src/components/sequoia-comments/sequoia-comments.ts index 6fb4b08..6a9fdbc 100644 --- a/packages/ui/src/components/sequoia-comments/sequoia-comments.ts +++ b/packages/ui/src/components/sequoia-comments/sequoia-comments.ts @@ -26,7 +26,13 @@ const BLUESKY_ICON = ` `; -export class SequoiaComments extends HTMLElement { +// SSR-safe base class - use HTMLElement in browser, empty class in Node.js +const BaseElement = + typeof HTMLElement !== "undefined" + ? HTMLElement + : (class {} as typeof HTMLElement); + +export class SequoiaComments extends BaseElement { private shadow: ShadowRoot; private state: State = { type: "loading" }; private abortController: AbortController | null = null; diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index 8a7a485..a3a9a76 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -24,3 +24,7 @@ export type { } from "./types/bluesky"; export { isThreadViewPost } from "./types/bluesky"; + +// Styles and theming +export type { SequoiaTheme, SequoiaCSSVar } from "./types/styles"; +export { SEQUOIA_CSS_VARS } from "./types/styles"; diff --git a/packages/ui/src/types/styles.ts b/packages/ui/src/types/styles.ts new file mode 100644 index 0000000..2f847dc --- /dev/null +++ b/packages/ui/src/types/styles.ts @@ -0,0 +1,40 @@ +/** + * CSS custom properties for theming SequoiaComments + * + * @example + * ```css + * :root { + * --sequoia-fg-color: #1f2937; + * --sequoia-bg-color: #ffffff; + * --sequoia-accent-color: #2563eb; + * } + * ``` + */ +export interface SequoiaTheme { + /** Primary text color (default: #1f2937) */ + "--sequoia-fg-color"?: string; + /** Background color for comments and containers (default: #ffffff) */ + "--sequoia-bg-color"?: string; + /** Border color for separators and outlines (default: #e5e7eb) */ + "--sequoia-border-color"?: string; + /** Secondary/muted text color (default: #6b7280) */ + "--sequoia-secondary-color"?: string; + /** Accent color for links and buttons (default: #2563eb) */ + "--sequoia-accent-color"?: string; + /** Border radius for cards and buttons (default: 8px) */ + "--sequoia-border-radius"?: string; +} + +/** + * All available CSS custom property names + */ +export const SEQUOIA_CSS_VARS = [ + "--sequoia-fg-color", + "--sequoia-bg-color", + "--sequoia-border-color", + "--sequoia-secondary-color", + "--sequoia-accent-color", + "--sequoia-border-radius", +] as const; + +export type SequoiaCSSVar = (typeof SEQUOIA_CSS_VARS)[number];