@snackbit/opendil 0.0.0 → 0.1.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.
- package/LICENSE +201 -0
- package/README.md +200 -2
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/bin/opendil.mjs +20 -0
- package/bin/publish-directory.mjs +32 -0
- package/dist/chunk-ZWAN2JCV.js +2 -0
- package/dist/index.js +11 -0
- package/dist/mermaid-diagram-GFWD4Y2X.js +2 -0
- package/dist/runtime/frame.html +2362 -0
- package/dist/runtime/frame.js +4625 -0
- package/dist/runtime/vm.js +6 -0
- package/dist/shadow-renderer-F25KL3C4.js +2363 -0
- package/dist/styles.css +2361 -0
- package/dist/types/components/ui/controls/button.d.ts +10 -0
- package/dist/types/components/ui/controls/checkbox.d.ts +4 -0
- package/dist/types/components/ui/controls/input.d.ts +3 -0
- package/dist/types/components/ui/controls/radio-group.d.ts +5 -0
- package/dist/types/components/ui/controls/slider.d.ts +4 -0
- package/dist/types/components/ui/controls/textarea.d.ts +3 -0
- package/dist/types/components/ui/controls/toggle-group.d.ts +9 -0
- package/dist/types/components/ui/controls/toggle.d.ts +9 -0
- package/dist/types/components/ui/display/badge.d.ts +9 -0
- package/dist/types/components/ui/display/card.d.ts +9 -0
- package/dist/types/components/ui/display/chart.d.ts +45 -0
- package/dist/types/components/ui/display/separator.d.ts +4 -0
- package/dist/types/components/ui/display/skeleton.d.ts +2 -0
- package/dist/types/components/ui/display/table.d.ts +10 -0
- package/dist/types/components/ui/media/carousel.d.ts +19 -0
- package/dist/types/components/ui/overlays/popover.d.ts +10 -0
- package/dist/types/components/ui/overlays/tooltip.d.ts +8 -0
- package/dist/types/components/ui/overlays/ui-scope.d.ts +11 -0
- package/dist/types/dil/custom-component.d.ts +14 -0
- package/dist/types/dil/customization.d.ts +21 -0
- package/dist/types/dil/dil-renderer.d.ts +55 -0
- package/dist/types/dil/isolation/frame.d.ts +1 -0
- package/dist/types/dil/isolation/isolated-renderer.d.ts +22 -0
- package/dist/types/dil/isolation/shadow-renderer.d.ts +7 -0
- package/dist/types/dil/isolation/shadow-styles.d.ts +2 -0
- package/dist/types/dil/isolation/viewport-scroll.d.ts +6 -0
- package/dist/types/dil/isolation/vm-worker.d.ts +1 -0
- package/dist/types/dil/message-renderer.d.ts +16 -0
- package/dist/types/dil/parser/dil-parser.d.ts +33 -0
- package/dist/types/dil/parser/lexical.d.ts +16 -0
- package/dist/types/dil/parser/stream-worker.d.ts +1 -0
- package/dist/types/dil/parser/types.d.ts +32 -0
- package/dist/types/dil/renderer-environment.d.ts +22 -0
- package/dist/types/dil/renderer-handle.d.ts +4 -0
- package/dist/types/dil/runtime/action-receipt.d.ts +5 -0
- package/dist/types/dil/runtime/child-list.d.ts +8 -0
- package/dist/types/dil/runtime/document.d.ts +42 -0
- package/dist/types/dil/runtime/evaluation-cache.d.ts +24 -0
- package/dist/types/dil/runtime/execution-queue.d.ts +55 -0
- package/dist/types/dil/runtime/expressions.d.ts +59 -0
- package/dist/types/dil/runtime/markdown-stream.d.ts +17 -0
- package/dist/types/dil/runtime/presentation-history.d.ts +14 -0
- package/dist/types/dil/runtime/presentation-scheduler.d.ts +16 -0
- package/dist/types/dil/runtime/render-budget.d.ts +10 -0
- package/dist/types/dil/runtime/view-cost.d.ts +10 -0
- package/dist/types/dil/view/conditional-view.d.ts +12 -0
- package/dist/types/dil/view/loading-block.d.ts +7 -0
- package/dist/types/dil/view/markdown-node.d.ts +12 -0
- package/dist/types/dil/view/node-children.d.ts +13 -0
- package/dist/types/dil/view/node-view.d.ts +11 -0
- package/dist/types/dil/view/progressive-reveal.d.ts +6 -0
- package/dist/types/dil/view/render-boundary.d.ts +22 -0
- package/dist/types/dil/view/render-limit.d.ts +14 -0
- package/dist/types/dil/view/repeated-nodes.d.ts +15 -0
- package/dist/types/dil/view/reveal/controller.d.ts +25 -0
- package/dist/types/dil/view/reveal/presentation.d.ts +13 -0
- package/dist/types/dil/view/reveal-options.d.ts +11 -0
- package/dist/types/dil/view/scroll/controller.d.ts +28 -0
- package/dist/types/dil/view/scroll-options.d.ts +10 -0
- package/dist/types/dil/view/stream-follow.d.ts +8 -0
- package/dist/types/dil/view/table-context.d.ts +15 -0
- package/dist/types/dil/view/virtual-flow.d.ts +15 -0
- package/dist/types/dil/widgets/action-feedback.d.ts +11 -0
- package/dist/types/dil/widgets/async-image.d.ts +6 -0
- package/dist/types/dil/widgets/charts/chart-legend.d.ts +10 -0
- package/dist/types/dil/widgets/charts/chart-selection.d.ts +8 -0
- package/dist/types/dil/widgets/charts/chart-series.d.ts +11 -0
- package/dist/types/dil/widgets/charts/chart-snapping.d.ts +15 -0
- package/dist/types/dil/widgets/charts/dil-chart.d.ts +5 -0
- package/dist/types/dil/widgets/charts/snap-cursor.d.ts +16 -0
- package/dist/types/dil/widgets/charts/snap-tooltip.d.ts +10 -0
- package/dist/types/dil/widgets/code/code-editor.d.ts +9 -0
- package/dist/types/dil/widgets/code/highlighted-code.d.ts +25 -0
- package/dist/types/dil/widgets/code-block.d.ts +11 -0
- package/dist/types/dil/widgets/control-revision.d.ts +1 -0
- package/dist/types/dil/widgets/control-state.d.ts +8 -0
- package/dist/types/dil/widgets/controls.d.ts +25 -0
- package/dist/types/dil/widgets/graphs/graph-model.d.ts +13 -0
- package/dist/types/dil/widgets/graphs/node-graph.d.ts +6 -0
- package/dist/types/dil/widgets/graphs/service-node.d.ts +3 -0
- package/dist/types/dil/widgets/mermaid-diagram.d.ts +5 -0
- package/dist/types/dil/widgets/primitives/attribute-values.d.ts +12 -0
- package/dist/types/dil/widgets/primitives/primitive.d.ts +17 -0
- package/dist/types/dil/widgets/primitives/vocabulary.d.ts +5 -0
- package/dist/types/dil/widgets/use-control-value.d.ts +2 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/lib/cn.d.ts +2 -0
- package/dist/types/ui.d.ts +8 -0
- package/dist/ui.js +2 -0
- package/package.json +74 -4
- package/styles/tailwind.css +391 -0
- package/styles/tokens.css +29 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
|
|
3
|
+
declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
|
|
5
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
|
|
4
|
+
import { toggleVariants } from "./toggle";
|
|
5
|
+
declare function ToggleGroup({ className, variant, size, spacing, children, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & {
|
|
6
|
+
spacing?: number;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
9
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Toggle as TogglePrimitive } from "radix-ui";
|
|
4
|
+
declare const toggleVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): React.JSX.Element;
|
|
9
|
+
export { Toggle, toggleVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
7
|
+
asChild?: boolean;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as RechartsPrimitive from "recharts";
|
|
3
|
+
import type { TooltipValueType } from "recharts";
|
|
4
|
+
declare const THEMES: {
|
|
5
|
+
readonly light: "";
|
|
6
|
+
readonly dark: ".dark";
|
|
7
|
+
};
|
|
8
|
+
type TooltipNameType = number | string;
|
|
9
|
+
export type ChartConfig = Record<string, {
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
icon?: React.ComponentType;
|
|
12
|
+
} & ({
|
|
13
|
+
color?: string;
|
|
14
|
+
theme?: never;
|
|
15
|
+
} | {
|
|
16
|
+
color?: never;
|
|
17
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
18
|
+
})>;
|
|
19
|
+
declare function ChartContainer({ id, className, children, config, overlay, initialDimension, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
config: ChartConfig;
|
|
21
|
+
overlay?: React.ReactNode;
|
|
22
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
23
|
+
initialDimension?: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
declare const ChartStyle: ({ id, config }: {
|
|
29
|
+
id: string;
|
|
30
|
+
config: ChartConfig;
|
|
31
|
+
}) => React.JSX.Element | null;
|
|
32
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
33
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<"div"> & {
|
|
34
|
+
hideLabel?: boolean;
|
|
35
|
+
hideIndicator?: boolean;
|
|
36
|
+
indicator?: "line" | "dot" | "dashed";
|
|
37
|
+
nameKey?: string;
|
|
38
|
+
labelKey?: string;
|
|
39
|
+
} & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, "accessibilityLayer">): React.JSX.Element | null;
|
|
40
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
41
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React.ComponentProps<"div"> & {
|
|
42
|
+
hideIcon?: boolean;
|
|
43
|
+
nameKey?: string;
|
|
44
|
+
} & RechartsPrimitive.DefaultLegendContentProps): React.JSX.Element | null;
|
|
45
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import useEmblaCarousel, { type UseEmblaCarouselType } from "embla-carousel-react";
|
|
3
|
+
import { Button } from "../controls/button";
|
|
4
|
+
type CarouselApi = UseEmblaCarouselType[1];
|
|
5
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
6
|
+
type CarouselOptions = UseCarouselParameters[0];
|
|
7
|
+
type CarouselPlugin = UseCarouselParameters[1];
|
|
8
|
+
type CarouselProps = {
|
|
9
|
+
opts?: CarouselOptions;
|
|
10
|
+
plugins?: CarouselPlugin;
|
|
11
|
+
orientation?: "horizontal" | "vertical";
|
|
12
|
+
setApi?: (api: CarouselApi) => void;
|
|
13
|
+
};
|
|
14
|
+
declare function Carousel({ orientation, opts, setApi, plugins, className, children, ...props }: React.ComponentProps<"div"> & CarouselProps): React.JSX.Element;
|
|
15
|
+
declare function CarouselContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
16
|
+
declare function CarouselItem({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function CarouselPrevious({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
18
|
+
declare function CarouselNext({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
19
|
+
export { type CarouselApi, Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
3
|
+
declare function Popover({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Root>): React.JSX.Element;
|
|
4
|
+
declare function PopoverTrigger({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Trigger>): React.JSX.Element;
|
|
5
|
+
declare function PopoverContent({ className, align, sideOffset, ...props }: React.ComponentProps<typeof PopoverPrimitive.Content>): React.JSX.Element;
|
|
6
|
+
declare function PopoverAnchor({ ...props }: React.ComponentProps<typeof PopoverPrimitive.Anchor>): React.JSX.Element;
|
|
7
|
+
declare function PopoverHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">): React.JSX.Element;
|
|
9
|
+
declare function PopoverDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
10
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverHeader, PopoverTitle, PopoverDescription, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface TooltipProps {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Controls visibility; omit for hover and focus behavior. */
|
|
6
|
+
open?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function Tooltip({ label, children, open }: TooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
export declare function usePortalScope(): {
|
|
3
|
+
container: HTMLElement | null;
|
|
4
|
+
boundary?: Element;
|
|
5
|
+
};
|
|
6
|
+
export interface UiScopeProps extends ComponentProps<"section"> {
|
|
7
|
+
appearance?: "light" | "dark";
|
|
8
|
+
tokens?: Readonly<Record<`--${string}`, string>>;
|
|
9
|
+
boundary?: Element;
|
|
10
|
+
}
|
|
11
|
+
export declare function UiScope({ children, className, style, appearance, tokens, boundary, ...props }: UiScopeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import type { DilComponentProps } from "./customization";
|
|
3
|
+
export interface CustomComponentProps {
|
|
4
|
+
component: ComponentType<DilComponentProps>;
|
|
5
|
+
name: string;
|
|
6
|
+
attributes: Readonly<Record<string, unknown>>;
|
|
7
|
+
config: Readonly<Record<string, unknown>>;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className: string;
|
|
10
|
+
slots: Readonly<Record<string, string>>;
|
|
11
|
+
ready: boolean;
|
|
12
|
+
presentationRef?: ((element: HTMLElement | null) => void) | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function CustomComponent({ component: Component, attributes, ...props }: CustomComponentProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
export interface DilComponentProps {
|
|
3
|
+
name: string;
|
|
4
|
+
attributes: Readonly<Record<string, unknown>>;
|
|
5
|
+
config: Readonly<Record<string, unknown>>;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
className: string;
|
|
8
|
+
slots: Readonly<Record<string, string>>;
|
|
9
|
+
ready: boolean;
|
|
10
|
+
invoke: (attribute: string, value?: unknown) => void;
|
|
11
|
+
/** Forward to the visual root to participate in progressive reveal. */
|
|
12
|
+
presentationRef?: ((element: HTMLElement | null) => void) | undefined;
|
|
13
|
+
}
|
|
14
|
+
export interface DilCustomization {
|
|
15
|
+
components?: Readonly<Record<string, ComponentType<DilComponentProps>>>;
|
|
16
|
+
componentConfig?: Readonly<Record<string, Readonly<Record<string, unknown>>>>;
|
|
17
|
+
classNames?: Readonly<Record<string, string>>;
|
|
18
|
+
slots?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
19
|
+
}
|
|
20
|
+
export declare const CustomizationContext: import("react").Context<DilCustomization>;
|
|
21
|
+
export declare function useCustomization(): DilCustomization;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
import type { DilRendererHandle } from "./renderer-handle";
|
|
3
|
+
import { type DilCustomization } from "./customization";
|
|
4
|
+
import { type RendererMetrics } from "./renderer-environment";
|
|
5
|
+
import type { ProgressiveReveal } from "./view/reveal-options";
|
|
6
|
+
import type { AutoScroll } from "./view/scroll-options";
|
|
7
|
+
import { type UpdateInterval } from "./runtime/presentation-scheduler";
|
|
8
|
+
interface DilCommonProps {
|
|
9
|
+
ref?: Ref<DilRendererHandle> | undefined;
|
|
10
|
+
/** Append-only source prefix. Remount with a new key to replace it. */
|
|
11
|
+
text: string;
|
|
12
|
+
isStreaming?: boolean;
|
|
13
|
+
/** Show the receiving/completion label without affecting errors. */
|
|
14
|
+
showStatus?: boolean;
|
|
15
|
+
/** Stagger newly shown blocks; disabled by default and under reduced motion. */
|
|
16
|
+
progressiveReveal?: ProgressiveReveal;
|
|
17
|
+
autoScroll?: AutoScroll;
|
|
18
|
+
/** Maximum streaming presentation frequency; user interaction remains immediate. */
|
|
19
|
+
updateInterval?: UpdateInterval;
|
|
20
|
+
onFollowChange?: (following: boolean) => void;
|
|
21
|
+
onInput?: (detail: {
|
|
22
|
+
length: number;
|
|
23
|
+
}) => void;
|
|
24
|
+
onCommit?: (detail: RendererMetrics) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface DilIsolatedRendererProps extends DilCommonProps {
|
|
27
|
+
mode?: "isolated";
|
|
28
|
+
runtimeBaseUrl?: string;
|
|
29
|
+
components?: never;
|
|
30
|
+
componentConfig?: never;
|
|
31
|
+
classNames?: never;
|
|
32
|
+
slots?: never;
|
|
33
|
+
tokens?: never;
|
|
34
|
+
className?: never;
|
|
35
|
+
appearance?: never;
|
|
36
|
+
shadowStyles?: never;
|
|
37
|
+
}
|
|
38
|
+
interface DilStyledRendererProps extends DilCommonProps, DilCustomization {
|
|
39
|
+
runtimeBaseUrl?: never;
|
|
40
|
+
className?: string;
|
|
41
|
+
tokens?: Readonly<Record<`--${string}`, string>>;
|
|
42
|
+
appearance?: "light" | "dark";
|
|
43
|
+
}
|
|
44
|
+
export interface DilHostRendererProps extends DilStyledRendererProps {
|
|
45
|
+
mode: "host";
|
|
46
|
+
shadowStyles?: never;
|
|
47
|
+
}
|
|
48
|
+
export interface DilShadowRendererProps extends DilStyledRendererProps {
|
|
49
|
+
mode: "shadow";
|
|
50
|
+
/** Trusted application CSS installed inside this renderer's ShadowRoot. */
|
|
51
|
+
shadowStyles?: string;
|
|
52
|
+
}
|
|
53
|
+
export type DilRendererProps = DilIsolatedRendererProps | DilHostRendererProps | DilShadowRendererProps;
|
|
54
|
+
export declare function DilRenderer(props: DilRendererProps): import("react").JSX.Element;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
import type { DilRendererHandle } from "../renderer-handle";
|
|
3
|
+
import type { RendererMetrics } from "../renderer-environment";
|
|
4
|
+
import type { ProgressiveReveal } from "../view/reveal-options";
|
|
5
|
+
import type { AutoScroll } from "../view/scroll-options";
|
|
6
|
+
import type { UpdateInterval } from "../runtime/presentation-scheduler";
|
|
7
|
+
export interface IsolatedRendererProps {
|
|
8
|
+
ref?: Ref<DilRendererHandle> | undefined;
|
|
9
|
+
text: string;
|
|
10
|
+
isStreaming?: boolean;
|
|
11
|
+
showStatus?: boolean;
|
|
12
|
+
progressiveReveal?: ProgressiveReveal;
|
|
13
|
+
autoScroll?: AutoScroll;
|
|
14
|
+
updateInterval?: UpdateInterval;
|
|
15
|
+
onFollowChange?: (following: boolean) => void;
|
|
16
|
+
runtimeBaseUrl?: string;
|
|
17
|
+
onInput?: (detail: {
|
|
18
|
+
length: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
onCommit?: (detail: RendererMetrics) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function IsolatedRenderer({ ref, text, isStreaming, showStatus, progressiveReveal, autoScroll, updateInterval, onFollowChange, runtimeBaseUrl, onInput, onCommit, }: IsolatedRendererProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface ShadowRendererProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
shadowStyles?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
/** DOM/style encapsulation only. Expression isolation remains in the QuickJS worker. */
|
|
7
|
+
export declare function ShadowRenderer({ children, shadowStyles, }: ShadowRendererProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FrameViewport } from "../renderer-environment";
|
|
2
|
+
/** Coalesce measurement corrections after layout; discard them if the reader moved meanwhile. */
|
|
3
|
+
export declare function viewportScroller(viewport: FrameViewport, send: (offset: number, revision: number) => void): {
|
|
4
|
+
scroll(offset: number): void;
|
|
5
|
+
dispose(): void;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
import type { DilRendererHandle } from "./renderer-handle";
|
|
3
|
+
import type { ProgressiveReveal } from "./view/reveal-options";
|
|
4
|
+
import type { AutoScroll } from "./view/scroll-options";
|
|
5
|
+
import type { UpdateInterval } from "./runtime/presentation-scheduler";
|
|
6
|
+
export interface MessageRendererProps {
|
|
7
|
+
rendererRef?: Ref<DilRendererHandle> | undefined;
|
|
8
|
+
text: string;
|
|
9
|
+
isStreaming?: boolean;
|
|
10
|
+
showStatus?: boolean;
|
|
11
|
+
progressiveReveal?: ProgressiveReveal;
|
|
12
|
+
autoScroll?: AutoScroll;
|
|
13
|
+
updateInterval?: UpdateInterval;
|
|
14
|
+
onFollowChange?: ((following: boolean) => void) | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function MessageRenderer({ rendererRef, text, isStreaming, showStatus, progressiveReveal, autoScroll, updateInterval, onFollowChange, }: MessageRendererProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DilNode, TreeBatch } from "./types";
|
|
2
|
+
/** Append-only parser. Closed tokens are never scanned again. */
|
|
3
|
+
export declare class DilParser {
|
|
4
|
+
private source;
|
|
5
|
+
private cursor;
|
|
6
|
+
private textStart;
|
|
7
|
+
private tokenStart;
|
|
8
|
+
private mode;
|
|
9
|
+
private lexical;
|
|
10
|
+
private fence;
|
|
11
|
+
private tokenNode;
|
|
12
|
+
private nodes;
|
|
13
|
+
private children;
|
|
14
|
+
private stack;
|
|
15
|
+
private dirty;
|
|
16
|
+
private links;
|
|
17
|
+
private declarations;
|
|
18
|
+
private revision;
|
|
19
|
+
constructor();
|
|
20
|
+
private get parent();
|
|
21
|
+
private closeFrame;
|
|
22
|
+
private create;
|
|
23
|
+
private touch;
|
|
24
|
+
private markdown;
|
|
25
|
+
private flushText;
|
|
26
|
+
private finishMarkdown;
|
|
27
|
+
private finish;
|
|
28
|
+
private fail;
|
|
29
|
+
private directive;
|
|
30
|
+
private tag;
|
|
31
|
+
append(suffix: string, complete?: boolean): TreeBatch;
|
|
32
|
+
snapshot(): DilNode[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Attribute } from "./types";
|
|
2
|
+
export declare class LexicalState {
|
|
3
|
+
depth: number;
|
|
4
|
+
quote: string;
|
|
5
|
+
escaped: boolean;
|
|
6
|
+
comment: string;
|
|
7
|
+
regex: boolean;
|
|
8
|
+
characterClass: boolean;
|
|
9
|
+
previous: string;
|
|
10
|
+
templates: number[];
|
|
11
|
+
consume(char: string, next: string): number;
|
|
12
|
+
get neutral(): boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function fenceMarker(source: string, cursor: number, current: string): string | undefined;
|
|
15
|
+
export declare function braceEnd(source: string, start: number): number;
|
|
16
|
+
export declare function parseAttributes(source: string): Record<string, Attribute>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type NodeKind = "root" | "element" | "markdown" | "if" | "branch" | "each" | "pending";
|
|
2
|
+
export type NodeStatus = "streaming" | "ready" | "error";
|
|
3
|
+
export interface Attribute {
|
|
4
|
+
expression?: string;
|
|
5
|
+
literal?: string | boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DilNode {
|
|
8
|
+
id: number;
|
|
9
|
+
kind: NodeKind;
|
|
10
|
+
name: string;
|
|
11
|
+
attributes: Record<string, Attribute>;
|
|
12
|
+
text: string;
|
|
13
|
+
expressions: string[];
|
|
14
|
+
status: NodeStatus;
|
|
15
|
+
offset: number;
|
|
16
|
+
error: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TreeBatch {
|
|
19
|
+
revision: number;
|
|
20
|
+
nodes: DilNode[];
|
|
21
|
+
links: {
|
|
22
|
+
parent: number;
|
|
23
|
+
child: number;
|
|
24
|
+
}[];
|
|
25
|
+
declarations: string[];
|
|
26
|
+
complete: boolean;
|
|
27
|
+
scanned: number;
|
|
28
|
+
}
|
|
29
|
+
export interface StreamInput {
|
|
30
|
+
suffix: string;
|
|
31
|
+
complete: boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface FrameViewport {
|
|
2
|
+
offset: number;
|
|
3
|
+
revision: number;
|
|
4
|
+
height: number;
|
|
5
|
+
width: number;
|
|
6
|
+
listeners: Set<() => void>;
|
|
7
|
+
}
|
|
8
|
+
export interface RendererMetrics {
|
|
9
|
+
scanned: number;
|
|
10
|
+
complete: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface RendererEnvironment {
|
|
13
|
+
viewport?: FrameViewport;
|
|
14
|
+
scrollTo?: (offset: number) => void;
|
|
15
|
+
copy?: (text: string) => Promise<boolean>;
|
|
16
|
+
onInput?: (detail: {
|
|
17
|
+
length: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
onCommit?: (detail: RendererMetrics) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const RendererEnvironmentContext: import("react").Context<RendererEnvironment>;
|
|
22
|
+
export declare function useRendererEnvironment(): RendererEnvironment;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type StoreApi } from "zustand/vanilla";
|
|
2
|
+
import type { DilNode, TreeBatch } from "../parser/types";
|
|
3
|
+
import { ChildList } from "./child-list";
|
|
4
|
+
import { ExpressionEngine, type Scope } from "./expressions";
|
|
5
|
+
import { RenderBudget } from "./render-budget";
|
|
6
|
+
import { PresentationHistory } from "./presentation-history";
|
|
7
|
+
import { PresentationScheduler } from "./presentation-scheduler";
|
|
8
|
+
export interface NodeState {
|
|
9
|
+
node: DilNode;
|
|
10
|
+
children: ChildList;
|
|
11
|
+
}
|
|
12
|
+
export interface DocumentStatus {
|
|
13
|
+
complete: boolean;
|
|
14
|
+
revision: number;
|
|
15
|
+
scanned: number;
|
|
16
|
+
error: string;
|
|
17
|
+
/** Latest clipboard outcome, keyed by the intent of the action that requested it. */
|
|
18
|
+
clipboard: {
|
|
19
|
+
intent: number;
|
|
20
|
+
ok: boolean;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
export declare class DilDocument {
|
|
24
|
+
readonly updates: PresentationScheduler;
|
|
25
|
+
readonly presentation: PresentationHistory;
|
|
26
|
+
readonly renderBudget: RenderBudget;
|
|
27
|
+
renderLimited: boolean;
|
|
28
|
+
reportRenderLimit(): void;
|
|
29
|
+
readonly nodes: Map<number, NodeState>;
|
|
30
|
+
private readonly stores;
|
|
31
|
+
private readonly parents;
|
|
32
|
+
private readonly flows;
|
|
33
|
+
readonly status: StoreApi<DocumentStatus>;
|
|
34
|
+
readonly engine: ExpressionEngine;
|
|
35
|
+
readonly drafts: Map<string, string>;
|
|
36
|
+
constructor();
|
|
37
|
+
apply(batch: TreeBatch): void;
|
|
38
|
+
private presentedChildren;
|
|
39
|
+
flowChildren(id: number): StoreApi<ChildList>;
|
|
40
|
+
node(id: number): StoreApi<NodeState>;
|
|
41
|
+
attributes(node: DilNode, scope: Scope): Record<string, unknown>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type Scope = Readonly<Record<string, unknown>>;
|
|
2
|
+
export interface EvaluationEntry {
|
|
3
|
+
source: string;
|
|
4
|
+
scope: Scope;
|
|
5
|
+
owners: number;
|
|
6
|
+
oneShot: boolean;
|
|
7
|
+
ready: boolean;
|
|
8
|
+
dirty: boolean;
|
|
9
|
+
value: unknown;
|
|
10
|
+
dependencies?: readonly string[];
|
|
11
|
+
revision: number;
|
|
12
|
+
invalidated: number;
|
|
13
|
+
handles: readonly number[];
|
|
14
|
+
}
|
|
15
|
+
export declare class EvaluationCache {
|
|
16
|
+
readonly entries: Map<string, EvaluationEntry>;
|
|
17
|
+
key(source: string, scope: Scope): string;
|
|
18
|
+
ensure(source: string, scope: Scope): {
|
|
19
|
+
key: string;
|
|
20
|
+
entry: EvaluationEntry;
|
|
21
|
+
};
|
|
22
|
+
touch(key: string): void;
|
|
23
|
+
prune(busy: (key: string) => boolean, evict: (key: string, entry: EvaluationEntry) => void): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ExecutionReply {
|
|
2
|
+
id: number;
|
|
3
|
+
value?: unknown;
|
|
4
|
+
error?: string;
|
|
5
|
+
changed?: boolean;
|
|
6
|
+
revision?: number;
|
|
7
|
+
dependencies?: string[];
|
|
8
|
+
bindings?: string[];
|
|
9
|
+
handles?: number[];
|
|
10
|
+
copy?: string;
|
|
11
|
+
/** The VM can no longer be trusted; the document must stop. */
|
|
12
|
+
fatal?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Worker replies cross the VM boundary; keep only well-formed fields. */
|
|
15
|
+
export declare function readReply(data: unknown): ExecutionReply | undefined;
|
|
16
|
+
export interface ExecutionJob {
|
|
17
|
+
type: string;
|
|
18
|
+
payload: Record<string, unknown>;
|
|
19
|
+
key?: string;
|
|
20
|
+
setter?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Bounded transport window; waiting evaluations never consume execution deadlines. */
|
|
23
|
+
export declare class ExecutionQueue {
|
|
24
|
+
private readonly post;
|
|
25
|
+
private readonly receive;
|
|
26
|
+
private readonly failure;
|
|
27
|
+
private next;
|
|
28
|
+
private pending;
|
|
29
|
+
private evaluations;
|
|
30
|
+
private activeKeys;
|
|
31
|
+
private mutations;
|
|
32
|
+
private setters;
|
|
33
|
+
private draining;
|
|
34
|
+
private stopped;
|
|
35
|
+
constructor(post: (message: Record<string, unknown>) => void, receive: (job: ExecutionJob, reply: ExecutionReply) => void, failure: (message: string) => void);
|
|
36
|
+
get stats(): {
|
|
37
|
+
inFlight: number;
|
|
38
|
+
evaluations: number;
|
|
39
|
+
queued: number;
|
|
40
|
+
mutations: number;
|
|
41
|
+
};
|
|
42
|
+
has(key: string): boolean;
|
|
43
|
+
evaluate(key: string, payload: Record<string, unknown>): boolean;
|
|
44
|
+
cancel(key: string): void;
|
|
45
|
+
mutate(job: ExecutionJob): {
|
|
46
|
+
payload: Record<string, unknown>;
|
|
47
|
+
type: string;
|
|
48
|
+
key?: string;
|
|
49
|
+
setter?: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
reply(data: unknown): void;
|
|
52
|
+
private dispatch;
|
|
53
|
+
private drain;
|
|
54
|
+
stop(): void;
|
|
55
|
+
}
|