@snackbit/opendil 0.1.0 → 0.2.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.
Files changed (88) hide show
  1. package/README.md +74 -137
  2. package/bin/opendil.mjs +66 -11
  3. package/bin/publish-directory.d.mts +18 -0
  4. package/bin/publish-directory.mjs +173 -17
  5. package/dist/agent-spec.js +9 -0
  6. package/dist/chunk-RPZW4WVX.js +2 -0
  7. package/dist/chunk-ZSTXLIS6.js +2 -0
  8. package/dist/index.js +1 -10
  9. package/dist/runtime/frame.html +117 -44
  10. package/dist/runtime/frame.js +501 -505
  11. package/dist/spec/genui.agent.full.md +1927 -0
  12. package/dist/spec/genui.agent.md +479 -0
  13. package/dist/spec/genui.examples.md +836 -0
  14. package/dist/styled-renderer-PHI4MNPF.js +2441 -0
  15. package/dist/styles.css +115 -42
  16. package/dist/types/agent-spec.d.ts +12 -0
  17. package/dist/types/components/ui/controls/select.d.ts +14 -0
  18. package/dist/types/components/ui/controls/tabs.d.ts +7 -0
  19. package/dist/types/components/ui/controls/toggle-group.d.ts +3 -2
  20. package/dist/types/components/ui/display/chart.d.ts +6 -12
  21. package/dist/types/components/ui/media/carousel.d.ts +1 -1
  22. package/dist/types/components/ui/overlays/collapsible.d.ts +6 -0
  23. package/dist/types/components/ui/overlays/popover.d.ts +2 -1
  24. package/dist/types/components/ui/overlays/ui-scope.d.ts +16 -0
  25. package/dist/types/dil/custom-component.d.ts +1 -1
  26. package/dist/types/dil/dil-renderer.d.ts +58 -23
  27. package/dist/types/dil/isolation/frame-startup.d.ts +18 -0
  28. package/dist/types/dil/isolation/frame-theme.d.ts +14 -0
  29. package/dist/types/dil/isolation/frame-viewport.d.ts +30 -0
  30. package/dist/types/dil/isolation/isolated-renderer.d.ts +13 -7
  31. package/dist/types/dil/isolation/overlay-room.d.ts +29 -0
  32. package/dist/types/dil/isolation/viewport-scroll.d.ts +3 -2
  33. package/dist/types/dil/message-renderer.d.ts +6 -5
  34. package/dist/types/dil/parser/dil-parser.d.ts +44 -3
  35. package/dist/types/dil/parser/lexical.d.ts +13 -2
  36. package/dist/types/dil/parser/literal-tag.d.ts +16 -0
  37. package/dist/types/dil/parser/markdown-lexing.d.ts +41 -0
  38. package/dist/types/dil/parser/types.d.ts +22 -1
  39. package/dist/types/dil/parser/unfinished.d.ts +22 -0
  40. package/dist/types/dil/parser/vocabulary.d.ts +12 -0
  41. package/dist/types/dil/render-error.d.ts +47 -0
  42. package/dist/types/dil/renderer-environment.d.ts +19 -8
  43. package/dist/types/dil/runtime/document.d.ts +18 -6
  44. package/dist/types/dil/runtime/execution-queue.d.ts +2 -1
  45. package/dist/types/dil/runtime/expressions.d.ts +8 -5
  46. package/dist/types/dil/runtime/inline-worker.d.ts +33 -0
  47. package/dist/types/dil/runtime/view-cost.d.ts +2 -2
  48. package/dist/types/dil/styled-renderer.d.ts +39 -0
  49. package/dist/types/dil/view/conditional-view.d.ts +3 -3
  50. package/dist/types/dil/view/markdown-node.d.ts +3 -3
  51. package/dist/types/dil/view/node-children.d.ts +3 -3
  52. package/dist/types/dil/view/node-view.d.ts +2 -2
  53. package/dist/types/dil/view/progressive-reveal.d.ts +5 -4
  54. package/dist/types/dil/view/render-boundary.d.ts +13 -0
  55. package/dist/types/dil/view/render-limit.d.ts +1 -1
  56. package/dist/types/dil/view/repeated-nodes.d.ts +4 -4
  57. package/dist/types/dil/view/reveal/controller.d.ts +9 -2
  58. package/dist/types/dil/view/reveal/presentation.d.ts +1 -1
  59. package/dist/types/dil/view/scroll/controller.d.ts +16 -2
  60. package/dist/types/dil/view/scroll/host-viewport.d.ts +24 -0
  61. package/dist/types/dil/view/scroll/root-tracker.d.ts +17 -0
  62. package/dist/types/dil/view/scroll/scroll-root.d.ts +36 -0
  63. package/dist/types/dil/view/scroll-options.d.ts +15 -0
  64. package/dist/types/dil/view/stream-follow.d.ts +10 -3
  65. package/dist/types/dil/view/table-context.d.ts +1 -1
  66. package/dist/types/dil/view/virtual-flow.d.ts +3 -3
  67. package/dist/types/dil/widgets/action-feedback.d.ts +1 -1
  68. package/dist/types/dil/widgets/charts/chart-hover.d.ts +17 -0
  69. package/dist/types/dil/widgets/charts/chart-legend.d.ts +1 -1
  70. package/dist/types/dil/widgets/charts/chart-pie.d.ts +16 -0
  71. package/dist/types/dil/widgets/charts/chart-series.d.ts +10 -2
  72. package/dist/types/dil/widgets/charts/chart-snapping.d.ts +3 -5
  73. package/dist/types/dil/widgets/charts/snap-cursor.d.ts +3 -7
  74. package/dist/types/dil/widgets/charts/snap-tooltip.d.ts +6 -4
  75. package/dist/types/dil/widgets/code-block.d.ts +1 -1
  76. package/dist/types/dil/widgets/controls.d.ts +2 -2
  77. package/dist/types/dil/widgets/graphs/node-graph.d.ts +1 -1
  78. package/dist/types/dil/widgets/graphs/service-node.d.ts +1 -1
  79. package/dist/types/dil/widgets/primitives/primitive.d.ts +4 -4
  80. package/dist/types/index.d.ts +9 -8
  81. package/dist/types/ui.d.ts +11 -8
  82. package/dist/ui.js +1 -1
  83. package/package.json +13 -2
  84. package/styles/tailwind.css +53 -1
  85. package/styles/tokens.css +3 -0
  86. package/dist/chunk-ZWAN2JCV.js +0 -2
  87. package/dist/runtime/vm.js +0 -6
  88. package/dist/shadow-renderer-F25KL3C4.js +0 -2363
@@ -3,6 +3,9 @@
3
3
  @import "@xyflow/react/dist/style.css";
4
4
  @import "./tokens.css";
5
5
 
6
+ /* Follows the renderer's appearance instead of the operating system or a page-wide class. */
7
+ @custom-variant dil-dark (&:where(.dil-scope[data-theme="dark"], .dil-scope[data-theme="dark"] *));
8
+
6
9
  .dil-scope {
7
10
  --background: #ffffff;
8
11
  --foreground: var(--dil-text-color);
@@ -59,6 +62,12 @@
59
62
  --radius-xl: calc(var(--radius) + 4px);
60
63
  }
61
64
  @layer base {
65
+ /* Contains absolutely positioned descendants, such as screen-reader status
66
+ regions, so they scroll with the renderer inside overflow containers. In the
67
+ base layer, position utilities passed through className still win. */
68
+ .dil-scope {
69
+ position: relative;
70
+ }
62
71
  .dil-scope *,
63
72
  .dil-scope *::before,
64
73
  .dil-scope *::after {
@@ -71,8 +80,14 @@
71
80
  .dil-scope p {
72
81
  margin: 0;
73
82
  }
83
+ /* User-agent form colors follow color-scheme, not the renderer tokens. */
84
+ .dil-scope :is(button, input, select, textarea) {
85
+ color: inherit;
86
+ background-color: transparent;
87
+ }
74
88
  }
75
89
  .dil-scope {
90
+ color-scheme: light;
76
91
  background: var(--background);
77
92
  color: var(--foreground);
78
93
  font-family: var(--font-dil);
@@ -89,6 +104,7 @@
89
104
  font: inherit;
90
105
  }
91
106
  .dil-scope[data-theme="dark"] {
107
+ color-scheme: dark;
92
108
  --background: #171717;
93
109
  --foreground: #fafafa;
94
110
  --dil-text-color: #fafafa;
@@ -107,6 +123,11 @@
107
123
  --accent-foreground: #fafafa;
108
124
  --border: #454545;
109
125
  --input: #505050;
126
+ --dil-success: #5cc59a;
127
+ --dil-warning: #e2ad55;
128
+ --dil-success-surface: #1d3a2f;
129
+ --dil-warning-surface: #3d3020;
130
+ --dil-danger-surface: #432526;
110
131
  }
111
132
  .dil-document {
112
133
  overflow-wrap: anywhere;
@@ -134,6 +155,30 @@
134
155
  .dil-markdown strong {
135
156
  font-weight: 600;
136
157
  }
158
+ /* The browser's list and quote styles, restated so a host page's CSS reset,
159
+ such as Tailwind's preflight, does not remove bullets, numbers and indents. */
160
+ .dil-markdown :where(ul, ol) {
161
+ margin-block: 1em;
162
+ padding-inline-start: 40px;
163
+ }
164
+ .dil-markdown :where(ul, ol) :where(ul, ol) {
165
+ margin-block: 0;
166
+ }
167
+ .dil-markdown ul {
168
+ list-style-type: disc;
169
+ }
170
+ .dil-markdown :where(ul, ol) ul {
171
+ list-style-type: circle;
172
+ }
173
+ .dil-markdown :where(ul, ol) :where(ul, ol) ul {
174
+ list-style-type: square;
175
+ }
176
+ .dil-markdown ol {
177
+ list-style-type: decimal;
178
+ }
179
+ .dil-markdown blockquote {
180
+ margin: 1em 40px;
181
+ }
137
182
  .dil-markdown table {
138
183
  width: 100%;
139
184
  border-collapse: collapse;
@@ -224,7 +269,6 @@
224
269
  }
225
270
  .dil-legend-item[data-hidden="true"] {
226
271
  opacity: 0.45;
227
- text-decoration: line-through;
228
272
  }
229
273
  .dil-legend-swatch {
230
274
  width: 11px;
@@ -235,6 +279,11 @@
235
279
  .dil-chart-series {
236
280
  transition: opacity 150ms ease;
237
281
  }
282
+ /* Pie slice emphasis stays in CSS: re-rendering a Recharts Pie remounts its sectors. */
283
+ .dil-chart-pie:has(.dil-chart-series:hover, .dil-chart-series:focus-visible)
284
+ .dil-chart-series:not(:hover, :focus-visible) {
285
+ opacity: 0.625;
286
+ }
238
287
  .dil-tooltip {
239
288
  z-index: 60;
240
289
  max-width: min(24rem, calc(100vw - 16px));
@@ -249,6 +298,9 @@
249
298
  .dil-snap-tooltip {
250
299
  pointer-events: none;
251
300
  }
301
+ .dil-snap-tooltip [data-emphasized="true"] span {
302
+ font-weight: 700;
303
+ }
252
304
  .dil-code-block textarea {
253
305
  font-family: var(--font-mono, monospace);
254
306
  font-size: var(--text-xs, 0.75rem);
package/styles/tokens.css CHANGED
@@ -14,6 +14,9 @@
14
14
  --dil-item-radius: 8px;
15
15
  --dil-success: #22825e;
16
16
  --dil-warning: #ad751a;
17
+ --dil-success-surface: #e5f5ee;
18
+ --dil-warning-surface: #fff2d9;
19
+ --dil-danger-surface: #fee8e8;
17
20
  --dil-tertiary: #8f8f8f;
18
21
  --dil-node-selected: #343d75;
19
22
  --dil-node-surface: #2a303b;
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{createContext as V,useContext as G,useState as _,useMemo as A}from"react";import{clsx as N}from"clsx";import{twMerge as S}from"tailwind-merge";function a(...e){return S(N(e))}import{jsx as x,jsxs as I}from"react/jsx-runtime";var y=V({container:null});function c(){return G(y)}function W({children:e,className:t,style:o,appearance:i="light",tokens:n,boundary:r,...g}){let[v,f]=_(null),T=A(()=>({container:v,...r?{boundary:r}:{}}),[v,r]);return x("section",{...g,className:a("dil-scope",t),"data-theme":i,style:{...o,...n},children:I(y.Provider,{value:T,children:[e,x("div",{"data-dil-portals":!0,ref:f})]})})}import"react";import{Popover as s}from"radix-ui";import{jsx as d}from"react/jsx-runtime";function oe({...e}){return d(s.Root,{"data-slot":"popover",...e})}function re({...e}){return d(s.Trigger,{"data-slot":"popover-trigger",...e})}function ie({className:e,align:t="center",sideOffset:o=4,...i}){let{container:n,boundary:r}=c();return d(s.Portal,{container:n,children:d(s.Content,{"data-slot":"popover-content",align:t,sideOffset:o,collisionBoundary:r,className:a("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",e),...i})})}function ae({...e}){return d(s.Anchor,{"data-slot":"popover-anchor",...e})}import"react";import{cva as M}from"class-variance-authority";import{Slot as E}from"radix-ui";import{jsx as D}from"react/jsx-runtime";var B=M("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function ue({className:e,variant:t="default",size:o="default",asChild:i=!1,...n}){let r=i?E.Root:"button";return D(r,{"data-slot":"button","data-variant":t,"data-size":o,className:a(B({variant:t,size:o,className:e})),...n})}import{Tooltip as l}from"radix-ui";import{jsx as p,jsxs as H}from"react/jsx-runtime";function be({label:e,children:t,open:o}){let{container:i,boundary:n}=c();return p(l.Provider,{delayDuration:250,children:H(l.Root,{...o===void 0?{}:{open:o},children:[p(l.Trigger,{asChild:!0,children:t}),p(l.Portal,{container:i,children:p(l.Content,{sideOffset:6,collisionPadding:8,collisionBoundary:n,className:"dil-tooltip",children:e})})]})})}import"react";import{CheckIcon as U}from"lucide-react";import{Checkbox as R}from"radix-ui";import{jsx as b}from"react/jsx-runtime";function Ce({className:e,...t}){return b(R.Root,{"data-slot":"checkbox",className:a("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary",e),...t,children:b(R.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:b(U,{className:"size-3.5"})})})}import"react";import{jsx as L}from"react/jsx-runtime";function Se({className:e,type:t,...o}){return L("input",{type:t,"data-slot":"input",className:a("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",e),...o})}import*as k from"react";import{Slider as u}from"radix-ui";import{jsx as h,jsxs as O}from"react/jsx-runtime";function Ie({className:e,defaultValue:t,value:o,min:i=0,max:n=100,...r}){let g=k.useMemo(()=>Array.isArray(o)?o:Array.isArray(t)?t:[i,n],[o,t,i,n]);return O(u.Root,{"data-slot":"slider",defaultValue:t,value:o,min:i,max:n,className:a("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...r,children:[h(u.Track,{"data-slot":"slider-track",className:a("relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),children:h(u.Range,{"data-slot":"slider-range",className:a("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")})}),Array.from({length:g.length},(v,f)=>h(u.Thumb,{"aria-label":r["aria-label"],"aria-valuetext":r["aria-valuetext"],"data-slot":"slider-thumb",className:"block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"},f))]})}import*as m from"react";import"class-variance-authority";import{ToggleGroup as w}from"radix-ui";import"react";import{cva as $}from"class-variance-authority";import{Toggle as Ue}from"radix-ui";import{jsx as Oe}from"react/jsx-runtime";var C=$("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});import{jsx as P}from"react/jsx-runtime";var z=m.createContext({size:"default",variant:"default",spacing:0});function Qe({className:e,variant:t,size:o,spacing:i=0,children:n,...r}){return P(w.Root,{"data-slot":"toggle-group","data-variant":t,"data-size":o,"data-spacing":i,style:{"--gap":i},className:a("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",e),...r,children:P(z.Provider,{value:{variant:t,size:o,spacing:i},children:n})})}function We({className:e,children:t,variant:o,size:i,...n}){let r=m.useContext(z);return P(w.Item,{"data-slot":"toggle-group-item","data-variant":r.variant||o,"data-size":r.size||i,"data-spacing":r.spacing,className:a(C({variant:r.variant||o,size:r.size||i}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","rounded-md data-[state=on]:bg-background data-[state=on]:shadow-sm",e),...n,children:t})}export{a,W as b,oe as c,re as d,ie as e,ae as f,B as g,ue as h,be as i,Ce as j,Se as k,Ie as l,Qe as m,We as n};