franchising 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +61 -0
- package/README.md +96 -2
- package/dist/accounts-B4bnTXUd.js +242 -0
- package/dist/accounts-B4bnTXUd.js.map +1 -0
- package/dist/accounts-TyMPSHM0.cjs +313 -0
- package/dist/accounts-TyMPSHM0.cjs.map +1 -0
- package/dist/adapters-DM59AJfR.d.cts +216 -0
- package/dist/adapters-DM59AJfR.d.ts +216 -0
- package/dist/cli/template-assets/api/src/errors/codes.ts +17 -0
- package/dist/cli/template-assets/api/src/errors/index.ts +16 -0
- package/dist/cli/template-assets/api/src/filters/exception.ts +53 -0
- package/dist/cli/template-assets/api/src/main.ts +189 -0
- package/dist/cli/template-assets/api/src/modules/health/controller.ts +23 -0
- package/dist/cli/template-assets/api/src/modules/health/dto/response.dto.ts +23 -0
- package/dist/cli/template-assets/api/src/modules/health/module.ts +12 -0
- package/dist/cli/template-assets/api/src/modules/health/service.ts +54 -0
- package/dist/cli/template-assets/api/src/modules/messaging/module.ts +7 -0
- package/dist/cli/template-assets/api/src/modules/messaging/service.ts +74 -0
- package/dist/cli/template-assets/api/src/shared/exceptions.ts +40 -0
- package/dist/cli/template-assets/api/src/shared/response.ts +31 -0
- package/dist/cli/template-assets/api/src/telemetry.ts +59 -0
- package/dist/cli/template-assets/api/src/types.ts +8 -0
- package/dist/cli/template-assets/cloudflare/cache.service.ts +23 -0
- package/dist/cli/template-assets/cloudflare/queue.service.ts +22 -0
- package/dist/cli/template-assets/cloudflare/worker.ts +33 -0
- package/dist/cli/template-assets/packages/jobs/src/index.ts +49 -0
- package/dist/cli/template-assets/packages/queue-runtime/src/index.ts +54 -0
- package/dist/cli/template-assets/root/dot-dockerignore +11 -0
- package/dist/cli/template-assets/root/dot-editorconfig +13 -0
- package/dist/cli/template-assets/root/dot-oxfmtrc.json +9 -0
- package/dist/cli/template-assets/root/dot-oxlintrc.json +47 -0
- package/dist/cli/template-assets/root/lefthook.yml +18 -0
- package/dist/cli/template-assets/web/postcss.config.mjs +9 -0
- package/dist/cli/template-assets/web/src/app/(app)/dashboard/page.tsx +5 -0
- package/dist/cli/template-assets/web/src/app/(app)/layout.tsx +25 -0
- package/dist/cli/template-assets/web/src/app/(auth)/login/page.tsx +75 -0
- package/dist/cli/template-assets/web/src/app/globals.css +48 -0
- package/dist/cli/template-assets/web/src/app/layout.tsx +30 -0
- package/dist/cli/template-assets/web/src/app/page.tsx +20 -0
- package/dist/cli/template-assets/web/src/components/overview/overview-panel.tsx +27 -0
- package/dist/cli/template-assets/web/src/components/shell/app-shell.tsx +37 -0
- package/dist/cli/template-assets/web/src/components/shell/providers.tsx +22 -0
- package/dist/cli/template-assets/web/src/lib/api-client.ts +57 -0
- package/dist/cli/template-assets/web/src/lib/auth-client.ts +15 -0
- package/dist/cli/template-assets/web/src/lib/server-auth.ts +38 -0
- package/dist/cli/template-assets/web/src/types/api.ts +18 -0
- package/dist/cli/template-assets/worker/src/app.module.ts +5 -0
- package/dist/cli/template-assets/worker/src/env.ts +8 -0
- package/dist/cli/template-assets/worker/src/main.ts +25 -0
- package/dist/cli/template-assets/worker/src/modules/queue/config.ts +16 -0
- package/dist/cli/template-assets/worker/src/modules/queue/module.ts +11 -0
- package/dist/cli/template-assets/worker/src/modules/queue/processor.ts +105 -0
- package/dist/cli/template-assets/worker/src/modules/queue/repository.ts +16 -0
- package/dist/cli/template-assets/worker/src/modules/queue/retry.ts +17 -0
- package/dist/cli/template-assets/worker/test/retry.test.ts.tpl +12 -0
- package/dist/cli/template-assets/worker-messaging/jobs-messaging.ts +12 -0
- package/dist/cli/template-assets/worker-messaging/messaging-api-service.ts +39 -0
- package/dist/cli/template-assets/worker-messaging/src/env.ts +14 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/messaging/service.ts +59 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/module.ts +8 -0
- package/dist/cli/template-assets/worker-messaging/src/modules/queue/processor.ts +113 -0
- package/dist/cli.js +1218 -0
- package/dist/cn-BVOnrSza.js +1 -0
- package/dist/constants-C4iP0--i.js +38 -0
- package/dist/constants-C4iP0--i.js.map +1 -0
- package/dist/constants-rCR-LNSN.cjs +91 -0
- package/dist/constants-rCR-LNSN.cjs.map +1 -0
- package/dist/core-BidJDmSN.cjs +759 -0
- package/dist/core-BidJDmSN.cjs.map +1 -0
- package/dist/core-C-EFrEd6.js +710 -0
- package/dist/core-C-EFrEd6.js.map +1 -0
- package/dist/decorate-BR5FVX5x.js +14 -0
- package/dist/decorate-R-oqksAh.cjs +25 -0
- package/dist/decorateParam-BFJPEGKJ.cjs +13 -0
- package/dist/decorateParam-CKE7_J1s.js +8 -0
- package/dist/define-adapter-Cc0QrfKt.cjs +16 -0
- package/dist/define-adapter-Cc0QrfKt.cjs.map +1 -0
- package/dist/define-adapter-DRcXno3j.js +11 -0
- package/dist/define-adapter-DRcXno3j.js.map +1 -0
- package/dist/dispatcher-BsD7cO2w.cjs +84 -0
- package/dist/dispatcher-BsD7cO2w.cjs.map +1 -0
- package/dist/dispatcher-DA_l1Vkv.js +73 -0
- package/dist/dispatcher-DA_l1Vkv.js.map +1 -0
- package/dist/errors-DxHoXrLd.d.cts +46 -0
- package/dist/errors-DxHoXrLd.d.ts +46 -0
- package/dist/http/index.cjs +440 -0
- package/dist/http/index.cjs.map +1 -0
- package/dist/http/index.d.cts +257 -0
- package/dist/http/index.d.ts +257 -0
- package/dist/http/index.js +400 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/swagger.cjs +122 -0
- package/dist/http/swagger.cjs.map +1 -0
- package/dist/http/swagger.d.cts +59 -0
- package/dist/http/swagger.d.ts +59 -0
- package/dist/http/swagger.js +117 -0
- package/dist/http/swagger.js.map +1 -0
- package/dist/index--EJQTnHy.d.cts +174 -0
- package/dist/index-B3aVdDMV.d.cts +51 -0
- package/dist/index-BDYdEWl2.d.cts +833 -0
- package/dist/index-BDYdEWl2.d.ts +833 -0
- package/dist/index-Bdl0AiNM.d.ts +1262 -0
- package/dist/index-By8b4ksT.d.ts +25 -0
- package/dist/index-ByS2IC02.d.ts +51 -0
- package/dist/index-DDSaLjXV.d.cts +25 -0
- package/dist/index-FTrYdHfq.d.cts +1262 -0
- package/dist/index-u3ArUXO0.d.ts +174 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/label-BqmJoVE-.cjs +1 -0
- package/dist/label-XeChe1Bu.js +1 -0
- package/dist/messaging/index.cjs +1 -0
- package/dist/messaging/index.d.cts +1775 -0
- package/dist/messaging/index.d.ts +1775 -0
- package/dist/messaging/index.js +1 -0
- package/dist/misc-BpM_lMTx.js +1 -0
- package/dist/misc-DkqJOm1V.cjs +1 -0
- package/dist/operational-CnxdBwVG.d.cts +13 -0
- package/dist/operational-CnxdBwVG.d.ts +13 -0
- package/dist/redaction-DhuHTlHA.js +124 -0
- package/dist/redaction-DhuHTlHA.js.map +1 -0
- package/dist/redaction-uRIQbTwZ.cjs +171 -0
- package/dist/redaction-uRIQbTwZ.cjs.map +1 -0
- package/dist/rolldown-runtime-auK_WOaK.cjs +1 -0
- package/dist/rolldown-runtime-xuxB8TGW.cjs +32 -0
- package/dist/sdk-B2Lp3JCz.cjs +45 -0
- package/dist/sdk-B2Lp3JCz.cjs.map +1 -0
- package/dist/sdk-IGOHpAeG.js +22 -0
- package/dist/sdk-IGOHpAeG.js.map +1 -0
- package/dist/skills-C1uwr9Pp.js +4 -0
- package/dist/skills-DuE-XnBp.js +1 -0
- package/dist/sso/client.cjs +37 -0
- package/dist/sso/client.cjs.map +1 -0
- package/dist/sso/client.d.cts +89 -0
- package/dist/sso/client.d.ts +89 -0
- package/dist/sso/client.js +36 -0
- package/dist/sso/client.js.map +1 -0
- package/dist/sso/index.cjs +833 -0
- package/dist/sso/index.cjs.map +1 -0
- package/dist/sso/index.d.cts +2 -0
- package/dist/sso/index.d.ts +2 -0
- package/dist/sso/index.js +821 -0
- package/dist/sso/index.js.map +1 -0
- package/dist/sso/nestjs.cjs +169 -0
- package/dist/sso/nestjs.cjs.map +1 -0
- package/dist/sso/nestjs.d.cts +92 -0
- package/dist/sso/nestjs.d.ts +92 -0
- package/dist/sso/nestjs.js +151 -0
- package/dist/sso/nestjs.js.map +1 -0
- package/dist/sso/resource.cjs +124 -0
- package/dist/sso/resource.cjs.map +1 -0
- package/dist/sso/resource.d.cts +3 -0
- package/dist/sso/resource.d.ts +3 -0
- package/dist/sso/resource.js +114 -0
- package/dist/sso/resource.js.map +1 -0
- package/dist/status-CRvlFPIs.js +13 -0
- package/dist/status-CRvlFPIs.js.map +1 -0
- package/dist/status-DtK6OHtj.cjs +24 -0
- package/dist/status-DtK6OHtj.cjs.map +1 -0
- package/dist/telemetry/adapters.cjs +6 -0
- package/dist/telemetry/adapters.d.cts +3 -0
- package/dist/telemetry/adapters.d.ts +3 -0
- package/dist/telemetry/adapters.js +4 -0
- package/dist/telemetry/betterstack.cjs +74 -0
- package/dist/telemetry/betterstack.cjs.map +1 -0
- package/dist/telemetry/betterstack.d.cts +12 -0
- package/dist/telemetry/betterstack.d.ts +12 -0
- package/dist/telemetry/betterstack.js +71 -0
- package/dist/telemetry/betterstack.js.map +1 -0
- package/dist/telemetry/core.cjs +11 -0
- package/dist/telemetry/core.d.cts +4 -0
- package/dist/telemetry/core.d.ts +4 -0
- package/dist/telemetry/core.js +5 -0
- package/dist/telemetry/index.cjs +524 -0
- package/dist/telemetry/index.cjs.map +1 -0
- package/dist/telemetry/index.d.cts +68 -0
- package/dist/telemetry/index.d.ts +68 -0
- package/dist/telemetry/index.js +499 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/posthog.cjs +72 -0
- package/dist/telemetry/posthog.cjs.map +1 -0
- package/dist/telemetry/posthog.d.cts +10 -0
- package/dist/telemetry/posthog.d.ts +10 -0
- package/dist/telemetry/posthog.js +71 -0
- package/dist/telemetry/posthog.js.map +1 -0
- package/dist/telemetry/register.cjs +88 -0
- package/dist/telemetry/register.cjs.map +1 -0
- package/dist/telemetry/register.d.cts +14 -0
- package/dist/telemetry/register.d.ts +14 -0
- package/dist/telemetry/register.js +85 -0
- package/dist/telemetry/register.js.map +1 -0
- package/dist/telemetry/testing.cjs +54 -0
- package/dist/telemetry/testing.cjs.map +1 -0
- package/dist/telemetry/testing.d.cts +15 -0
- package/dist/telemetry/testing.d.ts +15 -0
- package/dist/telemetry/testing.js +52 -0
- package/dist/telemetry/testing.js.map +1 -0
- package/dist/telemetry.mock-BSsx7L6S.cjs +45 -0
- package/dist/telemetry.mock-BSsx7L6S.cjs.map +1 -0
- package/dist/telemetry.mock-BZRpy63c.js +40 -0
- package/dist/telemetry.mock-BZRpy63c.js.map +1 -0
- package/dist/telemetry.mock-C1wXuf-M.d.cts +4 -0
- package/dist/telemetry.mock-CdaxofJ7.d.ts +4 -0
- package/dist/ui/chart.cjs +6 -0
- package/dist/ui/chart.d.cts +34 -0
- package/dist/ui/chart.d.ts +34 -0
- package/dist/ui/chart.js +6 -0
- package/dist/ui/form.cjs +1 -0
- package/dist/ui/form.d.cts +23 -0
- package/dist/ui/form.d.ts +23 -0
- package/dist/ui/form.js +1 -0
- package/dist/ui/hooks.cjs +1 -0
- package/dist/ui/hooks.d.cts +66 -0
- package/dist/ui/hooks.d.ts +66 -0
- package/dist/ui/hooks.js +1 -0
- package/dist/ui/index.cjs +1 -0
- package/dist/ui/index.d.cts +3 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.js +1 -0
- package/dist/ui/styles.css +2 -0
- package/dist/ui/utils.cjs +1 -0
- package/dist/ui/utils.d.cts +199 -0
- package/dist/ui/utils.d.ts +199 -0
- package/dist/ui/utils.js +1 -0
- package/dist/use-mobile-BbeIMRgE.cjs +1 -0
- package/dist/use-mobile-Cdd4Lp7p.js +1 -0
- package/dist/use-mobile-ecpyXWz3.d.cts +10 -0
- package/dist/use-mobile-ecpyXWz3.d.ts +10 -0
- package/dist/verifier-BIBtPCVi.cjs +119 -0
- package/dist/verifier-BIBtPCVi.cjs.map +1 -0
- package/dist/verifier-DNdy5Ynw.js +90 -0
- package/dist/verifier-DNdy5Ynw.js.map +1 -0
- package/dist/version-B0ADow60.js +1 -0
- package/dist/version-CMkha8JJ.cjs +1 -0
- package/package.json +539 -5
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Fa as TooltipNameType, Pa as ChartConfig } from "../index-Bdl0AiNM.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as RechartsPrimitive from "recharts";
|
|
4
|
+
import { TooltipValueType } from "recharts";
|
|
5
|
+
type ChartTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.Tooltip> & React.ComponentProps<'div'> & {
|
|
6
|
+
hideLabel?: boolean;
|
|
7
|
+
hideIndicator?: boolean;
|
|
8
|
+
indicator?: 'line' | 'dot' | 'dashed';
|
|
9
|
+
nameKey?: string;
|
|
10
|
+
labelKey?: string;
|
|
11
|
+
} & Omit<RechartsPrimitive.DefaultTooltipContentProps<TooltipValueType, TooltipNameType>, 'accessibilityLayer'>;
|
|
12
|
+
type ChartContainerProps = React.ComponentProps<'div'> & {
|
|
13
|
+
config: ChartConfig;
|
|
14
|
+
children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
|
|
15
|
+
initialDimension?: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type ChartStyleProps = {
|
|
21
|
+
id: string;
|
|
22
|
+
config: ChartConfig;
|
|
23
|
+
};
|
|
24
|
+
type ChartLegendContentProps = React.ComponentProps<'div'> & {
|
|
25
|
+
hideIcon?: boolean;
|
|
26
|
+
nameKey?: string;
|
|
27
|
+
} & RechartsPrimitive.DefaultLegendContentProps;
|
|
28
|
+
declare function ChartContainer({ id, className, children, config, initialDimension, ...props }: ChartContainerProps): React.JSX.Element;
|
|
29
|
+
declare const ChartStyle: ({ id, config }: ChartStyleProps) => React.JSX.Element | null;
|
|
30
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
31
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey }: ChartTooltipContentProps): React.JSX.Element | null;
|
|
32
|
+
declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
|
|
33
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey }: ChartLegendContentProps): React.JSX.Element | null;
|
|
34
|
+
export { type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent };
|
package/dist/ui/chart.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{t as cn}from"../cn-BVOnrSza.js";import*as React from"react";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import*as RechartsPrimitive from"recharts";const CHART_INITIAL_DIMENSION={width:320,height:200},ChartContext=React.createContext(null);function useChart(){let context=React.useContext(ChartContext);if(!context)throw Error(`useChart must be used within a <ChartContainer />`);return context}function ChartContainer({id,className,children,config,initialDimension=CHART_INITIAL_DIMENSION,...props}){let uniqueId=React.useId(),chartId=`chart-${id??uniqueId.replace(/:/g,``)}`,contexto=React.useMemo(()=>({config}),[config]);return/* @__PURE__ */ jsx(ChartContext.Provider,{value:contexto,children:/* @__PURE__ */ jsxs(`div`,{"data-slot":`chart`,"data-chart":chartId,className:cn(`[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden`,className),...props,children:[/* @__PURE__ */ jsx(ChartStyle,{id:chartId,config}),/* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer,{initialDimension,children})]})})}const ChartStyle=({id,config})=>{let variaveis=Object.entries(config).flatMap(([key,itemConfig])=>itemConfig.color?[`\t--color-${key}: ${itemConfig.color};`]:[]);if(!variaveis.length)return null;let styles=`
|
|
2
|
+
[data-chart=${id}] {
|
|
3
|
+
${variaveis.join(`
|
|
4
|
+
`)}
|
|
5
|
+
}
|
|
6
|
+
`;return/* @__PURE__ */ jsx(`style`,{children:styles})},ChartTooltip=RechartsPrimitive.Tooltip;function ChartTooltipLabel({config,payload,label,labelKey,labelFormatter,labelClassName}){let[item]=payload,itemConfig=getPayloadConfigFromPayload(config,item,`${labelKey??item?.dataKey??item?.name??`value`}`),value=!labelKey&&typeof label==`string`?config[label]?.label??label:itemConfig?.label;return labelFormatter?/* @__PURE__ */ jsx(`div`,{className:cn(`font-medium`,labelClassName),children:labelFormatter(value,payload)}):value?/* @__PURE__ */ jsx(`div`,{className:cn(`font-medium`,labelClassName),children:value}):null}function ChartTooltipRow({item,index,itemConfig,indicatorColor,indicator,hideIndicator,nestLabel,nestedLabel,formatter}){return/* @__PURE__ */ jsx(`div`,{className:cn(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,indicator===`dot`&&`items-center`),children:formatter&&item?.value!==void 0&&item.name?formatter(item.value,item.name,item,index,item.payload):/* @__PURE__ */ jsxs(Fragment,{children:[itemConfig?.icon?/* @__PURE__ */ jsx(itemConfig.icon,{}):!hideIndicator&&/* @__PURE__ */ jsx(`div`,{className:cn(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,{"h-2.5 w-2.5":indicator===`dot`,"w-1":indicator===`line`,"w-0 border-[1.5px] border-dashed bg-transparent":indicator===`dashed`,"my-0.5":nestLabel&&indicator===`dashed`}),style:{"--color-bg":indicatorColor,"--color-border":indicatorColor}}),/* @__PURE__ */ jsxs(`div`,{className:cn(`flex flex-1 justify-between leading-none`,nestLabel?`items-end`:`items-center`),children:[/* @__PURE__ */ jsxs(`div`,{className:`grid gap-1.5`,children:[nestedLabel,/* @__PURE__ */ jsx(`span`,{className:`text-muted-foreground`,children:itemConfig?.label??item.name})]}),item.value!=null&&/* @__PURE__ */ jsx(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:typeof item.value==`number`?item.value.toLocaleString():String(item.value)})]})]})})}function ChartTooltipContent({active,payload,className,indicator=`dot`,hideLabel=!1,hideIndicator=!1,label,labelFormatter,labelClassName,formatter,color,nameKey,labelKey}){let{config}=useChart();if(!active||!payload?.length)return null;let nestLabel=payload.length===1&&indicator!==`dot`,tooltipLabel=hideLabel?null:/* @__PURE__ */ jsx(ChartTooltipLabel,{config,payload,label,labelKey,labelFormatter,labelClassName}),linhas=[];for(let item of payload){if(item.type===`none`)continue;let key=`${nameKey??item.name??item.dataKey??`value`}`;linhas.push(/* @__PURE__ */ jsx(ChartTooltipRow,{item,index:linhas.length,itemConfig:getPayloadConfigFromPayload(config,item,key),indicatorColor:color??item.payload?.fill??item.color,indicator,hideIndicator,nestLabel,nestedLabel:nestLabel?tooltipLabel:null,formatter},key))}return/* @__PURE__ */ jsxs(`div`,{className:cn(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,className),children:[nestLabel?null:tooltipLabel,/* @__PURE__ */ jsx(`div`,{className:`grid gap-1.5`,children:linhas})]})}const ChartLegend=RechartsPrimitive.Legend;function ChartLegendContent({className,hideIcon=!1,payload,verticalAlign=`bottom`,nameKey}){let{config}=useChart();return payload?.length?/* @__PURE__ */ jsx(`div`,{className:cn(`flex items-center justify-center gap-4`,verticalAlign===`top`?`pb-3`:`pt-3`,className),children:payload.flatMap(item=>{if(item.type===`none`)return[];let key=`${nameKey??item.dataKey??`value`}`,itemConfig=getPayloadConfigFromPayload(config,item,key);return[/* @__PURE__ */ jsxs(`div`,{className:cn(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[itemConfig?.icon&&!hideIcon?/* @__PURE__ */ jsx(itemConfig.icon,{}):/* @__PURE__ */ jsx(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:item.color}}),itemConfig?.label]},key)]})}):null}function getPayloadConfigFromPayload(config,payload,key){if(typeof payload!=`object`||!payload)return;let payloadPayload=`payload`in payload&&typeof payload.payload==`object`&&payload.payload!==null?payload.payload:void 0,configLabelKey=key;return key in payload&&typeof payload[key]==`string`?configLabelKey=payload[key]:payloadPayload&&key in payloadPayload&&typeof payloadPayload[key]==`string`&&(configLabelKey=payloadPayload[key]),configLabelKey in config?config[configLabelKey]:config[key]}export{ChartContainer,ChartLegend,ChartLegendContent,ChartStyle,ChartTooltip,ChartTooltipContent};
|
package/dist/ui/form.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_rolldown_runtime=require("../rolldown-runtime-auK_WOaK.cjs"),require_label=require("../label-BqmJoVE-.cjs");let radix_ui=require("radix-ui"),react=require("react");react=require_rolldown_runtime.t(react,1);let react_jsx_runtime=require("react/jsx-runtime"),react_hook_form=require("react-hook-form"),cnfast=require("cnfast");const FormFieldContext=react.createContext({}),FormItemContext=react.createContext({}),Form=react_hook_form.FormProvider,FormField=({...props})=>{let contexto=react.useMemo(()=>({name:props.name}),[props.name]);return/* @__PURE__ */ (0,react_jsx_runtime.jsx)(FormFieldContext.Provider,{value:contexto,children:/* @__PURE__ */ (0,react_jsx_runtime.jsx)(react_hook_form.Controller,{...props})})},useFormField=()=>{let fieldContext=react.useContext(FormFieldContext),itemContext=react.useContext(FormItemContext),{getFieldState}=(0,react_hook_form.useFormContext)(),formState=(0,react_hook_form.useFormState)({name:fieldContext.name}),fieldState=getFieldState(fieldContext.name,formState);if(!fieldContext)throw Error(`useFormField should be used within <FormField>`);let{id}=itemContext;return{id,name:fieldContext.name,formItemId:`${id}-form-item`,formDescriptionId:`${id}-form-item-description`,formMessageId:`${id}-form-item-message`,...fieldState}};function FormItem({className,...props}){let id=react.useId(),contexto=react.useMemo(()=>({id}),[id]);return/* @__PURE__ */ (0,react_jsx_runtime.jsx)(FormItemContext.Provider,{value:contexto,children:/* @__PURE__ */ (0,react_jsx_runtime.jsx)(`div`,{"data-slot":`form-item`,className:(0,cnfast.cn)(`grid gap-2`,className),...props})})}function FormLabel({className,...props}){let{error,formItemId}=useFormField();return/* @__PURE__ */ (0,react_jsx_runtime.jsx)(require_label.t,{"data-slot":`form-label`,"data-error":!!error,className:(0,cnfast.cn)(`data-[error=true]:text-destructive`,className),htmlFor:formItemId,...props})}function FormControl({...props}){let{error,formItemId,formDescriptionId,formMessageId}=useFormField();return/* @__PURE__ */ (0,react_jsx_runtime.jsx)(radix_ui.Slot.Root,{"data-slot":`form-control`,id:formItemId,"aria-describedby":error?`${formDescriptionId} ${formMessageId}`:`${formDescriptionId}`,"aria-invalid":!!error,...props})}function FormDescription({className,...props}){let{formDescriptionId}=useFormField();return/* @__PURE__ */ (0,react_jsx_runtime.jsx)(`p`,{"data-slot":`form-description`,id:formDescriptionId,className:(0,cnfast.cn)(`text-muted-foreground text-sm`,className),...props})}function FormMessage({className,...props}){let{error,formMessageId}=useFormField(),body=error?String(error?.message??``):props.children;return body?/* @__PURE__ */ (0,react_jsx_runtime.jsx)(`p`,{"data-slot":`form-message`,id:formMessageId,className:(0,cnfast.cn)(`text-destructive text-sm`,className),...props,children:body}):null}exports.Form=Form,exports.FormControl=FormControl,exports.FormDescription=FormDescription,exports.FormField=FormField,exports.FormItem=FormItem,exports.FormLabel=FormLabel,exports.FormMessage=FormMessage,exports.useFormField=useFormField;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Label, Slot } from "radix-ui";
|
|
3
|
+
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getErrors, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
6
|
+
declare const useFormField: () => {
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
isValidating: boolean;
|
|
11
|
+
error?: import("react-hook-form").FieldError;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare function FormItem({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
19
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof Label.Root>): React.JSX.Element;
|
|
20
|
+
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot.Root>): React.JSX.Element;
|
|
21
|
+
declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
|
|
22
|
+
declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element | null;
|
|
23
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Label, Slot } from "radix-ui";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
4
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getErrors, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
5
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
|
|
6
|
+
declare const useFormField: () => {
|
|
7
|
+
invalid: boolean;
|
|
8
|
+
isDirty: boolean;
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
isValidating: boolean;
|
|
11
|
+
error?: import("react-hook-form").FieldError;
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
formItemId: string;
|
|
15
|
+
formDescriptionId: string;
|
|
16
|
+
formMessageId: string;
|
|
17
|
+
};
|
|
18
|
+
declare function FormItem({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
19
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof Label.Root>): React.JSX.Element;
|
|
20
|
+
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot.Root>): React.JSX.Element;
|
|
21
|
+
declare function FormDescription({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element;
|
|
22
|
+
declare function FormMessage({ className, ...props }: React.ComponentProps<'p'>): React.JSX.Element | null;
|
|
23
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
package/dist/ui/form.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as Label$1}from"../label-XeChe1Bu.js";import{t as cn}from"../cn-BVOnrSza.js";import{Slot}from"radix-ui";import*as React from"react";import{jsx}from"react/jsx-runtime";import{Controller,FormProvider,useFormContext,useFormState}from"react-hook-form";const FormFieldContext=React.createContext({}),FormItemContext=React.createContext({}),Form=FormProvider,FormField=({...props})=>{let contexto=React.useMemo(()=>({name:props.name}),[props.name]);return/* @__PURE__ */ jsx(FormFieldContext.Provider,{value:contexto,children:/* @__PURE__ */ jsx(Controller,{...props})})},useFormField=()=>{let fieldContext=React.useContext(FormFieldContext),itemContext=React.useContext(FormItemContext),{getFieldState}=useFormContext(),formState=useFormState({name:fieldContext.name}),fieldState=getFieldState(fieldContext.name,formState);if(!fieldContext)throw Error(`useFormField should be used within <FormField>`);let{id}=itemContext;return{id,name:fieldContext.name,formItemId:`${id}-form-item`,formDescriptionId:`${id}-form-item-description`,formMessageId:`${id}-form-item-message`,...fieldState}};function FormItem({className,...props}){let id=React.useId(),contexto=React.useMemo(()=>({id}),[id]);return/* @__PURE__ */ jsx(FormItemContext.Provider,{value:contexto,children:/* @__PURE__ */ jsx(`div`,{"data-slot":`form-item`,className:cn(`grid gap-2`,className),...props})})}function FormLabel({className,...props}){let{error,formItemId}=useFormField();return/* @__PURE__ */ jsx(Label$1,{"data-slot":`form-label`,"data-error":!!error,className:cn(`data-[error=true]:text-destructive`,className),htmlFor:formItemId,...props})}function FormControl({...props}){let{error,formItemId,formDescriptionId,formMessageId}=useFormField();return/* @__PURE__ */ jsx(Slot.Root,{"data-slot":`form-control`,id:formItemId,"aria-describedby":error?`${formDescriptionId} ${formMessageId}`:`${formDescriptionId}`,"aria-invalid":!!error,...props})}function FormDescription({className,...props}){let{formDescriptionId}=useFormField();return/* @__PURE__ */ jsx(`p`,{"data-slot":`form-description`,id:formDescriptionId,className:cn(`text-muted-foreground text-sm`,className),...props})}function FormMessage({className,...props}){let{error,formMessageId}=useFormField(),body=error?String(error?.message??``):props.children;return body?/* @__PURE__ */ jsx(`p`,{"data-slot":`form-message`,id:formMessageId,className:cn(`text-destructive text-sm`,className),...props,children:body}):null}export{Form,FormControl,FormDescription,FormField,FormItem,FormLabel,FormMessage,useFormField};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const require_rolldown_runtime=require("../rolldown-runtime-auK_WOaK.cjs"),require_use_mobile=require("../use-mobile-BbeIMRgE.cjs");let react=require("react");react=require_rolldown_runtime.t(react,1);const useIsomorphicLayoutEffect=typeof window<`u`?react.useLayoutEffect:react.useEffect;function stableStringify(value){return JSON.stringify(value,(_chave,valor)=>valor&&typeof valor==`object`&&!Array.isArray(valor)?Object.fromEntries(Object.entries(valor).sort(([a],[b])=>a.localeCompare(b))):valor)}function useDirtyState(current,baseline){return react.useMemo(()=>stableStringify(current)!==stableStringify(baseline),[current,baseline])}function usePersistedState(key,initial){let inicial=react.useRef(initial),memoria=react.useRef(null),avisar=react.useRef(null),assinar=react.useCallback(ouvinte=>(avisar.current=ouvinte,()=>{avisar.current=null}),[]),ler=react.useCallback(()=>{let guardado=memoria.current;if(guardado?.key===key)return guardado.valor;let valor=inicial.current;try{let cru=window.localStorage.getItem(key);cru!==null&&(valor=JSON.parse(cru))}catch{}return memoria.current={key,valor},valor},[key]),lerNoServidor=react.useCallback(()=>inicial.current,[]),value=react.useSyncExternalStore(assinar,ler,lerNoServidor),definir=react.useCallback(acao=>{let anterior=ler(),proximo=typeof acao==`function`?acao(anterior):acao;memoria.current={key,valor:proximo};try{window.localStorage.setItem(key,JSON.stringify(proximo))}catch{}avisar.current?.()},[key,ler]),hydrated=react.useSyncExternalStore(naoMuda,sempreHidratado,nuncaHidratado);return[value,definir,react.useMemo(()=>({hydrated}),[hydrated])]}function naoMuda(){return()=>{}}function sempreHidratado(){return!0}function nuncaHidratado(){return!1}exports.MOBILE_BREAKPOINT=require_use_mobile.n,exports.useCopyToClipboard=require_use_mobile.a,exports.useDebounce=require_use_mobile.i,exports.useDirtyState=useDirtyState,exports.useIsMobile=require_use_mobile.t,exports.useIsomorphicLayoutEffect=useIsomorphicLayoutEffect,exports.useMediaQuery=require_use_mobile.r,exports.usePersistedState=usePersistedState;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { t as useIsMobile } from "../use-mobile-ecpyXWz3.cjs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* `true` quando a media query casa.
|
|
5
|
+
*
|
|
6
|
+
* Devolve `false` no primeiro render e no servidor, onde não há viewport para
|
|
7
|
+
* medir. Quem não pode ter salto de layout deve renderizar o estado "não
|
|
8
|
+
* casa" e deixar o efeito corrigir.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
11
|
+
export type UseCopyToClipboardOptions = {
|
|
12
|
+
/** Por quanto tempo `copied` fica `true`. Padrão 2000 ms. */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
};
|
|
15
|
+
export type UseCopyToClipboardResult = {
|
|
16
|
+
/** `true` enquanto vale a confirmação da última cópia. */
|
|
17
|
+
copied: boolean;
|
|
18
|
+
/** Devolve `false` quando a área de transferência não está disponível. */
|
|
19
|
+
copy: (value: string) => Promise<boolean>;
|
|
20
|
+
};
|
|
21
|
+
export declare const MOBILE_BREAKPOINT = 768;
|
|
22
|
+
/**
|
|
23
|
+
* Copia para a área de transferência e mantém um sinal de confirmação.
|
|
24
|
+
*
|
|
25
|
+
* O timer é limpo no desmonte e a cada nova cópia — sem isso, copiar duas
|
|
26
|
+
* vezes em sequência apagaria a confirmação da segunda no tempo da primeira.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useCopyToClipboard(options?: UseCopyToClipboardOptions): UseCopyToClipboardResult;
|
|
29
|
+
/**
|
|
30
|
+
* Atrasa a propagação de um valor.
|
|
31
|
+
*
|
|
32
|
+
* Usado pela busca do `DataTable` para não filtrar a cada tecla.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
35
|
+
/**
|
|
36
|
+
* `useLayoutEffect` no navegador, `useEffect` no servidor.
|
|
37
|
+
*
|
|
38
|
+
* Existe para silenciar o aviso do React sobre `useLayoutEffect` durante o
|
|
39
|
+
* render no servidor, onde ele não roda de todo jeito.
|
|
40
|
+
*/
|
|
41
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
42
|
+
/**
|
|
43
|
+
* `true` quando o valor atual difere da referência.
|
|
44
|
+
*
|
|
45
|
+
* Serve para habilitar "salvar" só quando há mudança de verdade.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useDirtyState<T>(current: T, baseline: T): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Estado espelhado em `localStorage`.
|
|
50
|
+
*
|
|
51
|
+
* O storage é uma fonte externa e mutável, então o valor é lido por
|
|
52
|
+
* `useSyncExternalStore` em vez de um efeito. É o que garante a hidratação:
|
|
53
|
+
* o render do servidor e o de hidratação usam `initial` — o único valor que os
|
|
54
|
+
* dois lados produzem igual —, e o cliente passa a ler o storage só depois.
|
|
55
|
+
* Lido num efeito, o valor aparecia um quadro atrasado.
|
|
56
|
+
*
|
|
57
|
+
* `hydrated` diz que o valor em mãos já é o do storage, e não o inicial.
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* const [colunas, setColunas, { hydrated }] = usePersistedState('colunas', []);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function usePersistedState<T>(key: string, initial: T): [T, React.Dispatch<React.SetStateAction<T>>, {
|
|
64
|
+
hydrated: boolean;
|
|
65
|
+
}];
|
|
66
|
+
export { useIsMobile };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { t as useIsMobile } from "../use-mobile-ecpyXWz3.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* `true` quando a media query casa.
|
|
5
|
+
*
|
|
6
|
+
* Devolve `false` no primeiro render e no servidor, onde não há viewport para
|
|
7
|
+
* medir. Quem não pode ter salto de layout deve renderizar o estado "não
|
|
8
|
+
* casa" e deixar o efeito corrigir.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
11
|
+
export type UseCopyToClipboardOptions = {
|
|
12
|
+
/** Por quanto tempo `copied` fica `true`. Padrão 2000 ms. */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
};
|
|
15
|
+
export type UseCopyToClipboardResult = {
|
|
16
|
+
/** `true` enquanto vale a confirmação da última cópia. */
|
|
17
|
+
copied: boolean;
|
|
18
|
+
/** Devolve `false` quando a área de transferência não está disponível. */
|
|
19
|
+
copy: (value: string) => Promise<boolean>;
|
|
20
|
+
};
|
|
21
|
+
export declare const MOBILE_BREAKPOINT = 768;
|
|
22
|
+
/**
|
|
23
|
+
* Copia para a área de transferência e mantém um sinal de confirmação.
|
|
24
|
+
*
|
|
25
|
+
* O timer é limpo no desmonte e a cada nova cópia — sem isso, copiar duas
|
|
26
|
+
* vezes em sequência apagaria a confirmação da segunda no tempo da primeira.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useCopyToClipboard(options?: UseCopyToClipboardOptions): UseCopyToClipboardResult;
|
|
29
|
+
/**
|
|
30
|
+
* Atrasa a propagação de um valor.
|
|
31
|
+
*
|
|
32
|
+
* Usado pela busca do `DataTable` para não filtrar a cada tecla.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
35
|
+
/**
|
|
36
|
+
* `useLayoutEffect` no navegador, `useEffect` no servidor.
|
|
37
|
+
*
|
|
38
|
+
* Existe para silenciar o aviso do React sobre `useLayoutEffect` durante o
|
|
39
|
+
* render no servidor, onde ele não roda de todo jeito.
|
|
40
|
+
*/
|
|
41
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
42
|
+
/**
|
|
43
|
+
* `true` quando o valor atual difere da referência.
|
|
44
|
+
*
|
|
45
|
+
* Serve para habilitar "salvar" só quando há mudança de verdade.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useDirtyState<T>(current: T, baseline: T): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Estado espelhado em `localStorage`.
|
|
50
|
+
*
|
|
51
|
+
* O storage é uma fonte externa e mutável, então o valor é lido por
|
|
52
|
+
* `useSyncExternalStore` em vez de um efeito. É o que garante a hidratação:
|
|
53
|
+
* o render do servidor e o de hidratação usam `initial` — o único valor que os
|
|
54
|
+
* dois lados produzem igual —, e o cliente passa a ler o storage só depois.
|
|
55
|
+
* Lido num efeito, o valor aparecia um quadro atrasado.
|
|
56
|
+
*
|
|
57
|
+
* `hydrated` diz que o valor em mãos já é o do storage, e não o inicial.
|
|
58
|
+
*
|
|
59
|
+
* ```tsx
|
|
60
|
+
* const [colunas, setColunas, { hydrated }] = usePersistedState('colunas', []);
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare function usePersistedState<T>(key: string, initial: T): [T, React.Dispatch<React.SetStateAction<T>>, {
|
|
64
|
+
hydrated: boolean;
|
|
65
|
+
}];
|
|
66
|
+
export { useIsMobile };
|
package/dist/ui/hooks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as useCopyToClipboard,i as useDebounce,n as MOBILE_BREAKPOINT,r as useMediaQuery,t as useIsMobile}from"../use-mobile-Cdd4Lp7p.js";import*as React from"react";const useIsomorphicLayoutEffect=typeof window<`u`?React.useLayoutEffect:React.useEffect;function stableStringify(value){return JSON.stringify(value,(_chave,valor)=>valor&&typeof valor==`object`&&!Array.isArray(valor)?Object.fromEntries(Object.entries(valor).sort(([a],[b])=>a.localeCompare(b))):valor)}function useDirtyState(current,baseline){return React.useMemo(()=>stableStringify(current)!==stableStringify(baseline),[current,baseline])}function usePersistedState(key,initial){let inicial=React.useRef(initial),memoria=React.useRef(null),avisar=React.useRef(null),assinar=React.useCallback(ouvinte=>(avisar.current=ouvinte,()=>{avisar.current=null}),[]),ler=React.useCallback(()=>{let guardado=memoria.current;if(guardado?.key===key)return guardado.valor;let valor=inicial.current;try{let cru=window.localStorage.getItem(key);cru!==null&&(valor=JSON.parse(cru))}catch{}return memoria.current={key,valor},valor},[key]),lerNoServidor=React.useCallback(()=>inicial.current,[]),value=React.useSyncExternalStore(assinar,ler,lerNoServidor),definir=React.useCallback(acao=>{let anterior=ler(),proximo=typeof acao==`function`?acao(anterior):acao;memoria.current={key,valor:proximo};try{window.localStorage.setItem(key,JSON.stringify(proximo))}catch{}avisar.current?.()},[key,ler]),hydrated=React.useSyncExternalStore(naoMuda,sempreHidratado,nuncaHidratado);return[value,definir,React.useMemo(()=>({hydrated}),[hydrated])]}function naoMuda(){return()=>{}}function sempreHidratado(){return!0}function nuncaHidratado(){return!1}export{MOBILE_BREAKPOINT,useCopyToClipboard,useDebounce,useDirtyState,useIsMobile,useIsomorphicLayoutEffect,useMediaQuery,usePersistedState};
|