@dinachi/cli 0.8.1 → 0.9.0

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.
@@ -0,0 +1,36 @@
1
+ // =============================================================================
2
+ // Raw definitions — for composition into existing json-render projects
3
+ // =============================================================================
4
+
5
+ // Component + action Zod schemas (pure Zod, no framework dependency)
6
+ export {
7
+ dinachiComponentDefinitions,
8
+ dinachiActionDefinitions,
9
+ type DinachiComponentName,
10
+ type DinachiActionName,
11
+ } from "./catalog";
12
+
13
+ // Component implementations + action handlers (for custom registries)
14
+ export {
15
+ dinachiComponents,
16
+ dinachiActionHandlers,
17
+ toastManager,
18
+ } from "./components";
19
+
20
+ // =============================================================================
21
+ // Pre-built catalog + registry — convenience for new projects
22
+ // =============================================================================
23
+
24
+ export {
25
+ catalog,
26
+ registry,
27
+ handlers,
28
+ executeAction,
29
+ type DinachiCatalog,
30
+ } from "./registry";
31
+
32
+ // =============================================================================
33
+ // Type re-exports
34
+ // =============================================================================
35
+
36
+ export type { Spec } from "@json-render/react";
@@ -0,0 +1,21 @@
1
+ import { defineCatalog } from "@json-render/core";
2
+ import { schema } from "@json-render/react/schema";
3
+ import { defineRegistry } from "@json-render/react";
4
+ import { dinachiComponentDefinitions, dinachiActionDefinitions } from "./catalog";
5
+ import { dinachiComponents, dinachiActionHandlers } from "./components";
6
+
7
+ // Pre-built catalog — convenience for projects using only Dinachi components.
8
+ // For composition into an existing catalog, import raw definitions from "./catalog" instead.
9
+ export const catalog = defineCatalog(schema, {
10
+ components: dinachiComponentDefinitions,
11
+ actions: dinachiActionDefinitions,
12
+ });
13
+
14
+ export type DinachiCatalog = typeof catalog;
15
+
16
+ // Pre-built registry — convenience for projects using only Dinachi components.
17
+ // For composition into an existing registry, import raw maps from "./components" instead.
18
+ export const { registry, handlers, executeAction } = defineRegistry(catalog, {
19
+ components: dinachiComponents,
20
+ actions: dinachiActionHandlers,
21
+ });
@@ -0,0 +1,2 @@
1
+ export { Link, linkVariants } from './link'
2
+ export type { LinkProps } from './link'
@@ -0,0 +1,94 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { useRender } from "@base-ui/react/use-render"
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const linkVariants = cva(
9
+ "transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default:
14
+ "text-primary underline underline-offset-4 hover:text-primary/80",
15
+ muted:
16
+ "text-muted-foreground underline underline-offset-4 hover:text-foreground",
17
+ plain: "text-foreground hover:text-primary",
18
+ unstyled: "",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "default",
23
+ },
24
+ }
25
+ )
26
+
27
+ export interface LinkProps
28
+ extends React.AnchorHTMLAttributes<HTMLAnchorElement>,
29
+ VariantProps<typeof linkVariants> {
30
+ /** Render as a different element (e.g., Next.js Link, React Router Link).
31
+ * Accepts a ReactElement or a render function `(props, state) => ReactElement`. */
32
+ render?: useRender.RenderProp
33
+ /** Show external link indicator and add target="_blank" */
34
+ external?: boolean
35
+ }
36
+
37
+ const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
38
+ (
39
+ { className, variant, render, external, children, rel, target, ...props },
40
+ ref
41
+ ) => {
42
+ const externalProps = external
43
+ ? {
44
+ target: target ?? ("_blank" as const),
45
+ rel: rel ?? "noopener noreferrer",
46
+ }
47
+ : { target, rel }
48
+
49
+ const content = (
50
+ <>
51
+ {children}
52
+ {external && (
53
+ <>
54
+ <svg
55
+ className="inline-block h-3 w-3 shrink-0"
56
+ fill="none"
57
+ stroke="currentColor"
58
+ strokeWidth={2}
59
+ strokeLinecap="round"
60
+ strokeLinejoin="round"
61
+ viewBox="0 0 24 24"
62
+ aria-hidden="true"
63
+ >
64
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
65
+ <polyline points="15 3 21 3 21 9" />
66
+ <line x1="10" y1="14" x2="21" y2="3" />
67
+ </svg>
68
+ <span className="sr-only">(opens in a new tab)</span>
69
+ </>
70
+ )}
71
+ </>
72
+ )
73
+
74
+ return useRender({
75
+ defaultTagName: 'a',
76
+ render,
77
+ ref,
78
+ props: {
79
+ className: cn(
80
+ linkVariants({ variant }),
81
+ external && "inline-flex items-center gap-1",
82
+ className
83
+ ),
84
+ ...externalProps,
85
+ ...props,
86
+ children: content,
87
+ },
88
+ })
89
+ }
90
+ )
91
+
92
+ Link.displayName = "Link"
93
+
94
+ export { Link, linkVariants }
@@ -0,0 +1 @@
1
+ export * from "./otp-field"
@@ -0,0 +1,72 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { OTPFieldPreview as OTPFieldPrimitive } from "@base-ui/react/otp-field"
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const OTPField = React.forwardRef<
8
+ React.ComponentRef<typeof OTPFieldPrimitive.Root>,
9
+ React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Root>
10
+ >(({ className, ...props }, ref) => (
11
+ <OTPFieldPrimitive.Root
12
+ ref={ref}
13
+ className={cn(
14
+ "flex items-center gap-2",
15
+ "data-[disabled]:opacity-50",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ ))
21
+ OTPField.displayName = "OTPField"
22
+
23
+ const OTPFieldGroup = React.forwardRef<
24
+ HTMLDivElement,
25
+ React.HTMLAttributes<HTMLDivElement>
26
+ >(({ className, ...props }, ref) => (
27
+ <div
28
+ ref={ref}
29
+ className={cn("flex items-center", className)}
30
+ {...props}
31
+ />
32
+ ))
33
+ OTPFieldGroup.displayName = "OTPFieldGroup"
34
+
35
+ const OTPFieldInput = React.forwardRef<
36
+ React.ComponentRef<typeof OTPFieldPrimitive.Input>,
37
+ React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Input>
38
+ >(({ className, ...props }, ref) => (
39
+ <OTPFieldPrimitive.Input
40
+ ref={ref}
41
+ className={cn(
42
+ "relative h-10 w-10 border-y border-r border-input bg-background text-center text-sm shadow-sm outline-none transition-all",
43
+ "first:rounded-l-md first:border-l last:rounded-r-md",
44
+ "focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50",
45
+ "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
46
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ))
52
+ OTPFieldInput.displayName = "OTPFieldInput"
53
+
54
+ const OTPFieldSeparator = React.forwardRef<
55
+ React.ComponentRef<typeof OTPFieldPrimitive.Separator>,
56
+ React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Separator>
57
+ >(({ className, ...props }, ref) => (
58
+ <OTPFieldPrimitive.Separator
59
+ ref={ref}
60
+ role="separator"
61
+ className={cn("text-muted-foreground", className)}
62
+ {...props}
63
+ />
64
+ ))
65
+ OTPFieldSeparator.displayName = "OTPFieldSeparator"
66
+
67
+ export type OTPFieldProps = React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Root>
68
+ export type OTPFieldGroupProps = React.HTMLAttributes<HTMLDivElement>
69
+ export type OTPFieldInputProps = React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Input>
70
+ export type OTPFieldSeparatorProps = React.ComponentPropsWithoutRef<typeof OTPFieldPrimitive.Separator>
71
+
72
+ export { OTPField, OTPFieldGroup, OTPFieldInput, OTPFieldSeparator }
@@ -39,16 +39,18 @@ const SelectContent = React.forwardRef<
39
39
  readonly sideOffset?: number
40
40
  readonly portal?: boolean
41
41
  }
42
- >(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = true, ...props }, ref) => {
42
+ >(({ className, children, alignItemWithTrigger = false, sideOffset = 4, portal = false, ...props }, ref) => {
43
43
  const content = (
44
44
  <SelectPrimitive.Positioner
45
45
  sideOffset={sideOffset}
46
46
  alignItemWithTrigger={alignItemWithTrigger}
47
+ positionMethod="fixed"
48
+ className="z-50"
47
49
  >
48
50
  <SelectPrimitive.Popup
49
51
  ref={ref}
50
52
  className={cn(
51
- "relative z-50 max-h-96 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
53
+ "relative max-h-96 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
52
54
  "data-[open]:animate-in data-[closed]:animate-out data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95 data-[open]:zoom-in-95",
53
55
  "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
54
56
  !alignItemWithTrigger &&
@@ -73,7 +73,7 @@ const SliderThumb = React.forwardRef<
73
73
  <BaseSlider.Thumb
74
74
  ref={ref}
75
75
  className={cn(
76
- "block h-5 w-5 z-10 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors",
76
+ "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors",
77
77
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
78
78
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
79
79
  "data-[dragging]:scale-110",
@@ -0,0 +1,2 @@
1
+ export { Text, textVariants } from './text'
2
+ export type { TextProps } from './text'
@@ -0,0 +1,70 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const textVariants = cva("", {
8
+ variants: {
9
+ variant: {
10
+ h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
11
+ h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
12
+ h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
13
+ h4: "scroll-m-20 text-xl font-semibold tracking-tight",
14
+ p: "leading-7",
15
+ large: "text-lg font-semibold",
16
+ small: "text-sm font-medium leading-none",
17
+ lead: "text-xl text-muted-foreground",
18
+ muted: "text-sm text-muted-foreground",
19
+ blockquote: "border-l-2 pl-6 italic",
20
+ code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
21
+ span: "",
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ variant: "p",
26
+ },
27
+ })
28
+
29
+ type Variant = NonNullable<VariantProps<typeof textVariants>["variant"]>
30
+
31
+ const variantElementMap: Record<Variant, React.ElementType> = {
32
+ h1: "h1",
33
+ h2: "h2",
34
+ h3: "h3",
35
+ h4: "h4",
36
+ p: "p",
37
+ large: "p",
38
+ small: "p",
39
+ lead: "p",
40
+ muted: "p",
41
+ blockquote: "blockquote",
42
+ code: "code",
43
+ span: "span",
44
+ }
45
+
46
+ export interface TextProps
47
+ extends React.HTMLAttributes<HTMLElement>,
48
+ VariantProps<typeof textVariants> {
49
+ as?: React.ElementType
50
+ }
51
+
52
+ const Text = React.forwardRef<HTMLElement, TextProps>(
53
+ ({ className, variant = "p", as, children, ...props }, ref) => {
54
+ const Component = as ?? variantElementMap[variant!]
55
+
56
+ return (
57
+ <Component
58
+ ref={ref}
59
+ className={cn(textVariants({ variant }), className)}
60
+ {...props}
61
+ >
62
+ {children}
63
+ </Component>
64
+ )
65
+ }
66
+ )
67
+
68
+ Text.displayName = "Text"
69
+
70
+ export { Text, textVariants }
@@ -12,7 +12,8 @@
12
12
  "isolatedModules": true,
13
13
  "baseUrl": ".",
14
14
  "paths": {
15
- "@/lib/*": ["./utils/*"]
15
+ "@/lib/*": ["./utils/*"],
16
+ "@/components/ui/*": ["./*"]
16
17
  }
17
18
  },
18
19
  "include": ["**/*.tsx", "**/*.ts"],
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 DinachiUI
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.