@surrealdb/ui 1.0.86 → 1.0.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md ADDED
@@ -0,0 +1,92 @@
1
+ # CLAUDE.md
2
+
3
+ This is `@surrealdb/ui` — the SurrealDB design system and UI component library, published to npm as a reusable package for all SurrealDB frontend projects.
4
+
5
+ ## Tooling
6
+
7
+ - **Runtime & package manager:** Bun (do NOT use npm, yarn, or pnpm)
8
+ - **Build:** Vite 7 in library mode, targeting ES2022 with source maps
9
+ - **Language:** TypeScript with `isolatedDeclarations` enabled — all exported types must be explicitly annotated
10
+ - **UI framework:** React 19 with JSX transform (`react-jsx`)
11
+ - **Component library:** Mantine v8 (peer dependency)
12
+ - **Linter/formatter:** Biome 2.x — 4-space indentation, 100-character line width
13
+ - **Storybook:** Storybook 10 with `@storybook/react-vite`
14
+ - **Testing:** Vitest with Playwright browser provider for Storybook integration tests
15
+
16
+ ## Commands
17
+
18
+ | Command | Description |
19
+ |---|---|
20
+ | `bun install` | Install dependencies |
21
+ | `bun run build` | Production build (outputs to `dist/`) |
22
+ | `bun run storybook:dev` | Start Storybook dev server on port 6006 |
23
+ | `bun run storybook:build` | Build static Storybook site |
24
+ | `bun qc` | Run Biome lint/format check |
25
+ | `bun qa` | Auto-fix Biome lint/format issues |
26
+ | `bun qau` | Auto-fix including unsafe fixes |
27
+ | `bun qts` | TypeScript type check (`tsc --noEmit`) |
28
+ | `bun test` | Run all tests |
29
+ | `bun run icons` | Regenerate icon constants from `icons.zip` (requires `picosvg`) |
30
+
31
+ ## Path Aliases
32
+
33
+ `@src/*` maps to `./src/*` (configured in `tsconfig.json` and resolved by `vite-tsconfig-paths`).
34
+
35
+ ## Styling
36
+
37
+ - SCSS modules (`.module.scss`) with `dashesOnly` locals convention — access classes as `styles.myClass`, not `styles["my-class"]`
38
+ - All `.scss` files auto-import `@surrealdb/ui/mixins` via Vite's `additionalData`, providing global access to theme-aware mixins:
39
+ - `@include light { ... }` / `@include dark { ... }` — color scheme scoping
40
+ - `@include sm-and-up { ... }`, `@include md-and-down { ... }`, etc. — responsive breakpoints
41
+ - `@include background-blur { ... }` — backdrop blur with fallback
42
+ - Global CSS variables are defined in `src/assets/styles/global.scss` (prefixed `--surreal-*`)
43
+ - Mantine design tokens available as `--mantine-color-*` CSS variables
44
+ - Build output CSS is automatically wrapped in `@layer surreal` by a custom Vite plugin
45
+
46
+ ## Exports
47
+
48
+ The package exposes three entry points:
49
+ - `@surrealdb/ui` — all components, hooks, helpers, and constants (from `src/index.ts`)
50
+ - `@surrealdb/ui/styles.css` — compiled CSS (wrapped in `@layer surreal`)
51
+ - `@surrealdb/ui/mixins` — raw SCSS mixins (from `res/_mixins.scss`)
52
+
53
+ ## Source Structure
54
+
55
+ ```
56
+ src/
57
+ ├── assets/ # Static assets: brand SVGs, picto WebPs, global SCSS styles
58
+ ├── constants/ # Generated/static constants (icons.ts, brands.ts, pictos.ts)
59
+ ├── editor/ # CodeMirror editor setup: extensions, keybinds, commands, theme
60
+ ├── helpers/ # Utility functions (clsx, brandsafe URL helper, ID generator)
61
+ ├── hooks/ # React hooks (useEditor, useStable, useLater, useSort, useSwitch)
62
+ ├── lib/
63
+ │ ├── markdown/ # Custom stack-based markdown parser and React renderer
64
+ │ └── yoopta/ # Yoopta block editor plugins (Mantine-styled)
65
+ ├── primitives/ # React UI components (Icon, CodeBlock, Spinner, VideoPlayer, etc.)
66
+ ├── stories/ # Storybook stories organized by category
67
+ ├── syntax/ # Syntax highlighting: language definitions, highlighter, theme
68
+ ├── theme/ # Mantine theme override (mantine.ts)
69
+ └── types/ # TypeScript module augmentations for Mantine (colors, variants, spacing)
70
+ ```
71
+
72
+ Other top-level directories:
73
+ - `res/` — SCSS mixins exported as `@surrealdb/ui/mixins`
74
+ - `tools/` — Icon parser script (`icon-parser.ts`)
75
+ - `.storybook/` — Storybook configuration (main, preview, vitest setup)
76
+ - `.github/workflows/` — CI (`check.yml`) and publish (`publish.yml`) workflows
77
+ - `dist/` — Build output (gitignored)
78
+
79
+ ## Peer Dependencies
80
+
81
+ Consumers must provide: React 19, Mantine 8, CodeMirror 6 suite, Yoopta 6, and Slate. These are externalized during build.
82
+
83
+ ## CI/CD
84
+
85
+ - **check.yml** — Runs on push/PR to `main`: Biome lint, TypeScript check, build, and tests (Bun 1.2.23)
86
+ - **publish.yml** — Triggered by GitHub release: asserts `package.json` version matches git tag, builds, packs, and publishes to npm
87
+
88
+ ## Conventions
89
+
90
+ - `useStable` hook is configured as returning a stable reference in Biome's `useExhaustiveDependencies` rule — do not list its return value in dependency arrays
91
+ - The `src/constants/icons.ts` file is auto-generated — do not edit it manually
92
+ - Biome excludes: `.vscode/`, `.github/`, `.storybook/`, `src/constants/icons.ts`, `dist/`, and `*.js` files
package/REVIEW.md ADDED
@@ -0,0 +1,81 @@
1
+ # Code Review Guidelines
2
+
3
+ Before marking any task as done, verify every applicable section below.
4
+
5
+ ## Code Quality
6
+
7
+ - **Biome**: run `bun qc` and confirm zero errors. Do not suppress or ignore lint rules without justification.
8
+ - **TypeScript**: run `bun qts` and confirm zero type errors. All exported functions and types must have explicit type annotations (`isolatedDeclarations` is enabled).
9
+ - **Formatting**: 4-space indentation, 100-character line width, multiline JSX attributes. Run `bun qa` to auto-fix if needed.
10
+ - **Unused imports**: Biome warns on unused imports — remove them before committing.
11
+ - **Unused code**: do not leave behind dead code, commented-out blocks, or `console.log` statements.
12
+
13
+ ## Components
14
+
15
+ - **Mantine first**: use Mantine components (`Box`, `Text`, `Group`, `Stack`, etc.) over raw HTML elements. Use `<Box>` instead of `<div>`.
16
+ - **Props interface**: extend `BoxProps` or the appropriate Mantine component props type. Export the props interface alongside the component.
17
+ - **Prop spreading**: spread remaining props (`...rest`) onto the root element so consumers can pass through Mantine attributes.
18
+ - **clsx**: use `clsx` from `@src/helpers/clsx` (the project's own implementation), not the npm `clsx` package.
19
+ - **Return type**: use `ReactNode` for function declarations or `FC<Props>` for arrow functions — match the convention of surrounding code.
20
+
21
+ ## Styling
22
+
23
+ - **SCSS modules**: styles go in `style.module.scss` next to the component. Import as `import classes from "./style.module.scss"`.
24
+ - **dashesOnly**: access class names as `classes.myClass`, never `classes["my-class"]`.
25
+ - **Dynamic values**: use Mantine's `__vars` prop to pass CSS custom properties for dynamic size/color — not inline styles.
26
+ - **Design tokens**: reference Mantine tokens (`--mantine-color-*`) and SurrealDB tokens (`--surreal-*`). Do not hardcode color hex values in SCSS unless defining a new token.
27
+ - **Light/dark theme**: any color that differs between themes must use `@include light { ... }` and `@include dark { ... }` mixins. Verify the component looks correct in both color schemes.
28
+ - **Responsive**: use the breakpoint mixins (`@include sm-and-up`, `@include md-and-down`, etc.) instead of raw `@media` queries.
29
+ - **No global styles**: do not add styles to `global.scss` or `variants.scss` unless defining a new design token. Component styles belong in SCSS modules.
30
+
31
+ ## Exports
32
+
33
+ - **Re-export from index**: new components, hooks, helpers, or types must be re-exported from `src/index.ts`. Missing re-exports break the public API.
34
+ - **Explicit type exports**: use `export type` for type-only exports (required by `isolatedDeclarations` and `verbatimModuleSyntax`).
35
+
36
+ ## Storybook
37
+
38
+ - **Story exists**: every primitive component must have a corresponding story in `src/stories/primitives/`. Mantine-themed component demos go in `src/stories/mantine/`.
39
+ - **CSF3 format**: stories must use Component Story Format 3 with a typed `meta` default export and `StoryObj` named exports.
40
+ - **Title convention**: use the correct prefix (`Primitives/`, `Mantine/`, `Catalog/`, or `Playground/`) in the story `title`.
41
+ - **No providers in stories**: do not wrap stories in `MantineProvider` — this is handled globally by `.storybook/preview.tsx`.
42
+ - **Shared arg types**: reuse `size` and `icon` from `src/stories/arg-types/` instead of redefining them.
43
+
44
+ ## Testing
45
+
46
+ - **Tests pass**: run `bun test` and confirm all tests pass. Do not skip or disable tests without justification.
47
+ - **Markdown parser**: changes to `src/lib/markdown/` must include tests. Run `bun test src/lib/markdown/__tests__` to verify. Update snapshots only when the change is intentional.
48
+ - **Snapshot review**: if snapshots are updated, verify the diff reflects the intended change — not unrelated side effects.
49
+
50
+ ## Dependencies
51
+
52
+ - **Justify new packages**: new external dependencies require justification. Prefer small helper functions over adding utility packages.
53
+ - **Peer vs direct**: UI framework dependencies (React, Mantine, CodeMirror, Yoopta, Slate) are peer dependencies — never add them to `dependencies`.
54
+ - **Package manager**: use `bun` exclusively. Do not use npm, yarn, or pnpm commands. Do not commit `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`.
55
+
56
+ ## Generated Files
57
+
58
+ - **Do not edit**: `src/constants/icons.ts` is auto-generated by `bun run icons`. Never edit it manually.
59
+ - **Do not edit**: `bun.lock` is managed by Bun. Do not manually modify it.
60
+ - **Do not commit**: `dist/`, `node_modules/`, `storybook-static/`, and `.tgz` files are gitignored.
61
+
62
+ ## Security
63
+
64
+ - **No secrets**: credentials, tokens, and API keys must not appear in source code, console logs, or error messages.
65
+ - **No `.env` files**: do not commit `.env` or any environment variable files.
66
+
67
+ ## Build Compatibility
68
+
69
+ - **ES2022 target**: do not use syntax or APIs that require a target newer than ES2022.
70
+ - **Tree-shaking**: the package is marked `"sideEffects": false`. Ensure new modules do not introduce top-level side effects outside of style imports.
71
+ - **CSS layer**: all component CSS is wrapped in `@layer surreal` at build time. Do not add `@layer` directives in SCSS modules — the Vite plugin handles this.
72
+
73
+ ## Hooks
74
+
75
+ - **useStable**: the return value of `useStable` is a stable reference — do not include it in React dependency arrays. Biome enforces this automatically.
76
+ - **useExhaustiveDependencies**: Biome enforces exhaustive deps at error level. Do not suppress this rule; fix the dependency array instead.
77
+
78
+ ## Skip
79
+
80
+ - Formatting and linting auto-fixes (enforced by `bun qa` / `bun qau`).
81
+ - Biome-excluded files: `.vscode/`, `.github/`, `.storybook/`, `src/constants/icons.ts`, `dist/`, `*.js`.
package/dist/ui.d.ts CHANGED
@@ -8,6 +8,7 @@ import { ButtonProps } from '@mantine/core';
8
8
  import { CalloutElementMap } from '@yoopta/callout/dist/types';
9
9
  import { CodeProps } from '@mantine/core';
10
10
  import { Command } from '@codemirror/view';
11
+ import { default as default_2 } from 'github-slugger';
11
12
  import { DividerElementMap } from '@yoopta/divider/dist/types';
12
13
  import { EditorSelection } from '@codemirror/state';
13
14
  import { EditorView } from '@codemirror/view';
@@ -396,7 +397,7 @@ export declare interface CommonAttrs {
396
397
  export declare const commonExtensions: () => Extension;
397
398
 
398
399
  /**
399
- * Create a style highlighter for the given color scheme and syntax theme
400
+ * Get a cached style highlighter for the given color scheme
400
401
  */
401
402
  export declare function createHighlighter(colorScheme: MantineColorScheme): Highlighter;
402
403
 
@@ -565,6 +566,8 @@ export declare const iconAccountPlus: string;
565
566
 
566
567
  export declare const iconAccountSecure: string;
567
568
 
569
+ export declare const iconAlert: string;
570
+
568
571
  export declare const iconAPI: string;
569
572
 
570
573
  export declare const iconArrowDownFat: string;
@@ -879,6 +882,8 @@ export declare const iconTextBoxPlus: string;
879
882
 
880
883
  export declare const iconTransfer: string;
881
884
 
885
+ export declare const iconTrash: string;
886
+
882
887
  export declare const iconTune: string;
883
888
 
884
889
  export declare const iconUniversity: string;
@@ -1197,6 +1202,7 @@ export declare interface ParserState {
1197
1202
  stack: string[];
1198
1203
  root: BlockNode[];
1199
1204
  currentContainer: BlockNode[];
1205
+ slugger: default_2;
1200
1206
  }
1201
1207
 
1202
1208
  export declare const picto2106: string;