@1interface/widgets 0.2.0-pipecat.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.
package/dist/index.d.ts CHANGED
@@ -1837,6 +1837,11 @@ export declare const TEXT_ALIGNS: {
1837
1837
  readonly end: "end";
1838
1838
  };
1839
1839
 
1840
+ export declare const TEXT_DIRECTIONS: {
1841
+ readonly ltr: "ltr";
1842
+ readonly rtl: "rtl";
1843
+ };
1844
+
1840
1845
  export declare const TEXT_SIZES: {
1841
1846
  readonly "2xs": "2xs";
1842
1847
  readonly xs: "xs";
@@ -1875,6 +1880,8 @@ export declare type TextareaProps = {
1875
1880
  allowAutofillExtensions?: boolean;
1876
1881
  };
1877
1882
 
1883
+ export declare type TextDirection = (typeof TEXT_DIRECTIONS)[keyof typeof TEXT_DIRECTIONS];
1884
+
1878
1885
  export declare type TextProps = {
1879
1886
  type: "Text";
1880
1887
  key?: string;
@@ -2406,6 +2413,7 @@ export declare interface WidgetBrandingStyles {
2406
2413
  statusInfo: StatusThemeVariant;
2407
2414
  statusDiscovery: StatusThemeVariant;
2408
2415
  fontFamily: string;
2416
+ fontFamilyMono?: string;
2409
2417
  fontSize: number;
2410
2418
  borderRadius: number;
2411
2419
  cornerRadiusMode: "pill" | "rounded" | "sharp";
@@ -2438,7 +2446,7 @@ export declare interface WidgetInternalState {
2438
2446
  formFields: Record<string, string>;
2439
2447
  }
2440
2448
 
2441
- export declare function WidgetRenderer({ widget, branding, brandingStyles, theme, messageId, onConsumerAction, config, errorFallback, userLocation, }: WidgetRendererProps): default_2.JSX.Element | null;
2449
+ export declare function WidgetRenderer({ widget, branding, brandingStyles, theme, messageId, onConsumerAction, config, errorFallback, userLocation, direction, }: WidgetRendererProps): default_2.JSX.Element | null;
2442
2450
 
2443
2451
  export declare interface WidgetRendererProps {
2444
2452
  widget: WidgetRoot | WidgetComponent | null;
@@ -2450,6 +2458,7 @@ export declare interface WidgetRendererProps {
2450
2458
  config?: DeepPartial<RendererConfig>;
2451
2459
  errorFallback?: ReactNode;
2452
2460
  userLocation?: LocationCoordinates | null;
2461
+ direction?: TextDirection;
2453
2462
  }
2454
2463
 
2455
2464
  export declare type WidgetRoot = Card_2 | ListView_2 | BasicRoot_2;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{A as a,m as e,B as s,n as t,o as r,p as i,C as o,q as d,t as n,v as u,w as l,x as m,D as g,y as C,z as T,F as c,E as p,G as S,I,H as x,J as A,L as F,K as R,N as W,O as E,R as N,P as O,Q as f,S as h,T as v,U as D,V as L,W as _,X as k,Y as B,Z as M,_ as U,$ as w,a0 as P,a1 as V,a2 as b,a3 as H,e as j,a4 as q,a5 as y,a6 as G,a7 as Y,a8 as z,a9 as J,e as K,e as Q,aa as X,ab as Z,f as $,ac as aa,a as ea,u as sa,ad as ta,ae as ra,af as ia,ag as oa,ah as da,ai as na}from"./index-DvAx4AnX.js";import"react/jsx-runtime";import"react";export{a as ACTION_TYPES,e as ActionHandlerContext,s as Badge,t as BasicRoot,r as Box,i as Button,o as CONSUMER_ACTIONS,d as Caption,n as Card,u as Chart,l as Checkbox,m as Col,g as DEFAULT_CONFIG,C as DatePicker,T as Divider,c as FileUploadRequest,p as Form,S as FormContext,I as Icon,x as Image,A as Input,F as Label,R as ListView,W as ListViewItem,E as Markdown,N as REDUCER_ACTIONS,O as RadioGroup,f as Row,h as SELF_CONTAINED_ACTIONS,v as Select,D as Spacer,L as Text,_ as Textarea,k as Title,B as Transition,M as Video,U as WidgetErrorBoundary,w as WidgetRenderer,P as WidgetStateManager,V as WidgetStateProvider,b as WidgetThemeProvider,H as configureMap,j as defaultActionHandler,q as formatOrderItems,y as markRequiredLabels,G as mergeConfig,Y as renderWidget,z as resolveTemplate,J as safeRenderWidget,K as useAction,Q as useActionHandler,X as useFileUploadState,Z as useFormContext,$ as useMessageId,aa as useSelectedCategory,ea as useTheme,sa as useTokens,ta as useVariants,ra as useWidgetDispatch,ia as useWidgetState,oa as useWidgetTheme,da as validateFields,na as validateForm};
1
+ import{A as a,m as e,B as s,n as t,o as r,p as i,C as o,q as d,t as n,v as u,w as l,x as m,D as g,y as C,z as T,F as c,E as p,G as S,I,H as x,J as A,L as F,K as R,N as W,O as E,R as N,P as O,Q as f,S as h,T as v,U as D,V as L,W as _,X as k,Y as B,Z as M,_ as U,$ as w,a0 as P,a1 as V,a2 as b,a3 as H,e as j,a4 as q,a5 as y,a6 as G,a7 as Y,a8 as z,a9 as J,e as K,e as Q,aa as X,ab as Z,f as $,ac as aa,a as ea,u as sa,ad as ta,ae as ra,af as ia,ag as oa,ah as da,ai as na}from"./index-D7tB4pMK.js";import"react/jsx-runtime";import"react";export{a as ACTION_TYPES,e as ActionHandlerContext,s as Badge,t as BasicRoot,r as Box,i as Button,o as CONSUMER_ACTIONS,d as Caption,n as Card,u as Chart,l as Checkbox,m as Col,g as DEFAULT_CONFIG,C as DatePicker,T as Divider,c as FileUploadRequest,p as Form,S as FormContext,I as Icon,x as Image,A as Input,F as Label,R as ListView,W as ListViewItem,E as Markdown,N as REDUCER_ACTIONS,O as RadioGroup,f as Row,h as SELF_CONTAINED_ACTIONS,v as Select,D as Spacer,L as Text,_ as Textarea,k as Title,B as Transition,M as Video,U as WidgetErrorBoundary,w as WidgetRenderer,P as WidgetStateManager,V as WidgetStateProvider,b as WidgetThemeProvider,H as configureMap,j as defaultActionHandler,q as formatOrderItems,y as markRequiredLabels,G as mergeConfig,Y as renderWidget,z as resolveTemplate,J as safeRenderWidget,K as useAction,Q as useActionHandler,X as useFileUploadState,Z as useFormContext,$ as useMessageId,aa as useSelectedCategory,ea as useTheme,sa as useTokens,ta as useVariants,ra as useWidgetDispatch,ia as useWidgetState,oa as useWidgetTheme,da as validateFields,na as validateForm};
@@ -1,4 +1,4 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useRef as C,useState as w,useEffect as D,useCallback as x}from"react";import{ThemeProvider as L,useTheme as N}from"./theme";import{WidgetStateManager as P}from"./state";import{WidgetErrorBoundary as A}from"./WidgetErrorBoundary";import{renderWidget as F}from"./runtime";import{mergeConfig as O}from"./config";import{UserLocationProvider as j}from"./components/Map";const h=390,_=24;function $(e){const t=e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i)??e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(!t)return e;const d=e.startsWith("#"),i=d?parseInt(t[1],16):Number(t[1]),g=d?parseInt(t[2],16):Number(t[2]),u=d?parseInt(t[3],16):Number(t[3]),n=.08,f=Math.round(i*(1-n)+80*n),m=Math.round(g*(1-n)+120*n),s=Math.round(u*(1-n)+200*n);return`rgb(${f}, ${m}, ${s})`}const z=`
1
+ import{jsx as c}from"react/jsx-runtime";import{useRef as W,useState as y,useEffect as H,useCallback as C}from"react";import{ThemeProvider as N,useTheme as O}from"./theme";import{WidgetStateManager as A}from"./state";import{WidgetErrorBoundary as P}from"./WidgetErrorBoundary";import{renderWidget as F}from"./runtime";import{mergeConfig as j}from"./config";import{UserLocationProvider as _}from"./components/Map";import{TEXT_DIRECTIONS as $}from"./schema";const w=390,z=24;function G(e){const t=e.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i)??e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(!t)return e;const a=e.startsWith("#"),l=a?parseInt(t[1],16):Number(t[1]),d=a?parseInt(t[2],16):Number(t[2]),g=a?parseInt(t[3],16):Number(t[3]),n=.08,u=Math.round(l*(1-n)+80*n),f=Math.round(d*(1-n)+120*n),m=Math.round(g*(1-n)+200*n);return`rgb(${u}, ${f}, ${m})`}const q=`
2
2
  [data-widget-renderer][data-widget-renderer] *,
3
3
  [data-widget-renderer][data-widget-renderer] *::before,
4
4
  [data-widget-renderer][data-widget-renderer] *::after {
@@ -33,4 +33,18 @@ import{jsx as l}from"react/jsx-runtime";import{useRef as C,useState as w,useEffe
33
33
  -webkit-box-shadow: 0 0 0 9999px var(--widget-input-bg) inset !important;
34
34
  -webkit-text-fill-color: var(--widget-input-fg) !important;
35
35
  }
36
- `;let y=!1;function G(){if(y||typeof document>"u")return;if(document.getElementById("widget-renderer-style")){y=!0;return}const e=document.createElement("style");e.id="widget-renderer-style",e.textContent=z,document.head.appendChild(e),y=!0}function re({widget:e,branding:t,brandingStyles:d,theme:i="light",messageId:g,onConsumerAction:u,config:n,errorFallback:f,userLocation:m}){const s=C(null),p=C(null),[b,k]=w(1),[T,M]=w(!1),[E,I]=w(void 0),v=x(()=>{const a=s.current;if(!a)return;const r=a.clientWidth;M(c=>c?r<h+_:r<h);const o=Math.min(r<h?r/h:1,1);k(c=>Math.abs(c-o)<.005?c:o)},[]),R=x(()=>{const a=p.current;if(!a)return;const r=a.scrollHeight;I(o=>o!==void 0&&Math.abs(o-r)<1?o:r)},[]);if(D(()=>{G();const a=s.current,r=p.current;if(!a||!r)return;let o=0;const c=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{v(),R()})},S=new ResizeObserver(c);S.observe(a);const W=new ResizeObserver(c);return W.observe(r),()=>{cancelAnimationFrame(o),S.disconnect(),W.disconnect()}},[v,R]),!e)return null;const B=t??d,H=O(n);return l(L,{branding:B,mode:i,config:H,children:l(P,{messageId:g,onConsumerAction:u,children:l(j,{location:m??null,children:l(q,{outerRef:s,innerRef:p,theme:i,needsScaling:T,innerHeight:E,scale:b,errorFallback:f,widget:e})})})})}function q({outerRef:e,innerRef:t,theme:d,needsScaling:i,innerHeight:g,scale:u,errorFallback:n,widget:f}){const{tokens:m,variants:s}=N(),p=s.input.soft.bg,b=$(p);return l("div",{ref:e,style:{width:"100%",overflow:"hidden",height:i&&g?g*u:void 0},children:l("div",{ref:t,"data-widget-renderer":"","data-theme":d,style:{width:i?`${h}px`:"100%",transformOrigin:"top left",transform:i?`scale(${u})`:void 0,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale","--widget-input-fg":m.color.text,"--widget-input-bg":b},children:l(A,{fallback:n,children:F(f)})})})}export{re as WidgetRenderer};
36
+ /* Anchor the widget to the reading edge symmetrically. Both directions use ONE
37
+ mechanism \u2014 the writing direction \u2014 never mismatched align values (stretch for
38
+ LTR / flex-end for RTL is what collapsed LTR fill). LTR is the default (no
39
+ rule), which restores the pre-RTL stretch: a width-capped surface (a maxWidth
40
+ Card, or the card wrapper inside the 100%-wide shell) fills to its cap at the
41
+ leading edge, and a no-width root fills the container. RTL just flips the
42
+ direction on the root, so the same clamp lands at the trailing edge. The root's
43
+ own content is reset to ltr one level down so the card's children never mirror. */
44
+ [data-widget-renderer][data-widget-dir="rtl"] > * {
45
+ direction: rtl;
46
+ }
47
+ [data-widget-renderer][data-widget-dir="rtl"] > * > * {
48
+ direction: ltr;
49
+ }
50
+ `;let R=!1;function U(){if(R||typeof document>"u")return;if(document.getElementById("widget-renderer-style")){R=!0;return}const e=document.createElement("style");e.id="widget-renderer-style",e.textContent=q,document.head.appendChild(e),R=!0}function ae({widget:e,branding:t,brandingStyles:a,theme:l="light",messageId:d,onConsumerAction:g,config:n,errorFallback:u,userLocation:f,direction:m=$.ltr}){const h=W(null),p=W(null),[b,k]=y(1),[E,I]=y(!1),[M,L]=y(void 0),v=C(()=>{const o=h.current;if(!o)return;const r=o.clientWidth;I(s=>s?r<w+z:r<w);const i=Math.min(r<w?r/w:1,1);k(s=>Math.abs(s-i)<.005?s:i)},[]),x=C(()=>{const o=p.current;if(!o)return;const r=o.scrollHeight;L(i=>i!==void 0&&Math.abs(i-r)<1?i:r)},[]);if(H(()=>{U();const o=h.current,r=p.current;if(!o||!r)return;let i=0;const s=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{v(),x()})},S=new ResizeObserver(s);S.observe(o);const T=new ResizeObserver(s);return T.observe(r),()=>{cancelAnimationFrame(i),S.disconnect(),T.disconnect()}},[v,x]),!e)return null;const B=t??a,D=j(n);return c(N,{branding:B,mode:l,config:D,children:c(A,{messageId:d,onConsumerAction:g,children:c(_,{location:f??null,children:c(Y,{outerRef:h,innerRef:p,theme:l,direction:m,needsScaling:E,innerHeight:M,scale:b,errorFallback:u,widget:e})})})})}function Y({outerRef:e,innerRef:t,theme:a,direction:l,needsScaling:d,innerHeight:g,scale:n,errorFallback:u,widget:f}){const{tokens:m,variants:h}=O(),p=h.input.soft.bg,b=G(p);return c("div",{ref:e,style:{direction:"ltr",width:"100%",overflow:"hidden",height:d&&g?g*n:void 0},children:c("div",{ref:t,"data-widget-renderer":"","data-widget-dir":l,"data-theme":a,style:{width:d?`${w}px`:"100%",transformOrigin:"top left",transform:d?`scale(${n})`:void 0,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale","--widget-input-fg":m.color.text,"--widget-input-bg":b},children:c(P,{fallback:u,children:F(f)})})})}export{q as WIDGET_CSS,ae as WidgetRenderer};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{View as l}from"react-native";import{ThemeProvider as c}from"./theme";import{WidgetStateManager as f}from"./state";import{WidgetErrorBoundary as W}from"./WidgetErrorBoundary";import{renderWidget as C}from"./runtime";import{mergeConfig as u}from"./config";import{UserLocationProvider as y}from"./components/Map";function M({widget:o,branding:r,brandingStyles:n,theme:t="light",messageId:i,onConsumerAction:d,config:a,errorFallback:g,userLocation:m}){if(!o)return null;const s=r??n,p=u(a);return e(c,{branding:s,mode:t,config:p,children:e(f,{messageId:i,onConsumerAction:d,children:e(y,{location:m??null,children:e(l,{style:{width:"100%"},children:e(W,{fallback:g,children:C(o)})})})})})}export{M as WidgetRenderer};
1
+ import{jsx as e}from"react/jsx-runtime";import{View as c}from"react-native";import{ThemeProvider as f}from"./theme";import{WidgetStateManager as C}from"./state";import{WidgetErrorBoundary as W}from"./WidgetErrorBoundary";import{renderWidget as u}from"./runtime";import{mergeConfig as y}from"./config";import{UserLocationProvider as R}from"./components/Map";import{TEXT_DIRECTIONS as T}from"./schema";import{rootAlignItems as h}from"./runtime/rootAnchor";function E({widget:o,branding:r,brandingStyles:t,theme:i="light",messageId:n,onConsumerAction:d,config:a,errorFallback:m,userLocation:g,direction:s=T.ltr}){if(!o)return null;const l=r??t,p=y(a);return e(f,{branding:l,mode:i,config:p,children:e(C,{messageId:n,onConsumerAction:d,children:e(R,{location:g??null,children:e(c,{style:{width:"100%",direction:"ltr",alignItems:h(s)},children:e(W,{fallback:m,children:u(o)})})})})})}export{E as WidgetRenderer};
@@ -0,0 +1 @@
1
+ import{TEXT_DIRECTIONS as e}from"../schema";function n(t){return t===e.rtl?"flex-end":"stretch"}export{n as rootAlignItems};
@@ -1 +1 @@
1
- const e={Basic:"Basic",Card:"Card",ListView:"ListView",ListViewItem:"ListViewItem",Box:"Box",Row:"Row",Col:"Col",Form:"Form",Spacer:"Spacer",Divider:"Divider",Transition:"Transition",Title:"Title",Caption:"Caption",Text:"Text",Markdown:"Markdown",Badge:"Badge",Icon:"Icon",Image:"Image",Video:"Video",Button:"Button",Input:"Input",Textarea:"Textarea",Select:"Select",DatePicker:"DatePicker",Checkbox:"Checkbox",RadioGroup:"RadioGroup",Label:"Label",Chart:"Chart",FileUploadRequest:"FileUploadRequest",Map:"Map",MapMarker:"MapMarker",MapPolyline:"MapPolyline",MapCircle:"MapCircle",MapPolygon:"MapPolygon"},t={row:"row",col:"col"},o={start:"start",center:"center",end:"end",baseline:"baseline",stretch:"stretch"},r={start:"start",center:"center",end:"end",between:"between",around:"around",evenly:"evenly",stretch:"stretch"},n={nowrap:"nowrap",wrap:"wrap","wrap-reverse":"wrap-reverse"},i={start:"start",center:"center",end:"end"},p={normal:"normal",medium:"medium",semibold:"semibold",bold:"bold"},s={light:"light",dark:"dark"},a={clear:"clear"},l={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl",full:"full","100%":"100%",none:"none"},g={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",groove:"groove",ridge:"ridge",inset:"inset",outset:"outset"},y={cover:"cover",contain:"contain",fill:"fill","scale-down":"scale-down",none:"none"},d={"top left":"top left",top:"top","top right":"top right",left:"left",center:"center",right:"right","bottom left":"bottom left",bottom:"bottom","bottom right":"bottom right"},c={solid:"solid",soft:"soft",outline:"outline",ghost:"ghost",tabs:"tabs"},x={soft:"soft",outline:"outline"},u={"3xs":"3xs","2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},S={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},b={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},m={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl","5xl":"5xl"},f={sm:"sm",md:"md",lg:"lg"},T={xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl",button:"button"},I={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl"},C={sm:"sm",md:"md",lg:"lg",full:"full"},P={primary:"primary",secondary:"secondary",info:"info",discovery:"discovery",success:"success",caution:"caution",warning:"warning",danger:"danger"},E={primary:"primary",secondary:"secondary"},k={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",discovery:"discovery"},A={solid:"solid",soft:"soft",outline:"outline"},h={sm:"sm",md:"md",lg:"lg"},_={number:"number",email:"email",text:"text",password:"password",tel:"tel",url:"url",card_number:"card_number",month_year:"month_year",cvc:"cvc",counter:"counter"},M={top:"top",bottom:"bottom",left:"left",right:"right"},O={start:"start",center:"center",end:"end"},B={auto:"auto",metadata:"metadata",none:"none"},R="auto",V={display:"display",input:"input"},w={bar:"bar",area:"area",line:"line"},N={basis:"basis",basisClosed:"basisClosed",basisOpen:"basisOpen",bumpX:"bumpX",bumpY:"bumpY",bump:"bump",linear:"linear",linearClosed:"linearClosed",natural:"natural",monotoneX:"monotoneX",monotoneY:"monotoneY",monotone:"monotone",step:"step",stepBefore:"stepBefore",stepAfter:"stepAfter"};export{o as ALIGNMENTS,k as BADGE_COLORS,h as BADGE_SIZES,A as BADGE_VARIANTS,g as BORDER_STYLES,P as BUTTON_COLORS,I as BUTTON_ICON_SIZES,E as BUTTON_STYLE_SHORTHANDS,f as CAPTION_SIZES,C as CARD_SIZES,u as CONTROL_SIZES,c as CONTROL_VARIANTS,N as CURVE_TYPES,t as DIRECTIONS,y as FIT_MODES,p as FONT_WEIGHTS,S as GUTTER_SIZES,T as ICON_SIZES,d as IMAGE_POSITIONS,_ as INPUT_TYPES,x as INPUT_VARIANTS,r as JUSTIFICATIONS,R as LIMIT_AUTO,V as MAP_MODES,O as POPOVER_ALIGNS,M as POPOVER_SIDES,B as PRELOAD_MODES,l as RADIUS_VALUES,w as SERIES_TYPES,i as TEXT_ALIGNS,b as TEXT_SIZES,s as THEME_MODES,a as TINTS,m as TITLE_SIZES,e as WIDGET_TYPES,n as WRAP_MODES};
1
+ const e={Basic:"Basic",Card:"Card",ListView:"ListView",ListViewItem:"ListViewItem",Box:"Box",Row:"Row",Col:"Col",Form:"Form",Spacer:"Spacer",Divider:"Divider",Transition:"Transition",Title:"Title",Caption:"Caption",Text:"Text",Markdown:"Markdown",Badge:"Badge",Icon:"Icon",Image:"Image",Video:"Video",Button:"Button",Input:"Input",Textarea:"Textarea",Select:"Select",DatePicker:"DatePicker",Checkbox:"Checkbox",RadioGroup:"RadioGroup",Label:"Label",Chart:"Chart",FileUploadRequest:"FileUploadRequest",Map:"Map",MapMarker:"MapMarker",MapPolyline:"MapPolyline",MapCircle:"MapCircle",MapPolygon:"MapPolygon"},t={row:"row",col:"col"},o={ltr:"ltr",rtl:"rtl"},r={start:"start",center:"center",end:"end",baseline:"baseline",stretch:"stretch"},n={start:"start",center:"center",end:"end",between:"between",around:"around",evenly:"evenly",stretch:"stretch"},i={nowrap:"nowrap",wrap:"wrap","wrap-reverse":"wrap-reverse"},p={start:"start",center:"center",end:"end"},s={normal:"normal",medium:"medium",semibold:"semibold",bold:"bold"},a={light:"light",dark:"dark"},l={clear:"clear"},g={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl",full:"full","100%":"100%",none:"none"},y={solid:"solid",dashed:"dashed",dotted:"dotted",double:"double",groove:"groove",ridge:"ridge",inset:"inset",outset:"outset"},d={cover:"cover",contain:"contain",fill:"fill","scale-down":"scale-down",none:"none"},c={"top left":"top left",top:"top","top right":"top right",left:"left",center:"center",right:"right","bottom left":"bottom left",bottom:"bottom","bottom right":"bottom right"},x={solid:"solid",soft:"soft",outline:"outline",ghost:"ghost",tabs:"tabs"},u={soft:"soft",outline:"outline"},S={"3xs":"3xs","2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},b={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"},m={"2xs":"2xs",xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl"},T={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl","4xl":"4xl","5xl":"5xl"},f={sm:"sm",md:"md",lg:"lg"},I={xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl","3xl":"3xl",button:"button"},C={sm:"sm",md:"md",lg:"lg",xl:"xl","2xl":"2xl"},P={sm:"sm",md:"md",lg:"lg",full:"full"},E={primary:"primary",secondary:"secondary",info:"info",discovery:"discovery",success:"success",caution:"caution",warning:"warning",danger:"danger"},k={primary:"primary",secondary:"secondary"},A={primary:"primary",secondary:"secondary",success:"success",danger:"danger",warning:"warning",info:"info",discovery:"discovery"},h={solid:"solid",soft:"soft",outline:"outline"},_={sm:"sm",md:"md",lg:"lg"},O={number:"number",email:"email",text:"text",password:"password",tel:"tel",url:"url",card_number:"card_number",month_year:"month_year",cvc:"cvc",counter:"counter"},M={top:"top",bottom:"bottom",left:"left",right:"right"},R={start:"start",center:"center",end:"end"},B={auto:"auto",metadata:"metadata",none:"none"},V="auto",w={display:"display",input:"input"},N={bar:"bar",area:"area",line:"line"},D={basis:"basis",basisClosed:"basisClosed",basisOpen:"basisOpen",bumpX:"bumpX",bumpY:"bumpY",bump:"bump",linear:"linear",linearClosed:"linearClosed",natural:"natural",monotoneX:"monotoneX",monotoneY:"monotoneY",monotone:"monotone",step:"step",stepBefore:"stepBefore",stepAfter:"stepAfter"};export{r as ALIGNMENTS,A as BADGE_COLORS,_ as BADGE_SIZES,h as BADGE_VARIANTS,y as BORDER_STYLES,E as BUTTON_COLORS,C as BUTTON_ICON_SIZES,k as BUTTON_STYLE_SHORTHANDS,f as CAPTION_SIZES,P as CARD_SIZES,S as CONTROL_SIZES,x as CONTROL_VARIANTS,D as CURVE_TYPES,t as DIRECTIONS,d as FIT_MODES,s as FONT_WEIGHTS,b as GUTTER_SIZES,I as ICON_SIZES,c as IMAGE_POSITIONS,O as INPUT_TYPES,u as INPUT_VARIANTS,n as JUSTIFICATIONS,V as LIMIT_AUTO,w as MAP_MODES,R as POPOVER_ALIGNS,M as POPOVER_SIDES,B as PRELOAD_MODES,g as RADIUS_VALUES,N as SERIES_TYPES,p as TEXT_ALIGNS,o as TEXT_DIRECTIONS,m as TEXT_SIZES,a as THEME_MODES,l as TINTS,T as TITLE_SIZES,e as WIDGET_TYPES,i as WRAP_MODES};
@@ -1 +1 @@
1
- import{BASE_TOKENS as p,freshTokens as g}from"./tokens";import{hexToRgba as S}from"./style";const i={solid:"#3B4FFE",background:"#E5F3FF",text:"#FFFFFF"},l={surface:"#212121",surfaceAlt:"#181818",surfaceTertiary:"#131313",text:"#DCDCDC",textMuted:"#8F8F8F",textFaint:"#767676",border:"rgba(255,255,255,0.12)"};function f(r,o,t="rgba(0,0,0,0.1)"){if(!r)return t;const d=typeof o=="number"?o:100;if(d>=100)return r;const n=Math.max(0,Math.min(1,d/100));return S(r,n)??r}function B(r){return r.widgetBg!==void 0}function x(r){if(typeof r=="number")return r;if(typeof r!="string")return 12;switch(r){case"none":case"sharp":return 0;case"sm":return 8;case"md":case"rounded":return 12;case"pill":return 16;default:{const o=parseFloat(r);return Number.isFinite(o)?o:12}}}function m(r){return typeof r=="string"&&r==="pill"}function h(r,o){if(typeof r=="number")return r;if(typeof r!="string")return o;const t=parseFloat(r);return Number.isFinite(t)?t:o}function y(r){return typeof r!="string"||!r?"System":r.includes(",")?r:`${/\s/.test(r)?`"${r}"`:r}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`}function b(r){return{none:0,"2xs":Math.max(Math.round(r*.125),1),xs:Math.max(Math.round(r*.25),2),sm:Math.max(Math.round(r*.375),2),md:Math.max(Math.round(r*.5),4),lg:Math.max(Math.round(r*.625),6),xl:Math.max(Math.round(r*.75),8),"2xl":Math.round(r),"3xl":Math.round(r*1.25),"4xl":Math.round(r*1.5),pill:9999}}function M(r,o){const t=g(),d=r.borderRadius??12;t.radius=b(d);const n=o?l:void 0;return t.color.surface=r.widgetBg||n?.surface||"#FFFFFF",t.color.surfaceAlt=r.inputBgColor||n?.surfaceAlt||"#F4F4F5",t.color.surfaceTertiary=n?.surfaceTertiary??"#F3F3F3",t.color.text=r.primaryText||n?.text||"#1A1A1A",t.color.textMuted=r.secondaryText||n?.textMuted||"#6B6B6B",t.color.textFaint=r.tertiaryText||n?.textFaint||"#9B9B9B",t.color.placeholder=r.placeholderColor||n?.textFaint||"#9B9B9B",t.color.border=o?l.border:f(r.widgetBorderColor,r.widgetBorderOpacity),t.color.borderInput=o?l.border:f(r.inputBorderColor,r.inputBorderOpacity),r.widgetBorderStyle==="none"&&(t.ui.cardBorderWidth=0),t.color.primary=s(r.statusPrimary),t.color.secondary=s(r.statusSecondary),t.color.success=s(r.statusSuccess),t.color.danger=s(r.statusDanger),t.color.warning=s(r.statusWarning),t.color.info=s(r.statusInfo),t.color.discovery=s(r.statusDiscovery),t.font.family=y(r.fontFamily),t.font.baseSize=r.fontSize||p.font.baseSize,t.button.alwaysPill=r.cornerRadiusMode==="pill",t}function s(r){return{solid:r?.solid??i.solid,bg:r?.background??i.background,text:r?.text??i.text}}function T(r,o,t,d,n){const e=g();e.radius=b(t);const a=r.surface.widget,u=r.surface.input,c=n?l:void 0;e.color.surface=a?.background??c?.surface??"#FFFFFF",e.color.surfaceAlt=u?.background??c?.surfaceAlt??"#F4F4F5",e.color.surfaceTertiary=c?.surfaceTertiary??"#F3F3F3",e.color.text=r.text.primary??c?.text??"#1A1A1A",e.color.textMuted=r.text.secondary??c?.textMuted??"#6B6B6B",e.color.textFaint=r.text.tertiary??c?.textFaint??"#9B9B9B",e.color.placeholder=u?.placeholder_color??r.text.tertiary??c?.textFaint??"#9B9B9B";const F=n?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.1)";return e.color.border=f(a?.border?.color,a?.border?.opacity,F),e.color.borderInput=f(u?.border?.color,u?.border?.opacity,F),a?.border?.style==="none"&&(e.ui.cardBorderWidth=0),e.color.primary=s(r.status.primary),e.color.secondary=s(r.status.secondary),e.color.success=s(r.status.success),e.color.danger=s(r.status.danger),e.color.warning=s(r.status.warning),e.color.info=s(r.status.info??i),e.color.discovery=s(r.status.discovery??i),e.font.family=y(o.font_family),e.font.baseSize=h(o.font_size,p.font.baseSize),e.button.alwaysPill=d,e}function C(r,o="light"){const t=o==="dark";if(!r)return g();if(B(r))return M(r,t);const d=t&&r.themes.dark||r.themes.light,n=x(r.corner_radius),e=m(r.corner_radius);return T(d,r.typography,n,e,t)}function _(r,o="light"){if(B(r))return r;const t=o==="dark"&&r.themes.dark||r.themes.light,d=x(r.corner_radius),n=m(r.corner_radius),e=t.surface.widget,a=t.surface.input;return{widgetBg:e?.background??"#FFFFFF",inputBgColor:a?.background??"#F4F4F5",widgetBorderStyle:e?.border?.style??"solid",widgetBorderColor:e?.border?.color??"#000000",widgetBorderWidth:e?.border?.width??"1px",widgetBorderOpacity:e?.border?.opacity??10,inputBorderStyle:a?.border?.style??"solid",inputBorderColor:a?.border?.color??"#000000",inputBorderWidth:a?.border?.width??"1px",inputBorderOpacity:a?.border?.opacity??10,primaryText:t.text.primary,secondaryText:t.text.secondary,tertiaryText:t.text.tertiary,placeholderColor:a?.placeholder_color??t.text.tertiary,statusPrimary:t.status.primary??i,statusSecondary:t.status.secondary??i,statusSuccess:t.status.success??i,statusDanger:t.status.danger??i,statusWarning:t.status.warning??i,statusInfo:t.status.info??i,statusDiscovery:t.status.discovery??i,fontFamily:y(r.typography.font_family),fontSize:h(r.typography.font_size,14),borderRadius:d,cornerRadiusMode:n?"pill":typeof r.corner_radius=="string"&&r.corner_radius==="sharp"?"sharp":"rounded"}}export{C as resolveBranding,_ as resolveBrandingStyles};
1
+ import{BASE_TOKENS as p,freshTokens as y}from"./tokens";import{hexToRgba as b}from"./style";const i={solid:"#3B4FFE",background:"#E5F3FF",text:"#FFFFFF"},l={surface:"#212121",surfaceAlt:"#181818",surfaceTertiary:"#131313",text:"#DCDCDC",textMuted:"#8F8F8F",textFaint:"#767676",border:"rgba(255,255,255,0.12)"};function f(r,e,t="rgba(0,0,0,0.1)"){if(!r)return t;const d=typeof e=="number"?e:100;if(d>=100)return r;const n=Math.max(0,Math.min(1,d/100));return b(r,n)??r}function B(r){return r.widgetBg!==void 0}function m(r){if(typeof r=="number")return r;if(typeof r!="string")return 12;switch(r){case"none":case"sharp":return 0;case"sm":return 8;case"md":case"rounded":return 12;case"pill":return 16;default:{const e=parseFloat(r);return Number.isFinite(e)?e:12}}}function x(r){return typeof r=="string"&&r==="pill"}function h(r,e){if(typeof r=="number")return r;if(typeof r!="string")return e;const t=parseFloat(r);return Number.isFinite(t)?t:e}function g(r){return typeof r!="string"||!r?"System":r.includes(",")?r:`${/\s/.test(r)?`"${r}"`:r}, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`}function S(r){return{none:0,"2xs":Math.max(Math.round(r*.125),1),xs:Math.max(Math.round(r*.25),2),sm:Math.max(Math.round(r*.375),2),md:Math.max(Math.round(r*.5),4),lg:Math.max(Math.round(r*.625),6),xl:Math.max(Math.round(r*.75),8),"2xl":Math.round(r),"3xl":Math.round(r*1.25),"4xl":Math.round(r*1.5),pill:9999}}function M(r,e){const t=y(),d=r.borderRadius??12;t.radius=S(d);const n=e?l:void 0;return t.color.surface=r.widgetBg||n?.surface||"#FFFFFF",t.color.surfaceAlt=r.inputBgColor||n?.surfaceAlt||"#F4F4F5",t.color.surfaceTertiary=n?.surfaceTertiary??"#F3F3F3",t.color.text=r.primaryText||n?.text||"#1A1A1A",t.color.textMuted=r.secondaryText||n?.textMuted||"#6B6B6B",t.color.textFaint=r.tertiaryText||n?.textFaint||"#9B9B9B",t.color.placeholder=r.placeholderColor||n?.textFaint||"#9B9B9B",t.color.border=e?l.border:f(r.widgetBorderColor,r.widgetBorderOpacity),t.color.borderInput=e?l.border:f(r.inputBorderColor,r.inputBorderOpacity),r.widgetBorderStyle==="none"&&(t.ui.cardBorderWidth=0),t.color.primary=s(r.statusPrimary),t.color.secondary=s(r.statusSecondary),t.color.success=s(r.statusSuccess),t.color.danger=s(r.statusDanger),t.color.warning=s(r.statusWarning),t.color.info=s(r.statusInfo),t.color.discovery=s(r.statusDiscovery),t.font.family=g(r.fontFamily),t.font.monoFamily=r.fontFamilyMono?g(r.fontFamilyMono):t.font.monoFamily,t.font.baseSize=r.fontSize||p.font.baseSize,t.button.alwaysPill=r.cornerRadiusMode==="pill",t}function s(r){return{solid:r?.solid??i.solid,bg:r?.background??i.background,text:r?.text??i.text}}function T(r,e,t,d,n){const o=y();o.radius=S(t);const a=r.surface.widget,u=r.surface.input,c=n?l:void 0;o.color.surface=a?.background??c?.surface??"#FFFFFF",o.color.surfaceAlt=u?.background??c?.surfaceAlt??"#F4F4F5",o.color.surfaceTertiary=c?.surfaceTertiary??"#F3F3F3",o.color.text=r.text.primary??c?.text??"#1A1A1A",o.color.textMuted=r.text.secondary??c?.textMuted??"#6B6B6B",o.color.textFaint=r.text.tertiary??c?.textFaint??"#9B9B9B",o.color.placeholder=u?.placeholder_color??r.text.tertiary??c?.textFaint??"#9B9B9B";const F=n?"rgba(255,255,255,0.12)":"rgba(0,0,0,0.1)";return o.color.border=f(a?.border?.color,a?.border?.opacity,F),o.color.borderInput=f(u?.border?.color,u?.border?.opacity,F),a?.border?.style==="none"&&(o.ui.cardBorderWidth=0),o.color.primary=s(r.status.primary),o.color.secondary=s(r.status.secondary),o.color.success=s(r.status.success),o.color.danger=s(r.status.danger),o.color.warning=s(r.status.warning),o.color.info=s(r.status.info??i),o.color.discovery=s(r.status.discovery??i),o.font.family=g(e.font_family),o.font.baseSize=h(e.font_size,p.font.baseSize),o.button.alwaysPill=d,o}function C(r,e="light"){const t=e==="dark";if(!r)return y();if(B(r))return M(r,t);const d=t&&r.themes.dark||r.themes.light,n=m(r.corner_radius),o=x(r.corner_radius);return T(d,r.typography,n,o,t)}function _(r,e="light"){if(B(r))return r;const t=e==="dark"&&r.themes.dark||r.themes.light,d=m(r.corner_radius),n=x(r.corner_radius),o=t.surface.widget,a=t.surface.input;return{widgetBg:o?.background??"#FFFFFF",inputBgColor:a?.background??"#F4F4F5",widgetBorderStyle:o?.border?.style??"solid",widgetBorderColor:o?.border?.color??"#000000",widgetBorderWidth:o?.border?.width??"1px",widgetBorderOpacity:o?.border?.opacity??10,inputBorderStyle:a?.border?.style??"solid",inputBorderColor:a?.border?.color??"#000000",inputBorderWidth:a?.border?.width??"1px",inputBorderOpacity:a?.border?.opacity??10,primaryText:t.text.primary,secondaryText:t.text.secondary,tertiaryText:t.text.tertiary,placeholderColor:a?.placeholder_color??t.text.tertiary,statusPrimary:t.status.primary??i,statusSecondary:t.status.secondary??i,statusSuccess:t.status.success??i,statusDanger:t.status.danger??i,statusWarning:t.status.warning??i,statusInfo:t.status.info??i,statusDiscovery:t.status.discovery??i,fontFamily:g(r.typography.font_family),fontSize:h(r.typography.font_size,14),borderRadius:d,cornerRadiusMode:n?"pill":typeof r.corner_radius=="string"&&r.corner_radius==="sharp"?"sharp":"rounded"}}export{C as resolveBranding,_ as resolveBrandingStyles};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1interface/widgets",
3
- "version": "0.2.0-pipecat.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,