@1interface/widgets 0.1.1 → 0.1.3
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/{Chart.web-By2Gz8Li.js → Chart.web-oZKLJQOT.js} +1 -1
- package/dist/{GoogleMapsComponent-BuQ-O44M.js → GoogleMapsComponent-WkBuvhHL.js} +1 -1
- package/dist/{Markdown.web-BMpBWV7L.js → Markdown.web-DxptxAje.js} +1 -1
- package/dist/{OpenStreetMapComponent-BGX1UtU5.js → OpenStreetMapComponent-DARDHgjH.js} +1 -1
- package/dist/{constants-PWVUwXA4.js → constants-BnqTsaTZ.js} +1 -1
- package/dist/{index-caa9suT-.js → index-DrYiYn-7.js} +1 -1
- package/dist/index.mjs +1 -1
- package/native/WidgetRenderer.js +14 -6
- package/native/WidgetRenderer.native.js +1 -1
- package/native/runtime/rootAnchor.js +1 -0
- package/package.json +1 -1
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-
|
|
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-DrYiYn-7.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};
|
package/native/WidgetRenderer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as c}from"react/jsx-runtime";import{useRef as
|
|
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,10 +33,18 @@ import{jsx as c}from"react/jsx-runtime";import{useRef as C,useState as y,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
|
-
/* Anchor the
|
|
37
|
-
|
|
38
|
-
|
|
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. */
|
|
39
44
|
[data-widget-renderer][data-widget-dir="rtl"] > * {
|
|
40
|
-
|
|
45
|
+
direction: rtl;
|
|
41
46
|
}
|
|
42
|
-
|
|
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
|
|
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};
|