@stridge/kit 0.1.0-alpha.6 → 0.1.0-alpha.8
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/KitProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawDriverProvider as a}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as o}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as s}from"./scope/KitScope.js";import"./scope/index.js";import{jsx as c}from"react/jsx-runtime";function l({children:l,i18n:u,direction:d,deposit:f,withdraw:p,storage:m,storageNamespace:h,...g}){let _=n(u?.locale),v=l;return p&&(v=c(a,{driver:p,children:c(o,{children:v})})),f&&(v=c(t,{driver:f,children:c(i,{children:v})})),c(r,{locale:u?.locale,catalogs:u?.catalogs,children:c(s,{...g,direction:d??_,children:c(e,{storage:m,namespace:h,children:v})})})}export{l as KitProvider};
|
|
1
|
+
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawDriverProvider as a}from"./flows/withdraw/driver/context.js";import{WithdrawControllerProvider as o}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as s}from"./scope/KitScope.js";import"./scope/index.js";import{jsx as c}from"react/jsx-runtime";function l({children:l,i18n:u,direction:d,deposit:f,withdraw:p,storage:m,storageNamespace:h,...g}){let _=n(u?.locale),v=l;return p&&(v=c(a,{driver:p,children:c(o,{children:v})})),f&&(v=c(t,{driver:f,children:c(i,{children:v})})),c(r,{locale:u?.locale,catalogs:u?.catalogs,children:c(s,{...g,direction:d??_,locale:u?.locale,children:c(e,{storage:m,namespace:h,children:v})})})}export{l as KitProvider};
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.1.0-alpha.
|
|
1
|
+
var e=`0.1.0-alpha.8`;export{e as version};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useKitConfig as e}from"./context.js";import{KIT_SCOPE_SLOTS as t}from"./KitScope.slots.js";import{jsx as n}from"react/jsx-runtime";import{DirectionProvider as r}from"@base-ui/react/direction-provider";function i({className:i,style:a,children:o,...s}){let{accent:c,direction:l,
|
|
1
|
+
"use client";import{useKitConfig as e}from"./context.js";import{KIT_SCOPE_SLOTS as t}from"./KitScope.slots.js";import{jsx as n}from"react/jsx-runtime";import{DirectionProvider as r}from"@base-ui/react/direction-provider";function i({className:i,style:a,children:o,...s}){let{accent:c,direction:l,locale:u,radius:d,theme:f}=e(),p=c?{"--stridge-kit-primary":c}:void 0,m=p||a?{...p,...a}:void 0;return n(r,{direction:l??`ltr`,children:n(`div`,{...s,dir:l,"data-stridge-scope":``,"data-stridge-radius":d,"data-stridge-theme":f,"data-stridge-locale":u,"data-stridge-slot":t.portalScope,className:i,style:m,children:o})})}export{i as KitPortalScope};
|
package/dist/scope/KitScope.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ declare function KitScope({
|
|
|
19
19
|
radius,
|
|
20
20
|
theme,
|
|
21
21
|
direction: directionProp,
|
|
22
|
+
locale,
|
|
22
23
|
target,
|
|
23
24
|
className,
|
|
24
25
|
style,
|
|
@@ -55,6 +56,14 @@ declare namespace KitScope {
|
|
|
55
56
|
* Use the standard HTML `dir` prop instead when you want a tree-wide DOM flip.
|
|
56
57
|
*/
|
|
57
58
|
direction?: KitDirection;
|
|
59
|
+
/**
|
|
60
|
+
* Active BCP-47 locale tag (`"en"`, `"ar"`, `"fa"`, …). Forwarded by `KitProvider` from
|
|
61
|
+
* `i18n.locale` and stamped onto the scope div as `data-stridge-locale="…"` so hosts can
|
|
62
|
+
* target script-specific styling per locale — e.g. swap the kit's font stack to a Persian
|
|
63
|
+
* face on `[data-stridge-locale^="fa"]` while keeping the Arabic face on `[…^="ar"]`. RTL
|
|
64
|
+
* alone isn't fine-grained enough because both share `dir="rtl"`.
|
|
65
|
+
*/
|
|
66
|
+
locale?: string;
|
|
58
67
|
/** Children rendered inside the kit scope. */
|
|
59
68
|
children?: ReactNode;
|
|
60
69
|
}
|
package/dist/scope/KitScope.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{KitContext as e}from"./context.js";import{KIT_SCOPE_SLOTS as t}from"./KitScope.slots.js";import{useCallback as n,useLayoutEffect as r,useMemo as i,useRef as a,useState as o}from"react";import{jsx as s}from"react/jsx-runtime";import{DirectionProvider as c}from"@base-ui/react/direction-provider";function l({accent:r,radius:o,theme:l,direction:d,
|
|
1
|
+
"use client";import{KitContext as e}from"./context.js";import{KIT_SCOPE_SLOTS as t}from"./KitScope.slots.js";import{useCallback as n,useLayoutEffect as r,useMemo as i,useRef as a,useState as o}from"react";import{jsx as s}from"react/jsx-runtime";import{DirectionProvider as c}from"@base-ui/react/direction-provider";function l({accent:r,radius:o,theme:l,direction:d,locale:m,target:h,className:g,style:_,dir:v,ref:y,children:b,...x}){let S=a(null),C=f(S,v),w=u(v)??d??C,T=n(e=>{S.current=e,p(y,e)},[y]),E=i(()=>({accent:r,radius:o,theme:l,direction:w,locale:m,target:h}),[r,o,l,w,m,h]),D=r?{"--stridge-kit-primary":r}:void 0,O=D||_?{...D,..._}:void 0;return s(e.Provider,{value:E,children:s(c,{direction:w??`ltr`,children:s(`div`,{...x,ref:T,dir:v,"data-stridge-scope":``,"data-stridge-radius":o,"data-stridge-theme":l,"data-stridge-locale":m,"data-stridge-slot":t.root,className:g,style:O,children:b})})})}function u(e){return e===`ltr`||e===`rtl`?e:void 0}function d(e){for(let t=e;t;t=t.parentElement){let e=u(t.getAttribute(`dir`)??void 0);if(e)return e}if(!(typeof window>`u`))return u(window.getComputedStyle(e).direction)}function f(e,t){let[n,i]=o(()=>u(t));return r(()=>{let n=e.current;if(!n){i(u(t));return}let r=()=>{i(d(n))};if(r(),typeof MutationObserver>`u`)return;let a=new MutationObserver(r);for(let e=n;e;e=e.parentElement)a.observe(e,{attributes:!0,attributeFilter:[`dir`]});return()=>a.disconnect()},[t,e]),n}function p(e,t){if(e){if(typeof e==`function`){e(t);return}e.current=t}}export{l as KitScope};
|
package/dist/scope/context.d.ts
CHANGED
|
@@ -53,6 +53,13 @@ interface KitConfig {
|
|
|
53
53
|
* behavior when they render outside the provider's DOM subtree.
|
|
54
54
|
*/
|
|
55
55
|
direction?: KitDirection;
|
|
56
|
+
/**
|
|
57
|
+
* Active BCP-47 locale tag (e.g. `"en"`, `"ar"`, `"fa"`, `"ar-EG"`). Forwarded by `KitProvider`
|
|
58
|
+
* from `i18n.locale` and stamped onto every kit scope as `data-stridge-locale="…"` so the host
|
|
59
|
+
* can target script-specific styling (typically the font stack) per locale — RTL alone isn't
|
|
60
|
+
* fine-grained enough (Arabic and Persian are both RTL but commonly want different faces).
|
|
61
|
+
*/
|
|
62
|
+
locale?: string;
|
|
56
63
|
/**
|
|
57
64
|
* Destination token configuration.
|
|
58
65
|
*/
|
package/dist/shared/cuer/Cuer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{create as e}from"./QrCode.js";import*as t from"react";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";
|
|
1
|
+
import{create as e}from"./QrCode.js";import*as t from"react";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";const a=e=>Math.max(0,Math.min(1,e));function o(e){let{arena:t,...n}=e;return i(o.Root,{...n,children:[r(o.Finder,{}),r(o.Cells,{}),t&&r(o.Arena,{children:typeof t==`string`?r(`img`,{alt:`Arena`,src:t,style:{borderRadius:1,height:`100%`,objectFit:`cover`,width:`100%`}}):t})]})}(function(o){let s=o.Context=t.createContext(null);function c(n){let{children:a,size:o=`100%`,value:c,version:l,errorCorrection:u,...d}=n,f=t.useMemo(()=>(t.Children.map(a,e=>!t.isValidElement(e)||typeof e.type==`string`?null:`displayName`in e.type&&e.type.displayName===`Arena`?!0:null)??[]).some(Boolean),[a]),p=t.useMemo(()=>{let t=u;return f&&u===`low`&&(t=`medium`),e(c,{errorCorrection:t,version:l})},[c,f,u,l]),m=p.edgeLength*1,h=p.finderLength*1/2,g=f?Math.floor(m/4):0,_=t.useMemo(()=>({arenaSize:g,cellSize:1,edgeSize:m,qrcode:p,finderSize:h}),[g,m,p,h]);return r(s.Provider,{value:_,children:i(`svg`,{...d,width:o,height:o,viewBox:`0 0 ${m} ${m}`,xmlns:`http://www.w3.org/2000/svg`,children:[r(`title`,{children:`QR Code`}),a]})})}o.Root=c,(function(e){e.displayName=`Root`})(c||=o.Root||={});function l(e){let{className:o,fill:c,innerClassName:l,radius:u=.25,stroke:d}=e,{cellSize:f,edgeSize:p,finderSize:m}=t.useContext(s),h=a(u);function g({position:e}){let t=m-(m-f)-f/2;e===`top-right`&&(t=p-m-(m-f)-f/2);let a=m-(m-f)-f/2;e===`bottom-left`&&(a=p-m-(m-f)-f/2);let s=m-f*1.5;e===`top-right`&&(s=p-m-f*1.5);let u=m-f*1.5;return e===`bottom-left`&&(u=p-m-f*1.5),i(n,{children:[r(`rect`,{className:o,stroke:d??c??`currentColor`,fill:`transparent`,x:t,y:a,width:f+(m-f)*2,height:f+(m-f)*2,rx:2*h*(m-f),ry:2*h*(m-f),strokeWidth:f}),r(`rect`,{className:l,fill:c??`currentColor`,x:s,y:u,width:f*3,height:f*3,rx:2*h*f,ry:2*h*f})]})}return i(n,{children:[r(g,{position:`top-left`}),r(g,{position:`top-right`}),r(g,{position:`bottom-left`})]})}o.Finder=l,(function(e){e.displayName=`Finder`})(l||=o.Finder||={});function u(e){let{className:n,fill:i=`currentColor`,inset:o=!0,radius:c=1}=e,{arenaSize:l,cellSize:u,qrcode:d}=t.useContext(s),{edgeLength:f,finderLength:p}=d,m=a(c);return r(`path`,{className:n,d:t.useMemo(()=>{let e=``;for(let t=0;t<d.grid.length;t++){let n=d.grid[t];if(n)for(let r=0;r<n.length;r++){if(!n[r])continue;let i=f/2-l/2,a=i+l;if(t>=i&&t<=a&&r>=i&&r<=a)continue;let s=t<p&&r<p,c=t<p&&r>=f-p,d=t>=f-p&&r<p;if(s||c||d)continue;let h=(u-(o?u*.1:0)*2)/2,g=r*u+u/2,_=t*u+u/2,v=g-h,y=g+h,b=_-h,x=_+h,S=m*h;e+=[`M ${v+S},${b}`,`L ${y-S},${b}`,`A ${S},${S} 0 0,1 ${y},${b+S}`,`L ${y},${x-S}`,`A ${S},${S} 0 0,1 ${y-S},${x}`,`L ${v+S},${x}`,`A ${S},${S} 0 0,1 ${v},${x-S}`,`L ${v},${b+S}`,`A ${S},${S} 0 0,1 ${v+S},${b}`,`z`].join(` `)}}return e},[l,u,f,p,d.grid,o,m]),fill:i})}o.Cells=u,(function(e){e.displayName=`Cells`})(u||=o.Cells||={});function d(e){let{children:n}=e,{arenaSize:i,cellSize:a,edgeSize:o}=t.useContext(s),c=i,l=(o-c)/2;return r(`foreignObject`,{x:l,y:l,width:c,height:c,children:r(`div`,{style:{alignItems:`center`,display:`flex`,fontSize:1,justifyContent:`center`,height:`100%`,overflow:`hidden`,width:`100%`,padding:a/2,boxSizing:`border-box`},children:n})})}o.Arena=d,(function(e){e.displayName=`Arena`})(d||=o.Arena||={})})(o||={});export{o as Cuer};
|