How nikogoli/testing_shadcn_ui_for_deno works
Purpose and Consumption
This is a Deno-distributed compatibility library for using shadcn/ui-style React components in Fresh/Preact applications. Consumers import individual TSX modules directly from the package; there is no application, server route, or executable entry point in this repository. Primary public surface: components/label.tsx, components/switch.tsx, and the broader components/ directory.
Runtime and Packaging Boundary
The library targets Deno and is configured by deno.json. Components run against Preact 10.19.6 through the React-compatibility layer, a material compatibility constraint. Dependencies are vendored/generated under modules/esm.sh/, including modules/esm.sh/preact@10.19.6/compat.js; consumers do not require a Node package installation.
Component Layer
Each file in components/ is a reusable UI export, generally wrapping shadcn styling around a Radix primitive or native element. The component catalog spans base controls and composed overlays/navigation, e.g. components/button.tsx, components/dialog.tsx, components/select.tsx. Components are independently importable rather than collected behind a central barrel API.
Primitive Interaction Layer
Stateful and accessibility-sensitive components delegate interaction semantics to vendored Radix UI React primitives adapted to Preact compatibility. This boundary covers focus management, keyboard navigation, portals, dismissable layers, and controlled/uncontrolled state. Representative wrappers: components/accordion.tsx, components/alert-dialog.tsx, components/toast.tsx; underlying dependency artifacts: modules/esm.sh/v132/@radix-ui/react-dialog@1.0.5/ and modules/esm.sh/v133/@radix-ui/react-toast@1.1.5/.
Styling and Theming Contract
Components emit Tailwind-compatible utility classes and assume the host Fresh application provides shadcn CSS custom properties, Tailwind/Twind color mappings, and animation definitions. Repository-side style assets are css/shadcn.css and css/uno.css. This is an explicit integration boundary: theme tokens and generated utilities belong to the consuming application, not a runtime stylesheet injection system.
Feedback and Overlay Composition
Toast support is split between Radix-backed presentational primitives and local toast composition/state-facing elements: components/toast.tsx and components/toastElems.tsx. Dialog, popover, menu, tooltip, and related controls use browser DOM/portal behavior through Radix, rather than any backend service.
External Services and Non-Goals
No database, API client, authentication system, queue, or server-side business domain exists in the tree. The only external dependency delivery mechanism is esm.sh-compatible vendored modules, with Radix UI, Preact, cmdk, class-variance-authority, clsx, and tailwind-merge represented under modules/esm.sh/. Several shadcn components requiring heavier external integrations are intentionally absent; the library’s architectural focus is portable UI primitives for Fresh.
Main entry points: compat.js Preact React compat · toast.tsx Toast primitives · dialog.tsx Dialog · select.tsx Select
Components 17
Public UI modules
Independently importable TSX component exports.
- Component catalog · No central barrel API; modules are imported directly.
- Label
components/label.tsx - Switch
components/switch.tsx - Button
components/button.tsx - Dialog · Adds shadcn presentation around dialog behavior.
components/dialog.tsx - Select
components/select.tsx - Toast primitives · Presentational toast components backed by Radix.
components/toast.tsx - Toast composition · Local state-facing toast composition elements.
components/toastElems.tsx
Interaction primitives
Vendored accessibility and overlay behavior.
- Radix dialog · Provides focus, portal, dismissal, and dialog semantics.
- Radix toast · Provides toast state and accessibility semantics.
- Radix UI primitives · Supplies keyboard, controlled-state, and overlay behavior.
Styling contract
Host-provided shadcn theme and utility assumptions.
- shadcn theme tokens · Defines CSS custom properties expected by component classes.
css/shadcn.css - Utility mappings · Provides utility and animation definitions for host integration.
css/uno.css
Deno compatibility runtime
Deno configuration and vendored React-compatible dependencies.
- Deno package config · Defines the Deno-distributed library boundary.
deno.json - Preact React compat · Preact 10.19.6 runtime compatibility boundary.
modules/esm.sh/preact@10.19.6/compat.js - esm.sh vendored modules · Deno-consumable vendored dependencies without Node installation.
Other components
- Fresh/Preact consumer · Imports component modules and supplies theme integration.
Connections 21
- Fresh/Preact consumer → Component catalog: direct imports
- Deno package config → esm.sh vendored modules: resolves dependencies
- Component catalog → Label: includes
- Component catalog → Switch: includes
- Component catalog → Button: includes
- Component catalog → Dialog: includes
- Component catalog → Select: includes
- Component catalog → Toast primitives: includes
- Dialog → Radix dialog: wraps
- Toast primitives → Radix toast: wraps
- Toast composition → Toast primitives: composes
- Select → Radix UI primitives: delegates interaction
- Radix UI primitives → Preact React compat: runs through
- Radix dialog → Preact React compat: runs through
- Radix toast → Preact React compat: runs through
- esm.sh vendored modules → Radix UI primitives: delivers
- esm.sh vendored modules → Preact React compat: delivers
- Component catalog → shadcn theme tokens: uses theme tokens
- Component catalog → Utility mappings: emits compatible utilities
- Fresh/Preact consumer → shadcn theme tokens: provides
- Fresh/Preact consumer → Utility mappings: provides