neba 1.16.1 → 1.17.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/README.md +5 -5
- package/dist/a2ui/adapter-catalog.json +1 -0
- package/dist/a2ui/catalog.json +632 -145
- package/dist/a2ui/components.js +1 -1
- package/dist/a2ui/index.d.ts +22 -10
- package/dist/a2ui/index.js +1 -1
- package/dist/a2ui/schema.d.ts +8 -6
- package/dist/a2ui/schema.js +1 -1
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/agent-steps/AgentSteps.js +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/anchor/Anchor.d.ts +3 -1
- package/dist/components/anchor/Anchor.js +1 -1
- package/dist/components/animate-counter/AnimateCounter.d.ts +11 -4
- package/dist/components/animate-counter/AnimateCounter.js +1 -1
- package/dist/components/animate-scramble/AnimateScramble.d.ts +6 -3
- package/dist/components/animate-scramble/AnimateScramble.js +1 -1
- package/dist/components/animate-split/AnimateSplit.d.ts +6 -3
- package/dist/components/animate-split/AnimateSplit.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/app-logo/AppLogo.js +1 -1
- package/dist/components/approval/Approval.js +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +3 -3
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/chip/Chip.d.ts +4 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/code-block/CodeBlock.js +1 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +13 -3
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +9 -2
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/command-palette/CommandPalette.js +1 -1
- package/dist/components/confirm/Confirm.js +1 -1
- package/dist/components/context-window/ContextWindow.d.ts +4 -1
- package/dist/components/context-window/ContextWindow.js +1 -1
- package/dist/components/data-list/DataList.d.ts +3 -2
- package/dist/components/data-list/DataList.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +11 -5
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.d.ts +3 -2
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/fieldset/Fieldset.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +4 -0
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/footer/Footer.d.ts +4 -2
- package/dist/components/form/Form.d.ts +0 -14
- package/dist/components/form/Form.js +1 -1
- package/dist/components/gallery/Gallery.js +1 -1
- package/dist/components/gallery/GalleryViewer.js +1 -1
- package/dist/components/header/Header.d.ts +4 -3
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/hover-card/HoverCard.d.ts +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +2 -1
- package/dist/components/how-to-steps/HowToSteps.js +1 -1
- package/dist/components/image/Image.d.ts +4 -1
- package/dist/components/image/Image.js +1 -1
- package/dist/components/inline-citation/InlineCitation.d.ts +4 -2
- package/dist/components/inline-citation/InlineCitation.js +1 -1
- package/dist/components/menu/Menu.d.ts +6 -2
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/navigation-menu/NavigationMenu.d.ts +1 -1
- package/dist/components/navigation-menu/NavigationMenu.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +9 -4
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/page-layout/PageLayout.js +1 -1
- package/dist/components/pagination/Pagination.d.ts +3 -2
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/prompt-input/PromptInput.d.ts +5 -3
- package/dist/components/prompt-input/PromptInput.js +1 -1
- package/dist/components/provider/NebaProvider.d.ts +2 -2
- package/dist/components/provider/NebaProvider.js +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/reasoning/Reasoning.d.ts +7 -4
- package/dist/components/reasoning/Reasoning.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.d.ts +7 -1
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scroll-area/ScrollArea.d.ts +12 -0
- package/dist/components/scroll-area/ScrollArea.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/select/Select.d.ts +10 -2
- package/dist/components/select/Select.js +1 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- package/dist/components/sidebar/SidebarTrigger.js +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/sources/Sources.d.ts +1 -1
- package/dist/components/sources/Sources.js +1 -1
- package/dist/components/stack/Stack.js +1 -1
- package/dist/components/streaming-text/StreamingText.js +1 -1
- package/dist/components/switch/Switch.d.ts +13 -2
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/switch/index.d.ts +1 -1
- package/dist/components/table/Table.d.ts +4 -2
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/text-field/TextField.d.ts +13 -5
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.d.ts +6 -1
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/toggle/Toggle.js +1 -1
- package/dist/components/tool-call/ToolCall.js +1 -1
- package/dist/components/tour/Tour.js +1 -1
- package/dist/components/transfer/Transfer.js +1 -1
- package/dist/components/tree-select/TreeSelect.js +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/visually-hidden/VisuallyHidden.d.ts +2 -2
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/hooks/useElementSize.d.ts +6 -2
- package/dist/hooks/useElementSize.js +1 -1
- package/dist/hooks/useMediaQuery.d.ts +3 -2
- package/dist/hooks/useOnScreen.d.ts +2 -2
- package/dist/hooks/useShortcut.d.ts +11 -3
- package/dist/hooks/useShortcut.js +1 -1
- package/dist/internal/animate.d.ts +8 -0
- package/dist/internal/animate.js +1 -1
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-brush.d.ts +3 -1
- package/dist/internal/chart-brush.js +1 -1
- package/dist/internal/chart-frame.d.ts +28 -2
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +21 -0
- package/dist/internal/chart.js +1 -1
- package/dist/internal/defaults.d.ts +8 -4
- package/dist/internal/drag.d.ts +15 -0
- package/dist/internal/drag.js +1 -1
- package/dist/internal/drop.d.ts +12 -8
- package/dist/internal/drop.js +1 -1
- package/dist/internal/highlight.js +1 -1
- package/dist/internal/i18n.d.ts +40 -4
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +3 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/link.d.ts +27 -0
- package/dist/internal/link.js +1 -1
- package/dist/internal/new-tab.d.ts +19 -0
- package/dist/internal/new-tab.js +1 -0
- package/dist/internal/notch.d.ts +102 -0
- package/dist/internal/notch.js +1 -0
- package/dist/internal/observe.d.ts +3 -4
- package/dist/internal/picker.d.ts +30 -4
- package/dist/internal/picker.js +1 -1
- package/dist/internal/run.d.ts +7 -5
- package/dist/internal/run.js +1 -1
- package/dist/internal/search.d.ts +3 -3
- package/dist/internal/styles.d.ts +56 -0
- package/dist/internal/styles.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +287 -3
- package/dist/types.d.ts +18 -0
- package/package.json +23 -17
package/dist/internal/chart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseColor as t,readableInk as e}from"./color.js";import{dateFormatter as n,numberFormatter as r}from"./format.js";export const plotHeights={xs:120,sm:160,md:220,lg:280,xl:360};export const sparklineHeights={xs:16,sm:20,md:28,lg:40,xl:56};export const lineWidths={xs:1.5,sm:1.75,md:2,lg:2.25,xl:2.5};export const markerRadii={xs:3,sm:3.5,md:4,lg:4.5,xl:5};export const chartFontSizes={xs:10,sm:11,md:12,lg:13,xl:14};export const barMaxThickness={xs:14,sm:18,md:24,lg:30,xl:36};export const barBandRatio={default:.62,compact:.82};export const markGap=2;export const barRadius=4;export const chartPalette=["var(--neba-chart-1)","var(--neba-chart-2)","var(--neba-chart-3)","var(--neba-chart-4)","var(--neba-chart-5)","var(--neba-chart-6)","var(--neba-chart-7)","var(--neba-chart-8)"];export function inkOn(n,r){if(!n)return`var(--neba-chart-on-${r%chartPalette.length+1})`;const a=o.has(n)?null:t(n);return a?e(a.hsv):"var(--neba-surface)"}export function labelInk(t){return`color-mix(in oklab, ${t} 85%, var(--neba-fg))`}const o=new Set(["primary","secondary","success","warning","danger","info"]);export function resolveColor(t){return o.has(t)?`var(--neba-${t}-accent)`:t}export function seriesColor(t,e,n=chartPalette){return resolveColor(t?.color?t.color:n[e%n.length]??chartPalette[0])}const a=new Set;export function warnPaletteOverflow(t){"production"===process.env.NODE_ENV||t<=chartPalette.length||a.has(t)||(a.add(t),console.warn(`Neba: a chart was given ${t} series and its palette has ${chartPalette.length} colours, so the colours repeat from the ninth series. Fold the smallest into an "Other" series, or draw a second chart.`))}export function toFullShares(t,e,n){const r=[];return t.forEach((t,n)=>{!1!==e[n]&&t.forEach((t,e)=>{r[e]=(r[e]??0)+Math.abs(t.value??0)})}),t.map(t=>t.map((t,e)=>{if(null===t.value)return t;const o=r[e]??0;return{...t,value:0===o?0:t.value/o*100,label:t.label??n(t.value)}}))}export function toValue(t){return null==t?{value:null}:"number"==typeof t?{value:Number.isFinite(t)?t:null}:(t=>"object"==typeof t&&null!==t)(t)?{value:null!==t.y&&Number.isFinite(t.y)?t.y:null,x:t.x,z:t.z,color:t.color?resolveColor(t.color):void 0,label:t.label}:{value:null}}export function toValues(t){return t.map(t=>t.data.map(toValue))}export function zeroGaps(t){return t.map(t=>({...t,data:t.data.map(t=>null==t?0:"number"==typeof t?Number.isFinite(t)?t:0:null!==t.y&&Number.isFinite(t.y)?t:{...t,y:0})}))}export function toNumber(t){return t instanceof Date?Number.isFinite(t.getTime())?t.getTime():null:"number"==typeof t&&Number.isFinite(t)?t:null}export function pointX(t,e,n){return toNumber(t.x??n?.[e]??e)}export function categoryExtent(t,e){let n=1/0,r=-1/0,o=!1;return t.forEach(t=>{t.forEach((t,a)=>{if(null===t.value)return;const i=pointX(t,a,e);null!==i&&(o=!0,n=Math.min(n,i),r=Math.max(r,i))})}),o?{min:n,max:r}:null}export function bubbleRadius(t,e,n,r){return e>0&&Number.isFinite(t)&&!(t<=0)?Math.max(r,Math.sqrt(Math.min(t,e)/e)*n):0===t?0:r}export function categoryCount(t){return t.reduce((t,e)=>Math.max(t,e.data.length),0)}export function categoryAt(t,e,n){if(e&&t<e.length)return e[t];for(const e of n){const n=e[t]?.x;if(void 0!==n)return n}return t}export function extentOf(t,e){let n=1/0,r=-1/0,o=!1;if(e){const e=t.reduce((t,e)=>Math.max(t,e.length),0);for(let a=0;a<e;a++){let e=0,i=0;for(const n of t){const t=n[a]?.value;null!=t&&(o=!0,t>=0?e+=t:i+=t)}n=Math.min(n,i),r=Math.max(r,e)}}else for(const e of t)for(const{value:t}of e)null!==t&&(o=!0,n=Math.min(n,t),r=Math.max(r,t));return o?{min:n,max:r}:null}function i(t){const e=10**Math.floor(Math.log10(t)),n=t/e;return n<=1?e:n<=2?2*e:n<=5?5*e:10*e}export function valueScale(t,e={}){const{tickCount:n=5,includeZero:r=!0}=e;let o=e.min??(t?t.min:0),a=e.max??(t?t.max:1);r&&void 0===e.min&&(o=Math.min(o,0)),r&&void 0===e.max&&(a=Math.max(a,0));const u=void 0!==e.min&&void 0===e.max,s=void 0!==e.max&&void 0===e.min;if(a<=o&&(u||s)){const t=u?o:a,e=Math.abs(t)>0?Math.abs(t):2;u?a=o+e:o=a-e}else if(a===o){const t=Math.abs(a)>0?.5*Math.abs(a):1;o-=t,a+=t}const c=void 0!==e.min&&void 0!==e.max?function(t,e){const n=10**Math.floor(Math.log10(t/Math.max(1,e)));let r=i(t/Math.max(1,e)),o=1/0;for(const a of[.1,1,10])for(const i of[1,2,2.5,5]){const u=i*a*n,s=t/u,c=Math.round(s);if(c<1||Math.abs(s-c)>1e-9)continue;const l=Math.abs(c-e);l<o&&(o=l,r=u)}return r}(a-o,n):i((a-o)/Math.max(1,n)),l=void 0!==e.min?o:Math.floor(o/c)*c,h=void 0!==e.max?a:Math.ceil(a/c)*c,m=h-l||1,f=[];for(let t=l;t<=h+1e-9*c;t+=c)f.push(Number(t.toFixed(12)));return{min:l,max:h,ticks:f,fraction:t=>(t-l)/m}}const u=1e3,s=6e4,c=36e5,l=24*c,h=[{unit:"second",count:1,size:u},{unit:"second",count:5,size:5e3},{unit:"second",count:15,size:15e3},{unit:"second",count:30,size:3e4},{unit:"minute",count:1,size:s},{unit:"minute",count:5,size:3e5},{unit:"minute",count:15,size:9e5},{unit:"minute",count:30,size:18e5},{unit:"hour",count:1,size:c},{unit:"hour",count:3,size:3*c},{unit:"hour",count:6,size:6*c},{unit:"hour",count:12,size:12*c},{unit:"day",count:1,size:l},{unit:"day",count:2,size:2*l},{unit:"week",count:1,size:7*l},{unit:"week",count:2,size:14*l},{unit:"month",count:1,size:30*l},{unit:"quarter",count:1,size:91*l},{unit:"month",count:6,size:182*l},{unit:"year",count:1,size:365*l}];function m(t,e,n){const r=new Date(t);if("year"===e)r.setFullYear(r.getFullYear()+n);else if("quarter"===e)r.setMonth(r.getMonth()+3*n);else if("month"===e)r.setMonth(r.getMonth()+n);else if("week"===e)r.setDate(r.getDate()+7*n);else if("day"===e)r.setDate(r.getDate()+n);else{if("hour"!==e)return t+n*("minute"===e?s:u);r.setHours(r.getHours()+n)}return r.getTime()}const f={second:"minute",minute:"hour",hour:"day",day:"month",week:"week",month:"year",quarter:"year",year:"year"};function $(t,e,n){let r=function(t,e){const n=new Date(t);if("year"===e)return new Date(n.getFullYear(),0,1).getTime();if("quarter"===e)return new Date(n.getFullYear(),3*Math.floor(n.getMonth()/3),1).getTime();if("month"===e)return new Date(n.getFullYear(),n.getMonth(),1).getTime();if("week"===e){const t=new Date(n.getFullYear(),n.getMonth(),n.getDate());return t.setDate(t.getDate()-t.getDay()),t.getTime()}return"day"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime():"hour"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours()).getTime():"minute"===e?Math.floor(t/s)*s:Math.floor(t/u)*u}(t,f[e]);if("year"===e&&n>1){const t=new Date(r).getFullYear();r=new Date(t-(t%n+n)%n,0,1).getTime()}for(let o=0;o<500;o++){const o=m(r,e,n);if(o>t)return r;r=o}return r}export function timeScale(t,e={}){const{tickCount:n=6}=e;let r=e.min??t?.min??Date.parse("2000-01-01T00:00:00"),o=e.max??t?.max??r+l;o<=r&&(r-=l/2,o+=l/2);const a=o-r;let u=h[0],s=1/0;for(const t of h){const e=Math.abs(a/t.size-n);e<s&&(s=e,u=t)}const c=u.unit,f="year"===c?Math.max(1,Math.round(i(a/n/(365*l)))):u.count,x=e.min??$(r,c,f),p=[];let M=$(r,c,f);for(let t=0;t<500&&(p.push(M),!(M>o));t++)M=m(M,c,f);const d=e.max??p[p.length-1],g=d-x||1;return{min:x,max:d,ticks:p.filter(t=>t>=x&&t<=d),unit:c,step:f,fraction:t=>(t-x)/g}}function x(t,e){if("second"===t)return{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"};if("minute"===t||"hour"===t)return{hour:"2-digit",minute:"2-digit",hourCycle:"h23"};if("year"===t)return{year:"numeric"};const n="month"===t||"quarter"===t?{month:"short"}:{month:"short",day:"numeric"};return e?{...n,year:"numeric"}:n}export function formatTimeValue(t,e,r,o=!1){const a=x(e,!0);return n(r,o&&void 0===a.hour?{...a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}:a).format(new Date(t))}export function formatTimeTicks(t,e,r){const o=new Set(t.map(t=>new Date(t).getFullYear())).size>1;return t.map((t,a)=>n(r,x(e,o||0===a)).format(new Date(t)))}export function tickStride(t,e,n){if(t<=1||e<=0)return 1;const r=Math.max(1,Math.floor(e/Math.max(1,n)));return Math.max(1,Math.ceil(t/r))}export function showsTick(t,e,n,r){return t%n===0||r&&t===e-1}export function fitsLast(t,e,n,r){const o=(t-1)%e;return o>0&&o*n>=r+8}export function textWidth(t,e){let n=0;for(const e of t)n+=/[ᄀ-ᇿ⺀-가-豈-︰-﹏]/.test(e)?1:.6;return n*e}export function turnedAxis(t,e){const n=Math.max(-90,Math.min(90,t??0)),r=Math.abs(n)*(Math.PI/180),o=Math.sin(r),a=Math.cos(r);return 0===n?{angle:0,depth:()=>e,room:t=>Math.max(t,1)+12,cut:t=>t,offset:e+6,overhang:t=>t/2,anchor:"middle"}:{angle:n,depth:t=>t*o+e*a,room:()=>e/Math.max(.2,o)+4,cut:t=>Math.max(0,(t-e*a)/Math.max(.05,o)),offset:8+e/2*a,overhang:t=>t*a,anchor:n<0?"end":"start"}}export function truncate(t,e,n){if(e<=0||textWidth(t,n)<=e)return t;const r=e-textWidth("…",n);let o="",a=0;for(const e of t){const t=a+textWidth(e,n);if(t>r)break;a=t,o+=e}return o.length>0?`${o.trimEnd()}…`:"…"}export function bandScale(t,e,n){const r=t>0?e/t:e;return{step:r,band:r*n,centre:t=>r*(t+.5)}}export function linePath(t,e){const n=[];let r=[];const o=()=>{if(0!==r.length){if(1===r.length)n.push(`M${r[0].x} ${r[0].y}h0`);else if("step"===e){n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++){const e=(r[t-1].x+r[t].x)/2;n.push(`H${e}V${r[t].y}H${r[t].x}`)}}else if("smooth"===e)n.push(`M${r[0].x} ${r[0].y}`),n.push(function(t){const e=t.length,n=[];for(let r=0;r<e-1;r++){const e=t[r+1].x-t[r].x;n.push(0===e?0:(t[r+1].y-t[r].y)/e)}const r=[n[0]??0];for(let t=1;t<e-1;t++){const e=n[t-1],o=n[t];r.push(e*o<=0?0:2*e*o/(e+o))}r.push(n[e-2]??0);const o=[];for(let n=0;n<e-1;n++){const e=(t[n+1].x-t[n].x)/3;o.push(`C${t[n].x+e} ${t[n].y+r[n]*e} ${t[n+1].x-e} ${t[n+1].y-r[n+1]*e} ${t[n+1].x} ${t[n+1].y}`)}return o.join("")}(r));else{n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++)n.push(`L${r[t].x} ${r[t].y}`)}r=[]}};for(const e of t)null===e?o():r.push(e);return o(),n.join("")}export function areaPath(t,e,n){const r=[];let o=0;const a=a=>{const i=t.slice(o,a).filter(Boolean);if(0===i.length)return;const u="number"==typeof e?i.map(t=>({x:t.x,y:e})).reverse():e.slice(o,a).filter(Boolean).reverse();if(0===u.length)return;const s=linePath(i,n),c=linePath(u,n).replace(/^M/,"L");r.push(`${s}${c}Z`)};for(let e=0;e<t.length;e++)null===t[e]&&(a(e),o=e+1);return a(t.length),r.join("")}export function barPath(t,e,n,r,o,a){const i=Math.max(0,Math.min(o,n/2,r/2));if(0===i||n<=0||r<=0)return`M${t} ${e}h${n}v${r}h${-n}Z`;const u=(t,e)=>`a${i} ${i} 0 0 1 ${t} ${e}`;return"up"===a?`M${t} ${e+r}V${e+i}${u(i,-i)}H${t+n-i}${u(i,i)}V${e+r}Z`:"down"===a?`M${t} ${e}H${t+n}V${e+r-i}${u(-i,i)}H${t+i}${u(-i,-i)}Z`:"right"===a?`M${t} ${e}H${t+n-i}${u(i,i)}V${e+r-i}${u(-i,i)}H${t}Z`:`M${t+n} ${e+r}H${t+i}${u(-i,-i)}V${e+i}${u(i,-i)}H${t+n}Z`}export const markShapes=["circle","square","triangle","diamond","cross"];const p={circle:1,square:.8862,triangle:1.5551,diamond:1.2533,cross:1.189};export function markPath(t,e,n,r){const o=Math.max(0,r)*p[t];if(0===o)return"";if("circle"===t)return`M${e-o} ${n}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 ${2*-o} 0Z`;if("square"===t)return`M${e-o} ${n-o}h${2*o}v${2*o}h${2*-o}Z`;if("diamond"===t)return`M${e} ${n-o}L${e+o} ${n}L${e} ${n+o}L${e-o} ${n}Z`;if("triangle"===t){return`M${[0,120,240].map(t=>{const r=(t-90)*Math.PI/180;return`${e+o*Math.cos(r)} ${n+o*Math.sin(r)}`}).join("L")}Z`}const a=o/3;return`M${e-a} ${n-o}h${2*a}v${o-a}h${o-a}v${2*a}h${-(o-a)}v${o-a}h${2*-a}v${-(o-a)}h${-(o-a)}v${2*-a}h${o-a}Z`}export function ringPath(t,e,n,r,o){const a=r=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(o-r)>=360){const t=r+180;return`M${a(r)}A${n} ${n} 0 1 1 ${a(t)}A${n} ${n} 0 1 1 ${a(r)}`}const i=Math.abs(o-r)>180?1:0;return`M${a(r)}A${n} ${n} 0 ${i} 1 ${a(o)}`}export function arcPath(t,e,n,r,o,a){const i=(n,r)=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(a-o)>=360){const t=o+180;return r>0?`M${i(n,o)}A${n} ${n} 0 1 1 ${i(n,t)}A${n} ${n} 0 1 1 ${i(n,o)}ZM${i(r,o)}A${r} ${r} 0 1 0 ${i(r,t)}A${r} ${r} 0 1 0 ${i(r,o)}Z`:`M${i(n,o)}A${n} ${n} 0 1 1 ${i(n,t)}A${n} ${n} 0 1 1 ${i(n,o)}Z`}const u=Math.abs(a-o)>180?1:0;return r<=0?`M${t} ${e}L${i(n,o)}A${n} ${n} 0 ${u} 1 ${i(n,a)}Z`:`M${i(n,o)}A${n} ${n} 0 ${u} 1 ${i(n,a)}L${i(r,a)}A${r} ${r} 0 ${u} 0 ${i(r,o)}Z`}export const rampSteps=5;export function rampStep(t,e,n,r,o=0){if("diverging"===r){const r=Math.max(Math.abs(n-o),Math.abs(o-e));if(!(r>0))return 2;const a=(t-o)/r;return Math.min(4,Math.max(0,2+Math.round(2*a)))}const a=n-e;return a>0?Math.min(4,Math.max(0,Math.floor((t-e)/a*5))):t>0?4:0}export function rampFill(t,e){return`var(--neba-chart-${"diverging"===e?"div":"seq"}-${t+1})`}export function rampInk(t,e){return`var(--neba-chart-${"diverging"===e?"div":"seq"}-on-${t+1})`}export function squarify(t,e,n){const r=t.reduce((t,e)=>t+Math.max(0,e),0);if(!(r>0)||e<=0||n<=0)return[];const o=e*n/r,a=t.map((t,e)=>({index:e,area:Math.max(0,t)*o})).filter(t=>t.area>0).sort((t,e)=>e.area-t.area),i=[];let u=0,s=0,c=e,l=n,h=[];const m=t=>{const e=Math.min(c,l),n=t.reduce((t,e)=>t+e.area,0);if(!(n>0&&e>0))return 1/0;const r=t[0].area,o=t[t.length-1].area;return Math.max(e*e*r/(n*n),n*n/(e*e*o))},f=()=>{const t=h.reduce((t,e)=>t+e.area,0),e=Math.min(c,l),n=e>0?t/e:0,r=c>=l;let o=0;for(const t of h){const e=n>0?t.area/n:0;i.push(r?{index:t.index,x:u,y:s+o,width:n,height:e}:{index:t.index,x:u+o,y:s,width:e,height:n}),o+=e}r?(u+=n,c-=n):(s+=n,l-=n),h=[]};for(const t of a)0===h.length||m([...h,t])<=m(h)||f(),h.push(t);return h.length>0&&f(),i}const M={month:"short",day:"numeric"},d={notation:"compact",maximumFractionDigits:1},g={maximumFractionDigits:2};export function labelledPoints(t,e){if("all"===e)return()=>!0;if("last"===e){let e=-1;for(let n=t.length-1;n>=0;n--)if(null!==t[n].value){e=n;break}return t=>t===e}let n=1/0,r=-1/0;for(const e of t)null!==e.value&&(n=Math.min(n,e.value),r=Math.max(r,e.value));return e=>{const o=t[e].value;return null!==o&&(o===n||o===r)}}export function formatCategory(t,e){return t instanceof Date?n(e,M).format(t):String(t)}export function compactNumber(t,e){return Math.abs(t)>=1e4?r(e,d).format(t):r(e,g).format(t)}
|
|
1
|
+
import{parseColor as t,readableInk as e}from"./color.js";import{dateFormatter as n,numberFormatter as r}from"./format.js";export const plotHeights={xs:120,sm:160,md:220,lg:280,xl:360};export const sparklineHeights={xs:16,sm:20,md:28,lg:40,xl:56};export const lineWidths={xs:1.5,sm:1.75,md:2,lg:2.25,xl:2.5};export const markerRadii={xs:3,sm:3.5,md:4,lg:4.5,xl:5};export const chartFontSizes={xs:10,sm:11,md:12,lg:13,xl:14};export const barMaxThickness={xs:14,sm:18,md:24,lg:30,xl:36};export const barBandRatio={default:.62,compact:.82};export const markGap=2;export const barRadius=4;export const chartPalette=["var(--neba-chart-1)","var(--neba-chart-2)","var(--neba-chart-3)","var(--neba-chart-4)","var(--neba-chart-5)","var(--neba-chart-6)","var(--neba-chart-7)","var(--neba-chart-8)"];export function inkOn(n,r){if(!n)return`var(--neba-chart-on-${r%chartPalette.length+1})`;const a=o.has(n)?null:t(n);return a?e(a.hsv):"var(--neba-surface)"}export function labelInk(t){return`color-mix(in oklab, ${t} 85%, var(--neba-fg))`}const o=new Set(["primary","secondary","success","warning","danger","info"]);export function resolveColor(t){return o.has(t)?`var(--neba-${t}-accent)`:t}export function seriesColor(t,e,n=chartPalette){return resolveColor(t?.color?t.color:n[e%n.length]??chartPalette[0])}const a=new Set;export function warnPaletteOverflow(t){"production"===process.env.NODE_ENV||t<=chartPalette.length||a.has(t)||(a.add(t),console.warn(`Neba: a chart was given ${t} series and its palette has ${chartPalette.length} colours, so the colours repeat from the ninth series. Fold the smallest into an "Other" series, or draw a second chart.`))}export function toFullShares(t,e,n){const r=[];return t.forEach((t,n)=>{!1!==e[n]&&t.forEach((t,e)=>{r[e]=(r[e]??0)+Math.abs(t.value??0)})}),t.map(t=>t.map((t,e)=>{if(null===t.value)return t;const o=r[e]??0;return{...t,value:0===o?0:t.value/o*100,label:t.label??n(t.value)}}))}export function toValue(t){return null==t?{value:null}:"number"==typeof t?{value:Number.isFinite(t)?t:null}:(t=>"object"==typeof t&&null!==t)(t)?{value:null!==t.y&&Number.isFinite(t.y)?t.y:null,x:t.x,z:t.z,color:t.color?resolveColor(t.color):void 0,label:t.label}:{value:null}}export function toValues(t){return t.map(t=>t.data.map(toValue))}export function zeroGaps(t){return t.map(t=>({...t,data:t.data.map(t=>null==t?0:"number"==typeof t?Number.isFinite(t)?t:0:null!==t.y&&Number.isFinite(t.y)?t:{...t,y:0})}))}export function toNumber(t){return t instanceof Date?Number.isFinite(t.getTime())?t.getTime():null:"number"==typeof t&&Number.isFinite(t)?t:null}export function pointX(t,e,n){return toNumber(t.x??n?.[e]??e)}export function categoryExtent(t,e){let n=1/0,r=-1/0,o=!1;return t.forEach(t=>{t.forEach((t,a)=>{if(null===t.value)return;const i=pointX(t,a,e);null!==i&&(o=!0,n=Math.min(n,i),r=Math.max(r,i))})}),o?{min:n,max:r}:null}export function bubbleRadius(t,e,n,r){return e>0&&Number.isFinite(t)&&!(t<=0)?Math.max(r,Math.sqrt(Math.min(t,e)/e)*n):0===t?0:r}export function categoryCount(t){return t.reduce((t,e)=>Math.max(t,e.data.length),0)}export function categoryAt(t,e,n){if(e&&t<e.length)return e[t];for(const e of n){const n=e[t]?.x;if(void 0!==n)return n}return t}export function extentOf(t,e){let n=1/0,r=-1/0,o=!1;if(e){const e=t.reduce((t,e)=>Math.max(t,e.length),0);for(let a=0;a<e;a++){let e=0,i=0;for(const n of t){const t=n[a]?.value;null!=t&&(o=!0,t>=0?e+=t:i+=t)}n=Math.min(n,i),r=Math.max(r,e)}}else for(const e of t)for(const{value:t}of e)null!==t&&(o=!0,n=Math.min(n,t),r=Math.max(r,t));return o?{min:n,max:r}:null}function i(t){const e=10**Math.floor(Math.log10(t)),n=t/e;return n<=1?e:n<=2?2*e:n<=5?5*e:10*e}export function valueScale(t,e={}){const{tickCount:n=5}=e,{low:r,high:o}=u(t,e),a=void 0!==e.min&&void 0!==e.max?function(t,e){const n=10**Math.floor(Math.log10(t/Math.max(1,e)));let r=i(t/Math.max(1,e)),o=1/0;for(const a of[.1,1,10])for(const i of[1,2,2.5,5]){const u=i*a*n,s=t/u,c=Math.round(s);if(c<1||Math.abs(s-c)>1e-9)continue;const l=Math.abs(c-e);l<o&&(o=l,r=u)}return r}(o-r,n):i((o-r)/Math.max(1,n)),s=void 0!==e.min?r:Number((Math.floor(r/a+1e-9)*a).toFixed(12)),c=void 0!==e.max?o:Number((Math.ceil(o/a-1e-9)*a).toFixed(12)),l=c-s||1,h=[];for(let t=s;t<=c+1e-9*a;t+=a)h.push(Number(t.toFixed(12)));return{min:s,max:c,ticks:h,fraction:t=>(t-s)/l}}export function alignedScale(t,e,n={}){const r=Math.max(1,Math.round(e)),{low:o,high:a}=u(t,n);let s,c=i((a-o)/r);if(void 0!==n.min&&void 0!==n.max)c=(a-o)/r,s=o;else if(void 0!==n.max)s=a-r*c;else if(void 0!==n.min)s=o;else for(s=Math.floor(o/c+1e-9)*c;s+r*c<a-1e-9*c;)c=i(1.000001*c),s=Math.floor(o/c+1e-9)*c;const l=Array.from({length:r+1},(t,e)=>Number((s+e*c).toFixed(12))),h=l[0],m=l[r]-h||1;return{min:h,max:l[r],ticks:l,fraction:t=>(t-h)/m}}function u(t,e){const{includeZero:n=!0}=e;let r=e.min??(t?t.min:0),o=e.max??(t?t.max:1);n&&void 0===e.min&&(r=Math.min(r,0)),n&&void 0===e.max&&(o=Math.max(o,0));const a=void 0!==e.min&&void 0===e.max,i=void 0!==e.max&&void 0===e.min;if(o<=r&&(a||i)){const t=a?r:o,e=Math.abs(t)>0?Math.abs(t):2;a?o=r+e:r=o-e}else if(o===r){const t=Math.abs(o)>0?.5*Math.abs(o):1;r-=t,o+=t}return{low:r,high:o}}const s=1e3,c=6e4,l=36e5,h=24*l,m=[{unit:"second",count:1,size:s},{unit:"second",count:5,size:5e3},{unit:"second",count:15,size:15e3},{unit:"second",count:30,size:3e4},{unit:"minute",count:1,size:c},{unit:"minute",count:5,size:3e5},{unit:"minute",count:15,size:9e5},{unit:"minute",count:30,size:18e5},{unit:"hour",count:1,size:l},{unit:"hour",count:3,size:3*l},{unit:"hour",count:6,size:6*l},{unit:"hour",count:12,size:12*l},{unit:"day",count:1,size:h},{unit:"day",count:2,size:2*h},{unit:"week",count:1,size:7*h},{unit:"week",count:2,size:14*h},{unit:"month",count:1,size:30*h},{unit:"quarter",count:1,size:91*h},{unit:"month",count:6,size:182*h},{unit:"year",count:1,size:365*h}];function f(t,e,n){const r=new Date(t);if("year"===e)r.setFullYear(r.getFullYear()+n);else if("quarter"===e)r.setMonth(r.getMonth()+3*n);else if("month"===e)r.setMonth(r.getMonth()+n);else if("week"===e)r.setDate(r.getDate()+7*n);else if("day"===e)r.setDate(r.getDate()+n);else{if("hour"!==e)return t+n*("minute"===e?c:s);r.setHours(r.getHours()+n)}return r.getTime()}const $={second:"minute",minute:"hour",hour:"day",day:"month",week:"week",month:"year",quarter:"year",year:"year"};function x(t,e,n){let r=function(t,e){const n=new Date(t);if("year"===e)return new Date(n.getFullYear(),0,1).getTime();if("quarter"===e)return new Date(n.getFullYear(),3*Math.floor(n.getMonth()/3),1).getTime();if("month"===e)return new Date(n.getFullYear(),n.getMonth(),1).getTime();if("week"===e){const t=new Date(n.getFullYear(),n.getMonth(),n.getDate());return t.setDate(t.getDate()-t.getDay()),t.getTime()}return"day"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime():"hour"===e?new Date(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours()).getTime():"minute"===e?Math.floor(t/c)*c:Math.floor(t/s)*s}(t,$[e]);if("year"===e&&n>1){const t=new Date(r).getFullYear();r=new Date(t-(t%n+n)%n,0,1).getTime()}for(let o=0;o<500;o++){const o=f(r,e,n);if(o>t)return r;r=o}return r}export function timeScale(t,e={}){const{tickCount:n=6}=e;let r=e.min??t?.min??Date.parse("2000-01-01T00:00:00"),o=e.max??t?.max??r+h;o<=r&&(r-=h/2,o+=h/2);const a=o-r;let u=m[0],s=1/0;for(const t of m){const e=Math.abs(a/t.size-n);e<s&&(s=e,u=t)}const c=u.unit,l="year"===c?Math.max(1,Math.round(i(a/n/(365*h)))):u.count,$=e.min??x(r,c,l),M=[];let p=x(r,c,l);for(let t=0;t<500&&(M.push(p),!(p>o));t++)p=f(p,c,l);const d=e.max??M[M.length-1],g=d-$||1;return{min:$,max:d,ticks:M.filter(t=>t>=$&&t<=d),unit:c,step:l,fraction:t=>(t-$)/g}}function M(t,e){if("second"===t)return{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"};if("minute"===t||"hour"===t)return{hour:"2-digit",minute:"2-digit",hourCycle:"h23"};if("year"===t)return{year:"numeric"};const n="month"===t||"quarter"===t?{month:"short"}:{month:"short",day:"numeric"};return e?{...n,year:"numeric"}:n}export function formatTimeValue(t,e,r,o=!1){const a=M(e,!0);return n(r,o&&void 0===a.hour?{...a,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}:a).format(new Date(t))}export function formatTimeTicks(t,e,r){const o=new Set(t.map(t=>new Date(t).getFullYear())).size>1;return t.map((t,a)=>n(r,M(e,o||0===a)).format(new Date(t)))}export function tickStride(t,e,n){if(t<=1||e<=0)return 1;const r=Math.max(1,Math.floor(e/Math.max(1,n)));return Math.max(1,Math.ceil(t/r))}export function showsTick(t,e,n,r){return t%n===0||r&&t===e-1}export function fitsLast(t,e,n,r){const o=(t-1)%e;return o>0&&o*n>=r+8}export function textWidth(t,e){let n=0;for(const e of t)n+=/[ᄀ-ᇿ⺀-가-豈-︰-﹏]/.test(e)?1:.6;return n*e}export function turnedAxis(t,e){const n=Math.max(-90,Math.min(90,t??0)),r=Math.abs(n)*(Math.PI/180),o=Math.sin(r),a=Math.cos(r);return 0===n?{angle:0,depth:()=>e,room:t=>Math.max(t,1)+12,cut:t=>t,offset:e+6,overhang:t=>t/2,anchor:"middle"}:{angle:n,depth:t=>t*o+e*a,room:()=>e/Math.max(.2,o)+4,cut:t=>Math.max(0,(t-e*a)/Math.max(.05,o)),offset:8+e/2*a,overhang:t=>t*a,anchor:n<0?"end":"start"}}export function truncate(t,e,n){if(e<=0||textWidth(t,n)<=e)return t;const r=e-textWidth("…",n);let o="",a=0;for(const e of t){const t=a+textWidth(e,n);if(t>r)break;a=t,o+=e}return o.length>0?`${o.trimEnd()}…`:"…"}export function bandScale(t,e,n){const r=t>0?e/t:e;return{step:r,band:r*n,centre:t=>r*(t+.5)}}export function linePath(t,e){const n=[];let r=[];const o=()=>{if(0!==r.length){if(1===r.length)n.push(`M${r[0].x} ${r[0].y}h0`);else if("step"===e){n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++){const e=(r[t-1].x+r[t].x)/2;n.push(`H${e}V${r[t].y}H${r[t].x}`)}}else if("smooth"===e)n.push(`M${r[0].x} ${r[0].y}`),n.push(function(t){const e=t.length,n=[];for(let r=0;r<e-1;r++){const e=t[r+1].x-t[r].x;n.push(0===e?0:(t[r+1].y-t[r].y)/e)}const r=[n[0]??0];for(let t=1;t<e-1;t++){const e=n[t-1],o=n[t];r.push(e*o<=0?0:2*e*o/(e+o))}r.push(n[e-2]??0);const o=[];for(let n=0;n<e-1;n++){const e=(t[n+1].x-t[n].x)/3;o.push(`C${t[n].x+e} ${t[n].y+r[n]*e} ${t[n+1].x-e} ${t[n+1].y-r[n+1]*e} ${t[n+1].x} ${t[n+1].y}`)}return o.join("")}(r));else{n.push(`M${r[0].x} ${r[0].y}`);for(let t=1;t<r.length;t++)n.push(`L${r[t].x} ${r[t].y}`)}r=[]}};for(const e of t)null===e?o():r.push(e);return o(),n.join("")}export function areaPath(t,e,n){const r=[];let o=0;const a=a=>{const i=t.slice(o,a).filter(Boolean);if(0===i.length)return;const u="number"==typeof e?i.map(t=>({x:t.x,y:e})).reverse():e.slice(o,a).filter(Boolean).reverse();if(0===u.length)return;const s=linePath(i,n),c=linePath(u,n).replace(/^M/,"L");r.push(`${s}${c}Z`)};for(let e=0;e<t.length;e++)null===t[e]&&(a(e),o=e+1);return a(t.length),r.join("")}export function barPath(t,e,n,r,o,a){const i=Math.max(0,Math.min(o,n/2,r/2));if(0===i||n<=0||r<=0)return`M${t} ${e}h${n}v${r}h${-n}Z`;const u=(t,e)=>`a${i} ${i} 0 0 1 ${t} ${e}`;return"up"===a?`M${t} ${e+r}V${e+i}${u(i,-i)}H${t+n-i}${u(i,i)}V${e+r}Z`:"down"===a?`M${t} ${e}H${t+n}V${e+r-i}${u(-i,i)}H${t+i}${u(-i,-i)}Z`:"right"===a?`M${t} ${e}H${t+n-i}${u(i,i)}V${e+r-i}${u(-i,i)}H${t}Z`:`M${t+n} ${e+r}H${t+i}${u(-i,-i)}V${e+i}${u(i,-i)}H${t+n}Z`}export const markShapes=["circle","square","triangle","diamond","cross"];const p={circle:1,square:.8862,triangle:1.5551,diamond:1.2533,cross:1.189};export function markPath(t,e,n,r){const o=Math.max(0,r)*p[t];if(0===o)return"";if("circle"===t)return`M${e-o} ${n}a${o} ${o} 0 1 0 ${2*o} 0a${o} ${o} 0 1 0 ${2*-o} 0Z`;if("square"===t)return`M${e-o} ${n-o}h${2*o}v${2*o}h${2*-o}Z`;if("diamond"===t)return`M${e} ${n-o}L${e+o} ${n}L${e} ${n+o}L${e-o} ${n}Z`;if("triangle"===t){return`M${[0,120,240].map(t=>{const r=(t-90)*Math.PI/180;return`${e+o*Math.cos(r)} ${n+o*Math.sin(r)}`}).join("L")}Z`}const a=o/3;return`M${e-a} ${n-o}h${2*a}v${o-a}h${o-a}v${2*a}h${-(o-a)}v${o-a}h${2*-a}v${-(o-a)}h${-(o-a)}v${2*-a}h${o-a}Z`}export function ringPath(t,e,n,r,o){const a=r=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(o-r)>=360){const t=r+180;return`M${a(r)}A${n} ${n} 0 1 1 ${a(t)}A${n} ${n} 0 1 1 ${a(r)}`}const i=Math.abs(o-r)>180?1:0;return`M${a(r)}A${n} ${n} 0 ${i} 1 ${a(o)}`}export function arcPath(t,e,n,r,o,a){const i=(n,r)=>{const o=(r-90)*Math.PI/180;return`${t+n*Math.cos(o)} ${e+n*Math.sin(o)}`};if(Math.abs(a-o)>=360){const t=o+180;return r>0?`M${i(n,o)}A${n} ${n} 0 1 1 ${i(n,t)}A${n} ${n} 0 1 1 ${i(n,o)}ZM${i(r,o)}A${r} ${r} 0 1 0 ${i(r,t)}A${r} ${r} 0 1 0 ${i(r,o)}Z`:`M${i(n,o)}A${n} ${n} 0 1 1 ${i(n,t)}A${n} ${n} 0 1 1 ${i(n,o)}Z`}const u=Math.abs(a-o)>180?1:0;return r<=0?`M${t} ${e}L${i(n,o)}A${n} ${n} 0 ${u} 1 ${i(n,a)}Z`:`M${i(n,o)}A${n} ${n} 0 ${u} 1 ${i(n,a)}L${i(r,a)}A${r} ${r} 0 ${u} 0 ${i(r,o)}Z`}export const rampSteps=5;export function rampStep(t,e,n,r,o=0){if("diverging"===r){const r=Math.max(Math.abs(n-o),Math.abs(o-e));if(!(r>0))return 2;const a=(t-o)/r;return Math.min(4,Math.max(0,2+Math.round(2*a)))}const a=n-e;return a>0?Math.min(4,Math.max(0,Math.floor((t-e)/a*5))):t>0?4:0}export function rampFill(t,e){return`var(--neba-chart-${"diverging"===e?"div":"seq"}-${t+1})`}export function rampInk(t,e){return`var(--neba-chart-${"diverging"===e?"div":"seq"}-on-${t+1})`}export function squarify(t,e,n){const r=t.reduce((t,e)=>t+Math.max(0,e),0);if(!(r>0)||e<=0||n<=0)return[];const o=e*n/r,a=t.map((t,e)=>({index:e,area:Math.max(0,t)*o})).filter(t=>t.area>0).sort((t,e)=>e.area-t.area),i=[];let u=0,s=0,c=e,l=n,h=[];const m=t=>{const e=Math.min(c,l),n=t.reduce((t,e)=>t+e.area,0);if(!(n>0&&e>0))return 1/0;const r=t[0].area,o=t[t.length-1].area;return Math.max(e*e*r/(n*n),n*n/(e*e*o))},f=()=>{const t=h.reduce((t,e)=>t+e.area,0),e=Math.min(c,l),n=e>0?t/e:0,r=c>=l;let o=0;for(const t of h){const e=n>0?t.area/n:0;i.push(r?{index:t.index,x:u,y:s+o,width:n,height:e}:{index:t.index,x:u+o,y:s,width:e,height:n}),o+=e}r?(u+=n,c-=n):(s+=n,l-=n),h=[]};for(const t of a)0===h.length||m([...h,t])<=m(h)||f(),h.push(t);return h.length>0&&f(),i}const d={month:"short",day:"numeric"},g={notation:"compact",maximumFractionDigits:1},v={maximumFractionDigits:2};export function labelledPoints(t,e){if("all"===e)return()=>!0;if("last"===e){let e=-1;for(let n=t.length-1;n>=0;n--)if(null!==t[n].value){e=n;break}return t=>t===e}let n=1/0,r=-1/0;for(const e of t)null!==e.value&&(n=Math.min(n,e.value),r=Math.max(r,e.value));return e=>{const o=t[e].value;return null!==o&&(o===n||o===r)}}export function formatCategory(t,e){return t instanceof Date?n(e,d).format(t):String(t)}export function compactNumber(t,e){return Math.abs(t)>=1e4?r(e,g).format(t):r(e,v).format(t)}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaDensity, NebaSize, NebaVariant } from '../types.js';
|
|
2
|
+
import type { NebaDensity, NebaLabelPlacement, NebaSize, NebaVariant } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The prop values an application can set once instead of at every call site.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* Five, and the list is closed on purpose. These are the axes whose right value
|
|
7
7
|
* is a property of the *product* rather than of the control — a dense
|
|
8
|
-
* application is dense everywhere,
|
|
8
|
+
* application is dense everywhere, a Korean one is Korean everywhere, and a
|
|
9
|
+
* form whose fields put their labels in two different places looks assembled
|
|
10
|
+
* rather than designed.
|
|
9
11
|
*
|
|
10
12
|
* `color` is deliberately not among them. A component's colour default is often
|
|
11
13
|
* semantic — an Alert is `info`, a Popconfirm is `danger`, severity carries
|
|
@@ -20,8 +22,10 @@ export interface NebaDefaults {
|
|
|
20
22
|
variant?: NebaVariant;
|
|
21
23
|
/** BCP 47 tag for every component that says a word on its own behalf. */
|
|
22
24
|
locale?: string;
|
|
25
|
+
/** Where every field-shaped component draws its label. */
|
|
26
|
+
labelPlacement?: NebaLabelPlacement;
|
|
23
27
|
}
|
|
24
|
-
/** Which of the
|
|
28
|
+
/** Which of the five a given component actually accepts. */
|
|
25
29
|
export type DefaultableKey = keyof NebaDefaults;
|
|
26
30
|
/**
|
|
27
31
|
* `null` when there is no provider, which is the common case and the one worth
|
package/dist/internal/drag.d.ts
CHANGED
|
@@ -23,6 +23,21 @@
|
|
|
23
23
|
* nothing and cost a frame of latency on the one gesture where latency is the
|
|
24
24
|
* whole feel of it.
|
|
25
25
|
*/
|
|
26
|
+
/**
|
|
27
|
+
* How many screen pixels one of an element's own layout pixels is drawn as, on
|
|
28
|
+
* each axis.
|
|
29
|
+
*
|
|
30
|
+
* A pointer moves in screen pixels and an element is laid out in its own.
|
|
31
|
+
* Inside a scaled ancestor — a Mockup's screen, a zoom entrance part way
|
|
32
|
+
* through — the two differ, and a drag taken one to one moves an edge by the
|
|
33
|
+
* wrong amount: at a scale of 0.3, a third as far as the hand did. A pointer
|
|
34
|
+
* delta divided by this is a distance in the element's own pixels. An element
|
|
35
|
+
* with no box is taken as unscaled rather than divided by.
|
|
36
|
+
*/
|
|
37
|
+
export declare function drawnScale(element: HTMLElement): {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
};
|
|
26
41
|
export interface PointerDragOptions {
|
|
27
42
|
/**
|
|
28
43
|
* The element the three listeners go on, and the one the pointer is captured
|
package/dist/internal/drag.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function beginPointerDrag({target:e,pointerId:t,onMove:
|
|
1
|
+
export function drawnScale(e){const t=e.getBoundingClientRect();return{x:e.offsetWidth>0&&t.width/e.offsetWidth||1,y:e.offsetHeight>0&&t.height/e.offsetHeight||1}}export function beginPointerDrag({target:e,pointerId:t,onMove:n,onEnd:r,capture:o=!0,selectable:i=!0,mark:s=!0}){const c=i?function(){const e=document.body,t=e.style.getPropertyValue("-webkit-user-select");return e.style.setProperty("-webkit-user-select","none"),()=>{t?e.style.setProperty("-webkit-user-select",t):e.style.removeProperty("-webkit-user-select")}}():null,a=o?e:e.ownerDocument;if(s&&(e.dataset.dragging="true"),o)try{e.setPointerCapture?.(t)}catch{}let d=!0;const u=()=>{d&&(d=!1,a.removeEventListener("pointermove",n),a.removeEventListener("pointerup",l),a.removeEventListener("pointercancel",l),s&&delete e.dataset.dragging,c?.())},l=()=>{u(),r?.()};return a.addEventListener("pointermove",n),a.addEventListener("pointerup",l),a.addEventListener("pointercancel",l),u}
|
package/dist/internal/drop.d.ts
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Two components take dropped files — a
|
|
5
5
|
* [FilePicker](../components/inputs/file-picker), and a
|
|
6
6
|
* [PromptInput](../components/agent/prompt-input) whose shell is a drop target
|
|
7
|
-
* — and both have to get the same
|
|
8
|
-
* the kind of thing that is written correctly once and approximately
|
|
9
|
-
* time.
|
|
7
|
+
* — and both have to get the same things right. None of them is hard; all of
|
|
8
|
+
* them are the kind of thing that is written correctly once and approximately
|
|
9
|
+
* the second time.
|
|
10
10
|
*/
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
/**
|
|
@@ -40,12 +40,16 @@ export interface DropZone {
|
|
|
40
40
|
/**
|
|
41
41
|
* An area that takes dropped files.
|
|
42
42
|
*
|
|
43
|
-
* `accept` is called with the files, folders already filtered out
|
|
44
|
-
* `undefined` and the zone is off: no listeners at all, and
|
|
45
|
-
* true — which is what a disabled or read-only control
|
|
46
|
-
* component with nothing to do with files wants.
|
|
43
|
+
* `accept` is called with the files, folders already filtered out, and never
|
|
44
|
+
* with none. Pass `undefined` and the zone is off: no listeners at all, and
|
|
45
|
+
* `over` never turns true — which is what a disabled or read-only control
|
|
46
|
+
* wants, and what a component with nothing to do with files wants.
|
|
47
47
|
*
|
|
48
|
-
*
|
|
48
|
+
* Three details are the whole reason this is shared rather than written twice.
|
|
49
|
+
*
|
|
50
|
+
* **Only a drag with files in it.** Every other drag is let through untouched:
|
|
51
|
+
* text dragged into a PromptInput is the field's to insert, and a zone that
|
|
52
|
+
* took it would light up, swallow the text and report no files.
|
|
49
53
|
*
|
|
50
54
|
* **The depth count.** `dragenter` and `dragleave` fire for every child the
|
|
51
55
|
* pointer crosses, so a boolean flickers the entire time a file is over a box
|
package/dist/internal/drop.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";export function droppedFiles(e){const r=[...e.items],t=[...e.files];return r.length!==t.length?t:t.filter((e,t)=>{const n=r[t]?.webkitGetAsEntry?.();return!n||n.isFile})}export function useDropZone(
|
|
1
|
+
"use client";import*as e from"react";export function droppedFiles(e){const r=[...e.items],t=[...e.files];return r.length!==t.length?t:t.filter((e,t)=>{const n=r[t]?.webkitGetAsEntry?.();return!n||n.isFile})}function r(e){return[...e.dataTransfer?.types??[]].includes("Files")}export function useDropZone(t){const n=e.useRef(0),[o,s]=e.useState(!1),u=void 0!==t;return e.useEffect(()=>{if(!u)return;const e=()=>{n.current=0,s(!1)};return document.addEventListener("dragend",e,!0),document.addEventListener("drop",e,!0),()=>{document.removeEventListener("dragend",e,!0),document.removeEventListener("drop",e,!0)}},[u]),u?{over:o,handlers:{onDragEnter:e=>{r(e)&&(e.preventDefault(),n.current+=1,s(!0))},onDragOver:e=>{r(e)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:e=>{r(e)&&(n.current=Math.max(0,n.current-1),0===n.current&&s(!1))},onDrop:e=>{if(!r(e))return;e.preventDefault(),n.current=0,s(!1);const o=droppedFiles(e.dataTransfer);o.length>0&&t(o)}}}:{over:!1,handlers:{}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},i={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l={dockerfile:["bash"],javascript:["xml"],markdown:["xml"],shell:["bash"],typescript:["xml"],xml:["javascript","css"]},s=new Map;export function registerLanguage(t,i){const l=t.toLowerCase();
|
|
1
|
+
const t={bash:()=>import("highlight.js/lib/languages/bash"),c:()=>import("highlight.js/lib/languages/c"),cpp:()=>import("highlight.js/lib/languages/cpp"),csharp:()=>import("highlight.js/lib/languages/csharp"),css:()=>import("highlight.js/lib/languages/css"),diff:()=>import("highlight.js/lib/languages/diff"),dockerfile:()=>import("highlight.js/lib/languages/dockerfile"),go:()=>import("highlight.js/lib/languages/go"),graphql:()=>import("highlight.js/lib/languages/graphql"),ini:()=>import("highlight.js/lib/languages/ini"),java:()=>import("highlight.js/lib/languages/java"),javascript:()=>import("highlight.js/lib/languages/javascript"),json:()=>import("highlight.js/lib/languages/json"),kotlin:()=>import("highlight.js/lib/languages/kotlin"),less:()=>import("highlight.js/lib/languages/less"),lua:()=>import("highlight.js/lib/languages/lua"),makefile:()=>import("highlight.js/lib/languages/makefile"),markdown:()=>import("highlight.js/lib/languages/markdown"),objectivec:()=>import("highlight.js/lib/languages/objectivec"),perl:()=>import("highlight.js/lib/languages/perl"),php:()=>import("highlight.js/lib/languages/php"),plaintext:()=>import("highlight.js/lib/languages/plaintext"),powershell:()=>import("highlight.js/lib/languages/powershell"),python:()=>import("highlight.js/lib/languages/python"),r:()=>import("highlight.js/lib/languages/r"),ruby:()=>import("highlight.js/lib/languages/ruby"),rust:()=>import("highlight.js/lib/languages/rust"),scss:()=>import("highlight.js/lib/languages/scss"),shell:()=>import("highlight.js/lib/languages/shell"),sql:()=>import("highlight.js/lib/languages/sql"),swift:()=>import("highlight.js/lib/languages/swift"),typescript:()=>import("highlight.js/lib/languages/typescript"),xml:()=>import("highlight.js/lib/languages/xml"),yaml:()=>import("highlight.js/lib/languages/yaml")},i={"c++":"cpp",cc:"cpp",cjs:"javascript",console:"bash",cs:"csharp",cts:"typescript",docker:"dockerfile",gql:"graphql",golang:"go",h:"cpp",hpp:"cpp",htm:"xml",html:"xml",js:"javascript",jsx:"javascript",kt:"kotlin",kts:"kotlin",md:"markdown",mdx:"markdown",mjs:"javascript",mm:"objectivec",mts:"typescript",mysql:"sql",node:"javascript",none:"plaintext",objc:"objectivec",plain:"plaintext",posh:"powershell",ps1:"powershell",psql:"sql",py:"python",rb:"ruby",rs:"rust",sh:"bash",svelte:"xml",svg:"xml",text:"plaintext",toml:"ini",ts:"typescript",tsx:"typescript",txt:"plaintext",vue:"xml",yml:"yaml",zsh:"bash"},l={dockerfile:["bash"],javascript:["xml"],markdown:["xml"],shell:["bash"],typescript:["xml"],xml:["javascript","css"]},s=[["css`","css"],["gql`","graphql"]],a=new Map;export function registerLanguage(t,i){const l=t.toLowerCase();a.set(l,i),e.delete(l)}let g=null;const e=new Map;export function canonicalLanguage(t){if(!t)return null;const l=t.trim().toLowerCase();return l?a.has(l)?l:i[l]??l:null}function h(i){let s=e.get(i);return s||(s=async function(i){const s=a.get(i),e=s||!Object.hasOwn(t,i)?void 0:t[i];if(!s&&!e)return null;g??=import("highlight.js/lib/core").then(t=>t.default).catch(t=>{throw g=null,t});const h=await g;s?h.registerLanguage(i,s):h.getLanguage(i)||h.registerLanguage(i,(await e()).default);const n=Object.hasOwn(l,i)?l[i]:[];return await Promise.all(n.map(async i=>{if(h.getLanguage(i))return;const l=a.get(i);h.registerLanguage(i,l??(await t[i]()).default)})),i}(i).catch(t=>{throw e.delete(i),t}),e.set(i,s)),s}export async function highlight(i,l){if(!a.has(l)&&!Object.hasOwn(t,l))return null;const e=await h(l);if(!e||!g)return null;"javascript"!==e&&"typescript"!==e||await Promise.all(s.filter(([t])=>i.includes(t)).map(([,t])=>h(t).catch(()=>null)));return tokenize((await g).highlight(i,{language:e,ignoreIllegals:!0}).value)}const n={"&":"&","<":"<",">":">",""":'"',"'":"'"};export function tokenize(t){const i=[[]],l=[],s=/<span class="([^"]*)">|<\/span>/g;let a=0;const g=t=>{if(!t)return;const s=l[l.length-1];t.replace(/&(?:amp|lt|gt|quot|#x27);/g,t=>n[t]).split("\n").forEach((t,l)=>{l>0&&i.push([]),t&&i[i.length-1].push(s?{text:t,token:s}:{text:t})})};for(const i of t.matchAll(s))g(t.slice(a,i.index)),a=i.index+i[0].length,void 0===i[1]?l.pop():l.push(i[1]);return g(t.slice(a)),i}export function plainLines(t){return t.split("\n").map(t=>t?[{text:t}]:[])}
|
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ export interface ActionMessages {
|
|
|
65
65
|
clear: string;
|
|
66
66
|
/** The × on a Chip. */
|
|
67
67
|
remove: string;
|
|
68
|
+
/**
|
|
69
|
+
* The same ×, on a Chip whose label is a string: a row of chips each named
|
|
70
|
+
* "Remove" gives a screen reader no way to tell them apart. `{label}` is
|
|
71
|
+
* replaced with the label.
|
|
72
|
+
*/
|
|
73
|
+
removeLabel: string;
|
|
68
74
|
}
|
|
69
75
|
/** The `action` namespace, as Alert, Chip, Combobox, Dialog, Drawer, Popover and Toast read it. */
|
|
70
76
|
export declare const actionMessages: MessageTable<ActionMessages>;
|
|
@@ -176,6 +182,19 @@ export interface TableMessages {
|
|
|
176
182
|
* than `empty`'s, which said there was nothing there over rows that were.
|
|
177
183
|
*/
|
|
178
184
|
noGroup: string;
|
|
185
|
+
/**
|
|
186
|
+
* The boundary a keyboard resizes a column by. `{column}` is replaced with
|
|
187
|
+
* the column's label.
|
|
188
|
+
*/
|
|
189
|
+
resizeColumn: string;
|
|
190
|
+
/**
|
|
191
|
+
* What a heading past the first in a multiple sort says about its place in
|
|
192
|
+
* the order, since only the first key can carry `aria-sort`. `{order}` is
|
|
193
|
+
* replaced with the place, already formatted.
|
|
194
|
+
*/
|
|
195
|
+
sortAscending: string;
|
|
196
|
+
/** The same, for a key sorted the other way. */
|
|
197
|
+
sortDescending: string;
|
|
179
198
|
}
|
|
180
199
|
/** The `table` namespace, as Table and DataTable read it. */
|
|
181
200
|
export declare const tableMessages: MessageTable<TableMessages>;
|
|
@@ -191,6 +210,12 @@ export declare const tableMessages: MessageTable<TableMessages>;
|
|
|
191
210
|
export interface ColorMessages {
|
|
192
211
|
/** The saturation/brightness square. */
|
|
193
212
|
area: string;
|
|
213
|
+
/**
|
|
214
|
+
* What the square's position is read as. `{saturation}` and `{brightness}`
|
|
215
|
+
* are replaced with the two percentages, already formatted for the locale —
|
|
216
|
+
* two bare numbers say nothing about which is which.
|
|
217
|
+
*/
|
|
218
|
+
areaValue: string;
|
|
194
219
|
/** The rail beside it. */
|
|
195
220
|
hue: string;
|
|
196
221
|
/** The rail below that, when `alpha` is on. */
|
|
@@ -401,13 +426,19 @@ export interface ChartMessages {
|
|
|
401
426
|
* read on every focus and the hidden table beside the plot holds the rest.
|
|
402
427
|
*/
|
|
403
428
|
summary: string;
|
|
429
|
+
/**
|
|
430
|
+
* The same sentence for the series on a second value axis, which follows the
|
|
431
|
+
* first. Said apart because the two axes are in different units: one range
|
|
432
|
+
* across both, written in the first axis' format, reads "$2 to $246,000".
|
|
433
|
+
*/
|
|
434
|
+
summarySecondary: string;
|
|
404
435
|
/** The button that writes the chart's data out as a file. */
|
|
405
436
|
exportCsv: string;
|
|
406
437
|
}
|
|
407
438
|
/** The `chart` namespace, as every chart reads it. */
|
|
408
439
|
export declare const chartMessages: MessageTable<ChartMessages>;
|
|
409
440
|
/**
|
|
410
|
-
* ScrollZone.
|
|
441
|
+
* ScrollZone, and ScrollArea's `label` fallback.
|
|
411
442
|
*
|
|
412
443
|
* Both buttons are an arrow with nothing else on them, and which way the
|
|
413
444
|
* strip runs is a prop — so the words are logical rather than physical. A
|
|
@@ -428,7 +459,7 @@ export interface ScrollMessages {
|
|
|
428
459
|
previous: string;
|
|
429
460
|
next: string;
|
|
430
461
|
}
|
|
431
|
-
/** The `scroll` namespace, as ScrollZone read it. */
|
|
462
|
+
/** The `scroll` namespace, as ScrollZone and ScrollArea read it. */
|
|
432
463
|
export declare const scrollMessages: MessageTable<ScrollMessages>;
|
|
433
464
|
/** Panes. */
|
|
434
465
|
export interface PanesMessages {
|
|
@@ -479,6 +510,11 @@ export interface TransferMessages {
|
|
|
479
510
|
selectAll: string;
|
|
480
511
|
/** The line where the rows would be, when a list has none. */
|
|
481
512
|
empty: string;
|
|
513
|
+
/**
|
|
514
|
+
* What a screen reader is told after a move. `{count}` is replaced with how
|
|
515
|
+
* many rows moved and `{list}` with the heading of the list they went to.
|
|
516
|
+
*/
|
|
517
|
+
moved: string;
|
|
482
518
|
}
|
|
483
519
|
/** The `transfer` namespace, as Transfer read it. */
|
|
484
520
|
export declare const transferMessages: MessageTable<TransferMessages>;
|
|
@@ -896,10 +932,10 @@ export interface NebaLocale {
|
|
|
896
932
|
* registerMessages('ko', ko);
|
|
897
933
|
* ```
|
|
898
934
|
*
|
|
899
|
-
* Shipping the
|
|
935
|
+
* Shipping the others unconditionally would put them in the bundle of
|
|
900
936
|
* every product that speaks one language, because a bundler cannot drop a key
|
|
901
937
|
* out of an object literal — which is the same reason the namespaces above are
|
|
902
|
-
*
|
|
938
|
+
* separate exports rather than one table. Registering is what makes the cost
|
|
903
939
|
* follow the need.
|
|
904
940
|
*
|
|
905
941
|
* The tag is matched the way a `locale` prop is: by script, then by region,
|
package/dist/internal/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{memoise as s}from"./cache.js";export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove"}};export const confirmMessages={"":{confirm:"Confirm",cancel:"Cancel"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data",exportCsv:"Export CSV",noGroup:"No group"}};export const colorMessages={"":{area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide",pause:"Pause slide show",play:"Play slide show"}};export const pickerMessages={"":{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"}};export const galleryMessages={"":{label:"Gallery",item:"Image {index} of {total}",previous:"Previous image",next:"Next image"}};export const imageMessages={"":{unavailable:"Image unavailable",preview:"Enlarge image"}};export const chartMessages={"":{label:"Chart",size:"Size",title:"Label",start:"Start",end:"End",summary:"Data points: {count}. Range: {min} to {max}.",exportCsv:"Export CSV"}};export const scrollMessages={"":{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};export const panesMessages={"":{handle:"Resize panes"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const commandMessages={"":{label:"Command palette",search:"Type a command or search…",empty:"No commands found"}};export const transferMessages={"":{source:"Available",target:"Selected",toTarget:"Move to selected",toSource:"Move to available",search:"Search",selectAll:"Select all",empty:"Nothing here"}};export const anchorMessages={"":{label:"On this page"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}",add:"Add “{label}”",open:"Open"}};export const toastMessages={"":{label:"Notifications"}};export const timelineMessages={"":{complete:"Completed",upcoming:"Upcoming"}};export const fileMessages={"":{title:"Drop files here, or click to browse",remove:"Remove {name}"}};export const otpMessages={"":{slot:"Character {index} of {total}"}};export const overlayMessages={"":{label:"Loading"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window",resizeHint:"Use the arrow keys to resize the window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",skip:"Skip",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};export const runMessages={"":{pending:"Waiting",running:"Running",success:"Finished",error:"Failed"}};export const toolMessages={"":{arguments:"Arguments",result:"Result"}};export const approvalMessages={"":{request:"Permission needed",answered:"Answered",low:"Low risk",medium:"Medium risk",high:"High risk"}};export const reasoningMessages={"":{thinking:"Thinking…",thought:"Thought for {duration}",done:"Finished thinking"}};export const contextMessages={"":{label:"Context",input:"Input",output:"Output",reasoning:"Reasoning",cached:"Cached",cost:"Estimated cost",usage:"{used} of {max}"}};export const sourcesMessages={"":{title:"Sources",citation:"Source {index}"}};export const promptMessages={"":{send:"Send",stop:"Stop",drop:"Drop files to attach"}};const o={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const t=new WeakMap;export function resolveMessages(e,a){const r=e[""],n=a?.trim()??"";if(!n)return r;let i=t.get(e);return i||(i=new Map,t.set(e,i)),s(i,n,()=>{const s=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),o=s[0];if(!o)return[];const t=s.slice(1),a=t.find(e=>/^[a-z]{4}$/.test(e)),r=t.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${o}-${a}`:"",r?`${o}-${r}`:"",o].filter(Boolean)}(n).map(s=>{const t=Object.hasOwn(o,s)?o[s]:void 0;return Object.hasOwn(e,s)?e[s]:t&&Object.hasOwn(e,t)?e[t]:void 0}).find(Boolean);return s?{...r,...s}:r})}export function useMessages(s,o){return e.useMemo(()=>resolveMessages(s,o),[s,o])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>Object.hasOwn(s,o)?s[o]:e)}const a={action:actionMessages,confirm:confirmMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,picker:pickerMessages,gallery:galleryMessages,image:imageMessages,chart:chartMessages,scroll:scrollMessages,panes:panesMessages,breadcrumb:breadcrumbMessages,anchor:anchorMessages,transfer:transferMessages,command:commandMessages,combobox:comboboxMessages,toast:toastMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages,otp:otpMessages,file:fileMessages,timeline:timelineMessages,run:runMessages,tool:toolMessages,approval:approvalMessages,reasoning:reasoningMessages,context:contextMessages,sources:sourcesMessages,prompt:promptMessages};export function registerMessages(e,s){const o=e.trim().toLowerCase();if("__proto__"!==o)for(const[e,r]of Object.entries(s)){const s=Object.hasOwn(a,e)?a[e]:void 0;s&&r&&(s[o]=r,t.delete(s))}}
|
|
1
|
+
import*as e from"react";import{memoise as s}from"./cache.js";export const actionMessages={"":{close:"Close",dismiss:"Dismiss",clear:"Clear",remove:"Remove",removeLabel:"Remove {label}"}};export const confirmMessages={"":{confirm:"Confirm",cancel:"Cancel"}};export const linkMessages={"":{newTab:"(opens in a new tab)"}};export const spoilerMessages={"":{reveal:"Reveal",hide:"Hide",notice:"This may contain spoilers"}};export const chatMessages={"":{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing…"}};export const emptyMessages={"":{title:"Nothing here"}};export const tableMessages={"":{search:"Search",selectAll:"Select all rows",selectRow:"Select row",rowsPerPage:"Rows per page",range:"{start}–{end} of {total}",selected:"{count} selected",empty:"No data",exportCsv:"Export CSV",noGroup:"No group",resizeColumn:"Resize {column}",sortAscending:"sort {order}, ascending",sortDescending:"sort {order}, descending"}};export const colorMessages={"":{area:"Saturation and brightness",areaValue:"Saturation {saturation}, brightness {brightness}",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Preset colours",clear:"Clear",empty:"Choose a colour"}};export const ratingMessages={"":{label:"Rating",value:"{value} out of {max}",empty:"No rating"}};export const numberMessages={"":{increase:"Increase",decrease:"Decrease"}};export const paginationMessages={"":{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};export const carouselMessages={"":{label:"Carousel",slide:"Slide {index} of {total}",previous:"Previous slide",next:"Next slide",pause:"Pause slide show",play:"Play slide show"}};export const pickerMessages={"":{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",thisMonth:"This month",thisYear:"This year",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"}};export const galleryMessages={"":{label:"Gallery",item:"Image {index} of {total}",previous:"Previous image",next:"Next image"}};export const imageMessages={"":{unavailable:"Image unavailable",preview:"Enlarge image"}};export const chartMessages={"":{label:"Chart",size:"Size",title:"Label",start:"Start",end:"End",summary:"Data points: {count}. Range: {min} to {max}.",summarySecondary:"On the second axis, data points: {count}. Range: {min} to {max}.",exportCsv:"Export CSV"}};export const scrollMessages={"":{label:"Scrollable content",previous:"Scroll back",next:"Scroll forward"}};export const panesMessages={"":{handle:"Resize panes"}};export const breadcrumbMessages={"":{label:"Breadcrumb",expand:"Show hidden steps"}};export const commandMessages={"":{label:"Command palette",search:"Type a command or search…",empty:"No commands found"}};export const transferMessages={"":{source:"Available",target:"Selected",toTarget:"Move to selected",toSource:"Move to available",search:"Search",selectAll:"Select all",empty:"Nothing here",moved:"{count} moved to {list}"}};export const anchorMessages={"":{label:"On this page"}};export const comboboxMessages={"":{empty:"No matches",remove:"Remove {label}",add:"Add “{label}”",open:"Open"}};export const toastMessages={"":{label:"Notifications"}};export const timelineMessages={"":{complete:"Completed",upcoming:"Upcoming"}};export const fileMessages={"":{title:"Drop files here, or click to browse",remove:"Remove {name}"}};export const otpMessages={"":{slot:"Character {index} of {total}"}};export const overlayMessages={"":{label:"Loading"}};export const windowMessages={"":{minimize:"Minimize",maximize:"Maximize",restore:"Restore",resize:"Resize window",resizeHint:"Use the arrow keys to resize the window"}};export const layoutMessages={"":{skipToContent:"Skip to content",sidebar:"Sidebar",openSidebar:"Open sidebar",closeSidebar:"Close sidebar",resizeSidebar:"Resize sidebar"}};export const codeMessages={"":{code:"Code",copy:"Copy",copied:"Copied",copyFailed:"Could not copy",raw:"Raw",prompt:"Prompt"}};export const stepsMessages={"":{previous:"Previous",next:"Next",done:"Done",skip:"Skip",restart:"Start over",completed:"All steps complete",steps:"Steps",position:"{index} of {total}",step:"Step {index}: {title}"}};export const runMessages={"":{pending:"Waiting",running:"Running",success:"Finished",error:"Failed"}};export const toolMessages={"":{arguments:"Arguments",result:"Result"}};export const approvalMessages={"":{request:"Permission needed",answered:"Answered",low:"Low risk",medium:"Medium risk",high:"High risk"}};export const reasoningMessages={"":{thinking:"Thinking…",thought:"Thought for {duration}",done:"Finished thinking"}};export const contextMessages={"":{label:"Context",input:"Input",output:"Output",reasoning:"Reasoning",cached:"Cached",cost:"Estimated cost",usage:"{used} of {max}"}};export const sourcesMessages={"":{title:"Sources",citation:"Source {index}"}};export const promptMessages={"":{send:"Send",stop:"Stop",drop:"Drop files to attach"}};const o={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const t=new WeakMap;export function resolveMessages(e,a){const r=e[""],n=a?.trim()??"";if(!n)return r;let i=t.get(e);return i||(i=new Map,t.set(e,i)),s(i,n,()=>{const s=function(e){const s=e.toLowerCase().split(/[-_]/).filter(Boolean),o=s[0];if(!o)return[];const t=s.slice(1),a=t.find(e=>/^[a-z]{4}$/.test(e)),r=t.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[a?`${o}-${a}`:"",r?`${o}-${r}`:"",o].filter(Boolean)}(n).map(s=>{const t=Object.hasOwn(o,s)?o[s]:void 0;return Object.hasOwn(e,s)?e[s]:t&&Object.hasOwn(e,t)?e[t]:void 0}).find(Boolean);return s?{...r,...s}:r})}export function useMessages(s,o){return e.useMemo(()=>resolveMessages(s,o),[s,o])}export function fillMessage(e,s){return e.replace(/\{(\w+)\}/g,(e,o)=>Object.hasOwn(s,o)?s[o]:e)}const a={action:actionMessages,confirm:confirmMessages,link:linkMessages,spoiler:spoilerMessages,chat:chatMessages,empty:emptyMessages,table:tableMessages,color:colorMessages,rating:ratingMessages,number:numberMessages,pagination:paginationMessages,carousel:carouselMessages,picker:pickerMessages,gallery:galleryMessages,image:imageMessages,chart:chartMessages,scroll:scrollMessages,panes:panesMessages,breadcrumb:breadcrumbMessages,anchor:anchorMessages,transfer:transferMessages,command:commandMessages,combobox:comboboxMessages,toast:toastMessages,overlay:overlayMessages,window:windowMessages,layout:layoutMessages,code:codeMessages,steps:stepsMessages,otp:otpMessages,file:fileMessages,timeline:timelineMessages,run:runMessages,tool:toolMessages,approval:approvalMessages,reasoning:reasoningMessages,context:contextMessages,sources:sourcesMessages,prompt:promptMessages};export function registerMessages(e,s){const o=e.trim().toLowerCase();if("__proto__"!==o)for(const[e,r]of Object.entries(s)){const s=Object.hasOwn(a,e)?a[e]:void 0;s&&r&&(s[o]=r,t.delete(s))}}
|
package/dist/internal/icons.d.ts
CHANGED
|
@@ -135,6 +135,9 @@ export declare function StarOutlineIcon(): React.JSX.Element;
|
|
|
135
135
|
* The arc is a quarter of the circle behind it, and both are stroked at 2 rather
|
|
136
136
|
* than the 1.5 every other glyph here uses: a ring that turns is read as a
|
|
137
137
|
* shape rather than as a line, and at 1.5 it reads as a smudge.
|
|
138
|
+
*
|
|
139
|
+
* It turns on `.neba-ring-spin`, the rate an indeterminate ProgressCircular
|
|
140
|
+
* turns at, which a reduced-motion preference slows rather than stops.
|
|
138
141
|
*/
|
|
139
142
|
export declare function SpinnerIcon(): React.JSX.Element;
|
|
140
143
|
/** The filled dot: the chosen one of a set, where a tick would say "and". */
|
package/dist/internal/icons.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as e}from"react/jsx-runtime";export function CloseIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m4.5 4.5 7 7m0-7-7 7",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function ChevronIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m4.5 6.5 3.5 3.5 3.5-3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function CheckIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m3.5 8.5 3 3 6-6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}export function MinusIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function PlusIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function TrendUpIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M3 11 6.5 7.5 9 10l4-4",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M9.5 6h3.5v3.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function TrendDownIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M3 5 6.5 8.5 9 6l4 4",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M9.5 10h3.5V6.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function CalendarIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("rect",{x:"2",y:"3.25",width:"12",height:"10.75",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M2 6.75h12",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M5.25 1.75v2.5M10.75 1.75v2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function ClockIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M8 4.5V8l2.4 1.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function ArrowRightIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M3 8h10m-3.5-3.5L13 8l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function LinkIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M6.5 9.5a2.75 2.75 0 0 0 4 .25l1.75-1.75a2.75 2.75 0 0 0-3.9-3.9L7.75 5.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M9.5 6.5a2.75 2.75 0 0 0-4-.25L3.75 8a2.75 2.75 0 0 0 3.9 3.9l.6-.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function ExternalLinkIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M12.75 9.25v2.5a1.5 1.5 0 0 1-1.5 1.5h-7a1.5 1.5 0 0 1-1.5-1.5v-7a1.5 1.5 0 0 1 1.5-1.5h2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M9.5 2.75h3.75V6.5M7.25 8.75l5.75-5.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function CopyIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("rect",{x:"5.75",y:"5.75",width:"7.5",height:"7.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M10.25 3.6a1.85 1.85 0 0 0-1.5-.85h-4a2 2 0 0 0-2 2v4c0 .62.28 1.17.72 1.54",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function CodeIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M5.75 4.5 2.5 8l3.25 3.5m4.5-7L13.5 8l-3.25 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function RestartIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M13 8a5 5 0 1 1-1.6-3.67",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M13.25 2.25v3h-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function PauseIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[r("rect",{x:"4",y:"3",width:"2.75",height:"10",rx:"1"}),r("rect",{x:"9.25",y:"3",width:"2.75",height:"10",rx:"1"})]})}export function PlayIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:r("path",{d:"M5.5 3.6a1 1 0 0 1 1.53-.85l6.1 3.9a1.2 1.2 0 0 1 0 2.02l-6.1 3.9a1 1 0 0 1-1.53-.85V3.6Z"})})}export function EllipsisIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"3.5",cy:"8",r:"1.15",fill:"currentColor"}),r("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"}),r("circle",{cx:"12.5",cy:"8",r:"1.15",fill:"currentColor"})]})}const o="M8 1.4 9.71 5.65 14.28 5.96 10.76 8.9 11.88 13.34 8 10.9 4.12 13.34 5.24 8.9 1.72 5.96 6.29 5.65Z";export function StarIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:o,fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round"})})}export function StarOutlineIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:o,stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}export function SpinnerIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"
|
|
1
|
+
import{jsx as r,jsxs as e}from"react/jsx-runtime";export function CloseIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m4.5 4.5 7 7m0-7-7 7",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function ChevronIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m4.5 6.5 3.5 3.5 3.5-3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function CheckIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"m3.5 8.5 3 3 6-6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}export function MinusIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function PlusIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}export function TrendUpIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M3 11 6.5 7.5 9 10l4-4",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M9.5 6h3.5v3.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function TrendDownIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M3 5 6.5 8.5 9 6l4 4",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),r("path",{d:"M9.5 10h3.5V6.5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function CalendarIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("rect",{x:"2",y:"3.25",width:"12",height:"10.75",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M2 6.75h12",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M5.25 1.75v2.5M10.75 1.75v2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function ClockIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M8 4.5V8l2.4 1.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function ArrowRightIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M3 8h10m-3.5-3.5L13 8l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function LinkIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M6.5 9.5a2.75 2.75 0 0 0 4 .25l1.75-1.75a2.75 2.75 0 0 0-3.9-3.9L7.75 5.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M9.5 6.5a2.75 2.75 0 0 0-4-.25L3.75 8a2.75 2.75 0 0 0 3.9 3.9l.6-.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function ExternalLinkIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M12.75 9.25v2.5a1.5 1.5 0 0 1-1.5 1.5h-7a1.5 1.5 0 0 1-1.5-1.5v-7a1.5 1.5 0 0 1 1.5-1.5h2.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M9.5 2.75h3.75V6.5M7.25 8.75l5.75-5.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function CopyIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("rect",{x:"5.75",y:"5.75",width:"7.5",height:"7.5",rx:"1.75",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M10.25 3.6a1.85 1.85 0 0 0-1.5-.85h-4a2 2 0 0 0-2 2v4c0 .62.28 1.17.72 1.54",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function CodeIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:"M5.75 4.5 2.5 8l3.25 3.5m4.5-7L13.5 8l-3.25 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}export function RestartIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M13 8a5 5 0 1 1-1.6-3.67",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("path",{d:"M13.25 2.25v3h-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function PauseIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[r("rect",{x:"4",y:"3",width:"2.75",height:"10",rx:"1"}),r("rect",{x:"9.25",y:"3",width:"2.75",height:"10",rx:"1"})]})}export function PlayIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:r("path",{d:"M5.5 3.6a1 1 0 0 1 1.53-.85l6.1 3.9a1.2 1.2 0 0 1 0 2.02l-6.1 3.9a1 1 0 0 1-1.53-.85V3.6Z"})})}export function EllipsisIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"3.5",cy:"8",r:"1.15",fill:"currentColor"}),r("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"}),r("circle",{cx:"12.5",cy:"8",r:"1.15",fill:"currentColor"})]})}const o="M8 1.4 9.71 5.65 14.28 5.96 10.76 8.9 11.88 13.34 8 10.9 4.12 13.34 5.24 8.9 1.72 5.96 6.29 5.65Z";export function StarIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:o,fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round"})})}export function StarOutlineIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("path",{d:o,stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}export function SpinnerIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"neba-ring-spin",children:[r("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),r("path",{d:"M14.5 8A6.5 6.5 0 0 0 8 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}export function DotIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("circle",{cx:"8",cy:"8",r:"3.25",fill:"currentColor"})})}export function CircleIcon(){return r("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"2 2.5",strokeLinecap:"round"})})}export function NoteIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"M8 7.25v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("circle",{cx:"8",cy:"4.9",r:"0.85",fill:"currentColor"})]})}export function SuccessIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"m5.25 8.25 1.9 1.9 3.6-3.9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}export function WarningIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("path",{d:"M7.13 2.6 1.9 11.7a1 1 0 0 0 .87 1.5h10.46a1 1 0 0 0 .87-1.5L8.87 2.6a1 1 0 0 0-1.74 0Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),r("path",{d:"M8 6.1v3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),r("circle",{cx:"8",cy:"11.2",r:"0.85",fill:"currentColor"})]})}export function DangerIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r("circle",{cx:"8",cy:"8",r:"6.25",stroke:"currentColor",strokeWidth:"1.5"}),r("path",{d:"m5.9 5.9 4.2 4.2m0-4.2-4.2 4.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}export function severityIcon(e){switch(e){case"success":return r(SuccessIcon,{});case"warning":return r(WarningIcon,{});case"danger":return r(DangerIcon,{});default:return r(NoteIcon,{})}}
|
package/dist/internal/link.d.ts
CHANGED
|
@@ -15,4 +15,31 @@
|
|
|
15
15
|
* ` java\tscript:` is caught along with `JavaScript:`.
|
|
16
16
|
*/
|
|
17
17
|
export declare function safeHref(href: string | undefined): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Whether a `target` opens a browsing context other than this tab.
|
|
20
|
+
*
|
|
21
|
+
* `_self` is this tab, and `_parent` and `_top` are frames of the same
|
|
22
|
+
* document; none of the three opens anything that could reach back, and none
|
|
23
|
+
* changes the window under the reader. An empty `target` is `_self`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function opensElsewhere(target: string | undefined): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The `rel` a link gets when it opens somewhere other than this tab.
|
|
28
|
+
*
|
|
29
|
+
* A `target` other than the current tab hands the new page a `window.opener`
|
|
30
|
+
* pointing back at this one, and a `Referer` header naming it. Modern browsers
|
|
31
|
+
* imply `noopener` for `target="_blank"`; none of them implies `noreferrer`,
|
|
32
|
+
* and neither is implied for a named target. So the two tokens are added
|
|
33
|
+
* wherever a component lets a caller choose where a link opens — TextLink, a
|
|
34
|
+
* Menu row, a NavigationMenu link, a ChatBubble's link, an AppLogo, a
|
|
35
|
+
* BottomNavigation destination, a Breadcrumb item, a Sources row and an
|
|
36
|
+
* InlineCitation — and they are added the same way in all of them, because a
|
|
37
|
+
* library where only some are safe is a library whose users cannot tell which.
|
|
38
|
+
*
|
|
39
|
+
* It is a *merge* and not an override, and that is the whole reason this is a
|
|
40
|
+
* function rather than a string. The common reason to write a `rel` by hand is
|
|
41
|
+
* `nofollow` or `sponsored`, which is an SEO decision and has nothing to do
|
|
42
|
+
* with the two tokens above — spelled as a plain default it would silently take
|
|
43
|
+
* the protection off the link that still opens in a new tab.
|
|
44
|
+
*/
|
|
18
45
|
export declare function safeRel(target: string | undefined, rel: string | undefined): string | undefined;
|
package/dist/internal/link.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=new Set(["http","https","mailto","tel"]);export function safeHref(t){if(void 0===t)return;let
|
|
1
|
+
const e=new Set(["http","https","mailto","tel"]);export function safeHref(t){if(void 0===t)return;let n=0;for(;n<t.length&&t.charCodeAt(n)<=32;)n+=1;const o=t.slice(n).replace(/[\t\n\r]/g,""),r=/^([a-z][a-z\d+.-]*):/i.exec(o);return null===r||e.has(r[1].toLowerCase())?t:void 0}export function opensElsewhere(e){return Boolean(e)&&"_self"!==e&&"_parent"!==e&&"_top"!==e}export function safeRel(e,t){return opensElsewhere(e)?[...new Set([...(t??"").split(/\s+/).filter(Boolean),"noopener","noreferrer"])].join(" "):t}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The words a link that opens somewhere other than this tab ends with, drawn
|
|
4
|
+
* for nobody and read to everybody.
|
|
5
|
+
*
|
|
6
|
+
* A window changing under the reader is the one thing about a link that is
|
|
7
|
+
* invisible until it has already happened, and TextLink was the only link in
|
|
8
|
+
* the library that said so. Every other component that lets a `target` reach an
|
|
9
|
+
* `<a>` puts this last inside it. The space is a real text node, so the name
|
|
10
|
+
* comes out as the label and then the sentence rather than as one word.
|
|
11
|
+
*
|
|
12
|
+
* The language is the component's own `locale` where it has one, and the
|
|
13
|
+
* provider's where it has not — a Menu row or a NavigationMenu link takes no
|
|
14
|
+
* `locale` of its own.
|
|
15
|
+
*/
|
|
16
|
+
export declare function NewTabNote({ target, locale }: {
|
|
17
|
+
target: string | undefined;
|
|
18
|
+
locale?: string;
|
|
19
|
+
}): React.JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as r,Fragment as t,jsxs as e}from"react/jsx-runtime";import*as s from"react";import{DefaultsContext as o}from"./defaults.js";import{linkMessages as a,useMessages as m}from"./i18n.js";import{opensElsewhere as n}from"./link.js";import{srOnlyClasses as i}from"./styles.js";export function NewTabNote({target:l,locale:c}){const f=s.useContext(o),p=m(a,c??f?.locale);return n(l)?e(t,{children:[" ",r("span",{className:i,children:p.newTab})]}):null}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { NebaDensity, NebaSize, NebaVariant } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The room a field's end adornments take from a resting `float` label, for
|
|
5
|
+
* `restEnd`: each one's width in `em` of the control's text, and the shell's
|
|
6
|
+
* gap in front of it.
|
|
7
|
+
*
|
|
8
|
+
* In `em` because that is what the adornments are sized in — an icon is
|
|
9
|
+
* `1.2em`, a stepper `1.7em` — and the notch that reads the length is set in
|
|
10
|
+
* the control's text, so the two agree at every size without a table per
|
|
11
|
+
* component. Nothing at the end is no length at all.
|
|
12
|
+
*/
|
|
13
|
+
export declare function restEndOf(size: NebaSize, widths: readonly number[]): string | undefined;
|
|
14
|
+
interface NotchGeometry {
|
|
15
|
+
size: NebaSize;
|
|
16
|
+
density: NebaDensity;
|
|
17
|
+
variant: NebaVariant;
|
|
18
|
+
/**
|
|
19
|
+
* What is drawn at the end of the shell, from `restEndOf`. A resting label
|
|
20
|
+
* stops short of it rather than running under a chevron or the steppers.
|
|
21
|
+
*/
|
|
22
|
+
restEnd?: string;
|
|
23
|
+
/**
|
|
24
|
+
* How far the first line of text sits below the shell's inner edge, for a
|
|
25
|
+
* shell whose text starts at the top rather than in the middle — a textarea.
|
|
26
|
+
*/
|
|
27
|
+
firstLine?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface NotchFrameProps extends NotchGeometry {
|
|
30
|
+
label: React.ReactNode;
|
|
31
|
+
/** `classNames.label`, for anything in it that changes the label's width. */
|
|
32
|
+
labelClassName?: string;
|
|
33
|
+
/** For a frame the notch sits in, which then answers the hover and focus. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The label can rest inside the field, where it is set larger than on the
|
|
37
|
+
* edge. The frame then lays it out at that size too, so a field as wide as
|
|
38
|
+
* its label does not cut the label short the moment it comes down.
|
|
39
|
+
*/
|
|
40
|
+
rests?: boolean;
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The shell and the width of its label, in one cell.
|
|
45
|
+
*
|
|
46
|
+
* A label above a field is in the column the field stretches to, so a Select
|
|
47
|
+
* whose options are all one short word is still as wide as its name. On the
|
|
48
|
+
* edge the label is absolutely positioned and widens nothing, and the same
|
|
49
|
+
* Select cut its own name short. The sizer is that name again at the size it
|
|
50
|
+
* is drawn on the edge, with the corners and the gap on each side of it, laid
|
|
51
|
+
* out at no height in the same grid cell as the shell — so the cell, and the
|
|
52
|
+
* shell stretched across it, are never narrower than the notch needs.
|
|
53
|
+
*
|
|
54
|
+
* A string is drawn as generated content off `data-sample`, for
|
|
55
|
+
* `WidthSizer`'s reason: it reserves the same width and leaves nothing for a
|
|
56
|
+
* `getByText` to find twice. Only a label that is not a string is rendered a
|
|
57
|
+
* second time.
|
|
58
|
+
*
|
|
59
|
+
* It also carries the geometry every piece inside it reads, once.
|
|
60
|
+
*/
|
|
61
|
+
export declare function NotchFrame({ label, labelClassName, className, rests, children, ...geometry }: NotchFrameProps): React.JSX.Element;
|
|
62
|
+
export interface FieldNotchProps {
|
|
63
|
+
label: React.ReactNode;
|
|
64
|
+
variant: NebaVariant;
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
readOnly: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The label comes down into the field while it is empty and idle. Only for
|
|
69
|
+
* `float`, and only when nothing is drawn where it would rest.
|
|
70
|
+
*/
|
|
71
|
+
rests: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The field is empty, for a component that knows it and has no control that
|
|
74
|
+
* can say so itself — a multiple Combobox, whose chips are not an input.
|
|
75
|
+
* Everything else leaves this out: an input says it through
|
|
76
|
+
* `:placeholder-shown` and a trigger through `data-placeholder`, both of
|
|
77
|
+
* which are right before any script has run.
|
|
78
|
+
*/
|
|
79
|
+
empty?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The notch sits beside the shell, in the frame, rather than inside it —
|
|
82
|
+
* a Select's, whose shell is a `<button>`. It then starts at the frame's
|
|
83
|
+
* edge instead of over the shell's border.
|
|
84
|
+
*/
|
|
85
|
+
beside?: boolean;
|
|
86
|
+
/** `classNames.label`. */
|
|
87
|
+
labelClassName?: string;
|
|
88
|
+
labelId?: string;
|
|
89
|
+
htmlFor?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The edge and the label, inside a `NotchFrame`, as the last child of whatever
|
|
93
|
+
* holds the control.
|
|
94
|
+
*
|
|
95
|
+
* It has to come after the control: a resting label reads the control's
|
|
96
|
+
* emptiness through `~`, which only looks forward. And it has to be a child of
|
|
97
|
+
* the element whose hover and focus the edge answers to, which is the shell
|
|
98
|
+
* for every field but a Select — whose shell is a `<button>`, and a `<label>`
|
|
99
|
+
* cannot go inside one.
|
|
100
|
+
*/
|
|
101
|
+
export declare function FieldNotch({ label, variant, disabled, readOnly, rests, empty, beside, labelClassName, labelId, htmlFor }: FieldNotchProps): React.JSX.Element;
|
|
102
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Field as n}from"@base-ui/react/field";import{cx as r,metaTextValues as s,paddingXValues as t,readOnlyFilterClasses as l}from"./styles.js";const i={xs:"0.1875rem",sm:"0.1875rem",md:"0.25rem",lg:"0.25rem",xl:"0.3125rem"},m={xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1rem",xl:"1.125rem"},d={xs:{size:"0.6875rem",leading:"0.875rem"},sm:{size:"0.75rem",leading:"1rem"},md:{size:"0.8125rem",leading:"1.25rem"},lg:{size:"0.9375rem",leading:"1.375rem"},xl:{size:"1.0625rem",leading:"1.625rem"}},o={xs:"0.25rem",sm:"0.375rem",md:"0.375rem",lg:"0.5rem",xl:"0.625rem"};export function restEndOf(e,a){if(0===a.length)return;return`calc(${a.reduce((e,a)=>e+a,0)}em + ${a.length} * ${o[e]})`}function c({size:e,density:a,variant:n,firstLine:r,restEnd:l}){const o="outline"===n?"1px":"0px",c=`var(--neba-radius-${e})`,b=i[e],h=d[e];return{"--n-notch-r":c,"--n-notch-gap":b,"--n-float-size":s[e],"--n-float-leading":m[e],"--n-rest-size":h.size,"--n-rest-leading":h.leading,"--n-rest-top":void 0===r?`calc(50% - ${h.leading} / 2)`:`calc(${o} + ${r})`,"--n-rest-x":`calc(${o} + ${t[a][e]} - ${c} - ${b})`,...void 0===l?void 0:{"--n-rest-end":l}}}export function NotchFrame({label:n,labelClassName:s,className:t,rests:l=!1,children:i,...m}){const d=a=>e("span","string"==typeof n?{"aria-hidden":"true","data-sample":n,className:r("neba-notch-sizer font-medium",a,s)}:{"aria-hidden":"true",className:r("neba-notch-sizer font-medium",a,s),children:n});return a("span",{className:r("neba-notch-frame",t),style:c(m),children:[i,d(""),l?d("neba-notch-sizer-rest"):null]})}export function FieldNotch({label:s,variant:t,disabled:i,readOnly:m,rests:d,empty:o,beside:c=!1,labelClassName:b,labelId:h,htmlFor:p}){return a("span",{className:r("neba-notch",d&&"neba-notch-float",c&&m&&!i&&l),"data-variant":t,"data-state":i?"disabled":m?"read-only":void 0,"data-empty":o||void 0,style:c||"outline"!==t?void 0:{"--n-notch-inset":"-1px"},children:[e("span",{className:"neba-notch-start"}),e("span",{className:"neba-notch-gap"}),e("span",{className:"neba-notch-end"}),e(n.Label,{...void 0===h?void 0:{id:h},...void 0===p?void 0:{htmlFor:p},className:r("neba-notch-label font-medium",i?"text-(--neba-disabled-fg)":"text-[var(--n-label-ink,var(--neba-fg))]",b),children:s})]})}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* The two browser observers the library uses, as one each rather than one per
|
|
3
3
|
* component.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `IntersectionObserver`. Neither is free — each is a separate registration the
|
|
5
|
+
* Every component that measures itself was building a `ResizeObserver` of its
|
|
6
|
+
* own, and every `Animate*` wrapper that waits for its element to scroll into
|
|
7
|
+
* view was building an `IntersectionObserver`. Neither is free — each is a separate registration the
|
|
9
8
|
* browser has to walk on every layout, and each delivers its own callback task
|
|
10
9
|
* — and a dashboard of eight charts inside a PageLayout with a Panes and a
|
|
11
10
|
* ScrollZone in it is a page with a dozen of them for no reason at all.
|