@rendra-ui/web 2.5.0 → 2.7.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.
Files changed (68) hide show
  1. package/README.md +13 -3
  2. package/dist/base.css +1 -1
  3. package/dist/{empty-state-Cdb1vkMT.js → brand-feedback-icon-BYNcqBel.js} +4 -64
  4. package/dist/brand-feedback-icon-BYNcqBel.js.map +1 -0
  5. package/dist/{button-BzJgR2gH.js → button-DlzWwpZk.js} +7 -7
  6. package/dist/button-DlzWwpZk.js.map +1 -0
  7. package/dist/chart.js +15 -13
  8. package/dist/chart.js.map +1 -1
  9. package/dist/cli/auditar.js +1 -1
  10. package/dist/cli/codigos.js +2 -2
  11. package/dist/cli/executar-auditar.js +1 -1
  12. package/dist/cli/help.js +1 -1
  13. package/dist/cli/trocar.js +2 -2
  14. package/dist/cli/typescript-loader.js +1 -1
  15. package/dist/{cn-Cw7M5kEP.js → cn-B0N3Pek0.js} +2 -2
  16. package/dist/{cn-Cw7M5kEP.js.map → cn-B0N3Pek0.js.map} +1 -1
  17. package/dist/{components-DkpspH9h.js → components-CpQPMGfT.js} +18 -2
  18. package/dist/{components-DkpspH9h.js.map → components-CpQPMGfT.js.map} +1 -1
  19. package/dist/components.css +90 -1
  20. package/dist/document-viewer.js +4 -4
  21. package/dist/{tooltip-BAMSaGbS.js → dropdown-menu-M8vs0byD.js} +15 -81
  22. package/dist/dropdown-menu-M8vs0byD.js.map +1 -0
  23. package/dist/empty-state-a47Kd_Ci.js +67 -0
  24. package/dist/empty-state-a47Kd_Ci.js.map +1 -0
  25. package/dist/{features-max--5VEt6M7.js → features-max-ScxV8gb3.js} +1 -1
  26. package/dist/flow.js +1485 -0
  27. package/dist/flow.js.map +1 -0
  28. package/dist/index.js +130 -1899
  29. package/dist/index.js.map +1 -1
  30. package/dist/motion-context-BUMPf0e9.js +222 -0
  31. package/dist/motion-context-BUMPf0e9.js.map +1 -0
  32. package/dist/motion-on-CNN6y8g-.js +29 -0
  33. package/dist/motion-on-CNN6y8g-.js.map +1 -0
  34. package/dist/motion.js +3 -0
  35. package/dist/{rendra-provider-CRe0XdOU.js → rendra-provider-DEURIIL3.js} +3 -3
  36. package/dist/rendra-provider-DEURIIL3.js.map +1 -0
  37. package/dist/rich-text-editor.js +4 -3
  38. package/dist/rich-text-editor.js.map +1 -1
  39. package/dist/router-bridge.js +2 -2
  40. package/dist/router-bridge.js.map +1 -1
  41. package/dist/timeline-BOh7gUdA.js +1803 -0
  42. package/dist/timeline-BOh7gUdA.js.map +1 -0
  43. package/dist/tokens.css +1 -1
  44. package/dist/tooltip-Ym9S4h9_.js +76 -0
  45. package/dist/tooltip-Ym9S4h9_.js.map +1 -0
  46. package/dist/types/components/rendra-provider.d.ts +7 -2
  47. package/dist/types/components/rendra-router-bridge.d.ts +2 -1
  48. package/dist/types/components/ui/flow-editor.d.ts +11 -0
  49. package/dist/types/components/ui/flow-viewer.d.ts +58 -0
  50. package/dist/types/flow.d.ts +3 -0
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/lib/flow.d.ts +121 -0
  53. package/dist/types/lib/motion/index.d.ts +1 -1
  54. package/dist/types/lib/motion/motion-context.d.ts +21 -6
  55. package/dist/types/lib/motion/motion-on.d.ts +12 -0
  56. package/dist/types/motion.d.ts +1 -0
  57. package/dist/{use-breakpoint-O9eqFmsF.js → use-breakpoint-En17oXKY.js} +2 -2
  58. package/dist/{use-breakpoint-O9eqFmsF.js.map → use-breakpoint-En17oXKY.js.map} +1 -1
  59. package/dist/{use-motion-presets-BrkgL8lG.js → use-motion-presets-D3ww1oJX.js} +3 -3
  60. package/dist/{use-motion-presets-BrkgL8lG.js.map → use-motion-presets-D3ww1oJX.js.map} +1 -1
  61. package/dist/widget-grid.js +2 -2
  62. package/package.json +14 -1
  63. package/dist/button-BzJgR2gH.js.map +0 -1
  64. package/dist/empty-state-Cdb1vkMT.js.map +0 -1
  65. package/dist/motion-context-5BRIQAJm.js +0 -107
  66. package/dist/motion-context-5BRIQAJm.js.map +0 -1
  67. package/dist/rendra-provider-CRe0XdOU.js.map +0 -1
  68. package/dist/tooltip-BAMSaGbS.js.map +0 -1
@@ -0,0 +1,121 @@
1
+ export type FlowNodeType = 'gatilho' | 'acao' | 'condicao' | 'espera' | 'fim';
2
+ export type FlowBranch = 'sim' | 'nao';
3
+ export type FlowWaitUnit = 'segundos' | 'minutos' | 'horas' | 'dias';
4
+ export interface FlowNode {
5
+ id: string;
6
+ type: FlowNodeType;
7
+ position: {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ data: {
12
+ label: string;
13
+ config?: Record<string, unknown>;
14
+ };
15
+ }
16
+ export interface FlowEdge {
17
+ id: string;
18
+ source: string;
19
+ target: string;
20
+ /** Só a saída de uma condição usa o ramo. */
21
+ branch?: FlowBranch;
22
+ }
23
+ export interface Flow {
24
+ nodes: FlowNode[];
25
+ edges: FlowEdge[];
26
+ }
27
+ export interface FlowIssue {
28
+ code: string;
29
+ message: string;
30
+ nodeId?: string;
31
+ edgeId?: string;
32
+ }
33
+ export interface SimulationStep {
34
+ nodeId: string;
35
+ type: FlowNodeType;
36
+ label: string;
37
+ status: 'succeeded' | 'failed' | 'skipped';
38
+ detail?: string;
39
+ }
40
+ export interface SimulationState {
41
+ status: 'idle' | 'running' | 'waiting-choice' | 'finished' | 'error';
42
+ steps: SimulationStep[];
43
+ /** Bloco que o próximo avanço executa (o bloco ativo); `null` fora da simulação. */
44
+ currentId: string | null;
45
+ issues: FlowIssue[];
46
+ }
47
+ export declare const FLOW_NODE_TYPES: readonly FlowNodeType[];
48
+ export declare const FLOW_WAIT_UNITS: readonly FlowWaitUnit[];
49
+ /** Nome do tipo de bloco, como aparece na interface. */
50
+ export declare const FLOW_TYPE_NAME: Record<FlowNodeType, string>;
51
+ /** A duração do bloco de espera ("5 minutos"), ou `null` se o config não a define. */
52
+ export declare function formatWait(config: Record<string, unknown> | undefined): string | null;
53
+ /** Texto da espera simulada: nunca espera de verdade. */
54
+ export declare function describeWait(config: Record<string, unknown> | undefined): string;
55
+ /** Nome do bloco para mensagens e rótulos: o rótulo, ou o tipo quando ele está vazio. */
56
+ export declare const nodeName: (n: Pick<FlowNode, "type" | "data">) => string;
57
+ /** Problemas do fluxo, em ordem estável: a mesma entrada dá sempre a mesma lista. */
58
+ export declare function validateFlow(flow: Flow): FlowIssue[];
59
+ /** JSON do fluxo, com a ordem das chaves fixa: o mesmo fluxo dá sempre o mesmo texto. */
60
+ export declare function serializeFlow(flow: Flow): string;
61
+ export type ParseResult = {
62
+ ok: true;
63
+ flow: Flow;
64
+ } | {
65
+ ok: false;
66
+ errors: string[];
67
+ };
68
+ /** Lê o JSON de um fluxo. Nunca lança; campos que o contrato não conhece são ignorados. */
69
+ export declare function parseFlow(text: string): ParseResult;
70
+ export interface AddNodeOptions {
71
+ label?: string;
72
+ /** Ids que já existiram neste fluxo (mesmo apagados): não voltam a ser usados. */
73
+ reservedIds?: Iterable<string>;
74
+ }
75
+ /** Acrescenta um bloco com id único e determinístico (`tipo-N`). */
76
+ export declare function addNode(flow: Flow, type: FlowNodeType, position: {
77
+ x: number;
78
+ y: number;
79
+ }, options?: AddNodeOptions): {
80
+ flow: Flow;
81
+ id: string;
82
+ };
83
+ /** Apaga o bloco e as ligações que chegam ou saem dele. */
84
+ export declare function removeNode(flow: Flow, id: string): Flow;
85
+ export declare function removeEdge(flow: Flow, id: string): Flow;
86
+ export declare function moveNode(flow: Flow, id: string, position: {
87
+ x: number;
88
+ y: number;
89
+ }): Flow;
90
+ /** Troca o rótulo e/ou o config do bloco (o config informado substitui o anterior). */
91
+ export declare function updateNodeData(flow: Flow, id: string, patch: {
92
+ label?: string;
93
+ config?: Record<string, unknown>;
94
+ }): Flow;
95
+ export type ConnectResult = {
96
+ ok: true;
97
+ flow: Flow;
98
+ } | {
99
+ ok: false;
100
+ reason: string;
101
+ };
102
+ /**
103
+ * Liga dois blocos. A segunda saída de um bloco comum (ou do mesmo ramo da condição) substitui
104
+ * a primeira. Recusa, com o motivo, o que o fluxo nunca aceita.
105
+ */
106
+ export declare function connectNodes(flow: Flow, source: string, target: string, branch?: FlowBranch): ConnectResult;
107
+ /**
108
+ * Define (ou, com `target` nulo, tira) o próximo bloco de `id`; na condição, o do ramo dado.
109
+ * Uma ligação recusada devolve o próprio fluxo, sem mudança.
110
+ */
111
+ export declare function setNext(flow: Flow, id: string, target: string | null, branch?: FlowBranch): Flow;
112
+ /** Blocos que `id` pode ter como próximo: nunca ele mesmo nem o gatilho. */
113
+ export declare function nextCandidates(flow: Flow, id: string): FlowNode[];
114
+ export declare function resetSimulation(): SimulationState;
115
+ /** Começa no gatilho. Fluxo inválido não inicia: devolve `error` com os problemas. */
116
+ export declare function startSimulation(flow: Flow): SimulationState;
117
+ /**
118
+ * Executa o bloco ativo (um passo) e passa ao próximo. Na condição é preciso escolher o ramo:
119
+ * sem escolha válida nada anda. A espera é instantânea; só o texto diz quanto aguardaria.
120
+ */
121
+ export declare function advanceSimulation(flow: Flow, state: SimulationState, choice?: FlowBranch): SimulationState;
@@ -1,4 +1,4 @@
1
- export { MotionModeScope, MotionProvider, RevealScope, useLayoutReady, useMotionMode, useRevealScope, type MotionMode, } from './motion-context';
1
+ export { MotionModeScope, MotionProvider, RevealScope, useLayoutReady, useMotionAdopted, useMotionLib, useMotionMode, useMotionOn, useRevealScope, type MotionMode, } from './motion-context';
2
2
  export { useMotionPresets } from './use-motion-presets';
3
3
  export type { MotionPreset, Presets, SlideDistance, SlideFrom } from './presets';
4
4
  export { layoutEnabled } from './reorder';
@@ -1,7 +1,17 @@
1
1
  import { type ReactNode } from 'react';
2
+ import type { RendraMotion } from './motion-on';
2
3
  export type MotionMode = 'off' | 'on';
3
4
  /** Modo de motion do provider mais próximo (`off` sem provider). */
4
5
  export declare function useMotionMode(): MotionMode;
6
+ /** O objeto do Motion de quem está em `on` (`m`, `AnimatePresence`, `animate`, hooks); `null` em `off`. */
7
+ export declare function useMotionLib(): RendraMotion | null;
8
+ /** Como `useMotionLib`, para o que só existe em `on`: sem objeto é erro de uso, não um `off`. */
9
+ export declare function useMotionOn(): RendraMotion;
10
+ /**
11
+ * O componente está sendo montado na troca tardia do `off` para o `on`? Então ele já estava na
12
+ * tela: mostra o valor final em vez de repetir a contagem ou a entrada.
13
+ */
14
+ export declare function useMotionAdopted(): boolean;
5
15
  /**
6
16
  * Em `on`, o chunk do `domMax` já chegou. Um `m.*` com `layout` ou `layoutId` só ganha o nó de
7
17
  * projeção se for criado DEPOIS disso (o Motion não monta a projeção de um elemento que já
@@ -27,17 +37,22 @@ export declare function MotionModeScope({ mode, children }: {
27
37
  * Em `off`, só o contexto (nenhum nó novo, nenhum LazyMotion). Em `on`, dois `LazyMotion` (os
28
38
  * dois `strict`: só `m.*` entra, um `motion.*` esquecido quebra em vez de puxar o pacote inteiro):
29
39
  * o de fora carrega o `domMax` sob demanda (layout e arraste), em chunk separado; o de dentro traz
30
- * o `domAnimation` síncrono (animação e gestos) e é o que os `m.*` enxergam. Nessa ordem o
31
- * renderer síncrono já está no contexto na primeira renderização (elementos e gestos funcionam
32
- * na hora), e os recursos de layout se juntam quando o chunk chega. A ordem contrária esconderia
33
- * o renderer até o chunk terminar de baixar.
40
+ * o `domAnimation` (animação e gestos) e é o que os `m.*` enxergam. Nessa ordem o renderer já está
41
+ * no contexto na primeira renderização, e os recursos de layout se juntam quando o chunk chega. A
42
+ * ordem contrária esconderia o renderer até o chunk terminar de baixar.
43
+ *
44
+ * `mode` aceita o objeto do Motion (`rendraMotion`): `on` síncrono, desde o primeiro quadro e no
45
+ * servidor. Com o texto `'on'`, o objeto vem do chunk `motion-on`, carregado depois do primeiro
46
+ * quadro: até lá a árvore roda em `off` (nunca vazia); quando ele chega o modo vira `on` SEM
47
+ * remontar nada (os `LazyMotion` e o `MotionConfig` já estavam montados) e o que já estava na tela
48
+ * não repete a entrada.
34
49
  *
35
50
  * O `MotionConfig` recebe "reduzir movimento" da mesma fonte dos presets (o `matchMedia` de
36
51
  * `use-reduced-motion.ts`, reativo): com `always`, o Motion também tira o deslocamento e o layout
37
52
  * de qualquer animação que um componente escreva à mão, e mantém a opacidade. Não é uma segunda
38
53
  * fonte: é a primeira, lida uma vez, entregue a dois consumidores.
39
54
  */
40
- export declare function MotionProvider({ mode, children }: {
41
- mode: MotionMode;
55
+ export declare function MotionProvider({ mode, children, }: {
56
+ mode: MotionMode | RendraMotion;
42
57
  children: ReactNode;
43
58
  }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { AnimatePresence, animate, domAnimation, m, useDragControls, useMotionValue, useTransform } from 'motion/react';
2
+ /** O objeto do Motion que o provider aceita em `motion={...}` e que `useMotionLib()` devolve. */
3
+ export interface RendraMotion {
4
+ m: typeof m;
5
+ AnimatePresence: typeof AnimatePresence;
6
+ animate: typeof animate;
7
+ useMotionValue: typeof useMotionValue;
8
+ useTransform: typeof useTransform;
9
+ useDragControls: typeof useDragControls;
10
+ domAnimation: typeof domAnimation;
11
+ }
12
+ export declare const rendraMotion: RendraMotion;
@@ -0,0 +1 @@
1
+ export { rendraMotion, type RendraMotion } from './lib/motion/motion-on';
@@ -1,4 +1,4 @@
1
- /*! Rendra Design System v2.5.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
1
+ /*! Rendra Design System v2.7.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
2
2
  import { useSyncExternalStore } from "react";
3
3
  //#region src/hooks/use-breakpoint.ts
4
4
  /**
@@ -46,4 +46,4 @@ function useBreakpoint() {
46
46
  //#endregion
47
47
  export { useBreakpoint as n, breakpoints as t };
48
48
 
49
- //# sourceMappingURL=use-breakpoint-O9eqFmsF.js.map
49
+ //# sourceMappingURL=use-breakpoint-En17oXKY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-breakpoint-O9eqFmsF.js","names":[],"sources":["../src/hooks/use-breakpoint.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\n/**\n * Pontos de quebra, espelhando os padrões do Tailwind (sm 40rem, md 48rem, lg 64rem...).\n * Único hook de detecção de tela do sistema. Para adaptação ao espaço disponível\n * dentro de um bloco (e não à tela), use container queries (@container) no CSS.\n */\nexport const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536 } as const\nexport type Breakpoint = keyof typeof breakpoints\n\nconst order: Breakpoint[] = ['sm', 'md', 'lg', 'xl', '2xl']\n\nfunction subscribe(cb: () => void) {\n const lists = order.map((bp) => matchMedia(`(min-width: ${breakpoints[bp]}px)`))\n lists.forEach((mq) => mq.addEventListener('change', cb))\n return () => lists.forEach((mq) => mq.removeEventListener('change', cb))\n}\n\nfunction getCurrent(): Breakpoint | 'base' {\n let current: Breakpoint | 'base' = 'base'\n for (const bp of order) if (matchMedia(`(min-width: ${breakpoints[bp]}px)`).matches) current = bp\n return current\n}\n\nexport function useBreakpoint() {\n const current = useSyncExternalStore(subscribe, getCurrent, () => 'lg' as const)\n const rank = current === 'base' ? -1 : order.indexOf(current)\n const up = (bp: Breakpoint) => rank >= order.indexOf(bp)\n return {\n current,\n up,\n /** Abaixo de 768px: componentes se reconstroem no formato mobile. */\n isMobile: !up('md'),\n isTablet: up('md') && !up('lg'),\n isDesktop: up('lg'),\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,cAAc;CAAE,IAAI;CAAK,IAAI;CAAK,IAAI;CAAM,IAAI;CAAM,OAAO;AAAK;AAG/E,IAAM,QAAsB;CAAC;CAAM;CAAM;CAAM;CAAM;AAAK;AAE1D,SAAS,UAAU,IAAgB;CACjC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC;CAC/E,MAAM,SAAS,OAAO,GAAG,iBAAiB,UAAU,EAAE,CAAC;CACvD,aAAa,MAAM,SAAS,OAAO,GAAG,oBAAoB,UAAU,EAAE,CAAC;AACzE;AAEA,SAAS,aAAkC;CACzC,IAAI,UAA+B;CACnC,KAAK,MAAM,MAAM,OAAO,IAAI,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC,CAAC,SAAS,UAAU;CAC/F,OAAO;AACT;AAEA,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,qBAAqB,WAAW,kBAAkB,IAAa;CAC/E,MAAM,OAAO,YAAY,SAAS,KAAK,MAAM,QAAQ,OAAO;CAC5D,MAAM,MAAM,OAAmB,QAAQ,MAAM,QAAQ,EAAE;CACvD,OAAO;EACL;EACA;;EAEA,UAAU,CAAC,GAAG,IAAI;EAClB,UAAU,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI;EAC9B,WAAW,GAAG,IAAI;CACpB;AACF"}
1
+ {"version":3,"file":"use-breakpoint-En17oXKY.js","names":[],"sources":["../src/hooks/use-breakpoint.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\n/**\n * Pontos de quebra, espelhando os padrões do Tailwind (sm 40rem, md 48rem, lg 64rem...).\n * Único hook de detecção de tela do sistema. Para adaptação ao espaço disponível\n * dentro de um bloco (e não à tela), use container queries (@container) no CSS.\n */\nexport const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280, '2xl': 1536 } as const\nexport type Breakpoint = keyof typeof breakpoints\n\nconst order: Breakpoint[] = ['sm', 'md', 'lg', 'xl', '2xl']\n\nfunction subscribe(cb: () => void) {\n const lists = order.map((bp) => matchMedia(`(min-width: ${breakpoints[bp]}px)`))\n lists.forEach((mq) => mq.addEventListener('change', cb))\n return () => lists.forEach((mq) => mq.removeEventListener('change', cb))\n}\n\nfunction getCurrent(): Breakpoint | 'base' {\n let current: Breakpoint | 'base' = 'base'\n for (const bp of order) if (matchMedia(`(min-width: ${breakpoints[bp]}px)`).matches) current = bp\n return current\n}\n\nexport function useBreakpoint() {\n const current = useSyncExternalStore(subscribe, getCurrent, () => 'lg' as const)\n const rank = current === 'base' ? -1 : order.indexOf(current)\n const up = (bp: Breakpoint) => rank >= order.indexOf(bp)\n return {\n current,\n up,\n /** Abaixo de 768px: componentes se reconstroem no formato mobile. */\n isMobile: !up('md'),\n isTablet: up('md') && !up('lg'),\n isDesktop: up('lg'),\n }\n}\n"],"mappings":";;;;;;;;AAOA,IAAa,cAAc;CAAE,IAAI;CAAK,IAAI;CAAK,IAAI;CAAM,IAAI;CAAM,OAAO;AAAK;AAG/E,IAAM,QAAsB;CAAC;CAAM;CAAM;CAAM;CAAM;AAAK;AAE1D,SAAS,UAAU,IAAgB;CACjC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC;CAC/E,MAAM,SAAS,OAAO,GAAG,iBAAiB,UAAU,EAAE,CAAC;CACvD,aAAa,MAAM,SAAS,OAAO,GAAG,oBAAoB,UAAU,EAAE,CAAC;AACzE;AAEA,SAAS,aAAkC;CACzC,IAAI,UAA+B;CACnC,KAAK,MAAM,MAAM,OAAO,IAAI,WAAW,eAAe,YAAY,IAAI,IAAI,CAAC,CAAC,SAAS,UAAU;CAC/F,OAAO;AACT;AAEA,SAAgB,gBAAgB;CAC9B,MAAM,UAAU,qBAAqB,WAAW,kBAAkB,IAAa;CAC/E,MAAM,OAAO,YAAY,SAAS,KAAK,MAAM,QAAQ,OAAO;CAC5D,MAAM,MAAM,OAAmB,QAAQ,MAAM,QAAQ,EAAE;CACvD,OAAO;EACL;EACA;;EAEA,UAAU,CAAC,GAAG,IAAI;EAClB,UAAU,GAAG,IAAI,KAAK,CAAC,GAAG,IAAI;EAC9B,WAAW,GAAG,IAAI;CACpB;AACF"}
@@ -1,5 +1,5 @@
1
- /*! Rendra Design System v2.5.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
2
- import { a as getReducedMotion, o as subscribeReducedMotion, r as useMotionMode } from "./motion-context-5BRIQAJm.js";
1
+ /*! Rendra Design System v2.7.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
2
+ import { a as useMotionMode, c as getReducedMotion, l as subscribeReducedMotion } from "./motion-context-BUMPf0e9.js";
3
3
  import { useMemo, useSyncExternalStore } from "react";
4
4
  //#region src/lib/motion/tokens.ts
5
5
  /**
@@ -398,4 +398,4 @@ function useMotionPresets() {
398
398
  //#endregion
399
399
  export { toCubicBezier as n, useMotionPresets as t };
400
400
 
401
- //# sourceMappingURL=use-motion-presets-BrkgL8lG.js.map
401
+ //# sourceMappingURL=use-motion-presets-D3ww1oJX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-motion-presets-BrkgL8lG.js","names":[],"sources":["../src/lib/motion/tokens.ts","../src/lib/motion/presets.ts","../src/lib/motion/use-motion-presets.ts"],"sourcesContent":["/*\n * Durações e curvas do motion (linguagem única, web e app). A fonte é o globals.css:\n * --rendra-duration-* bloco :root fora de camada (vai para o dist/tokens.css do pacote);\n * --rendra-ease-* no mesmo bloco, então o host as sobrescreve; o @theme guarda os nomes\n * do Tailwind (--ease-out, --ease-move...) como alias delas.\n * As constantes daqui são a reserva em tempo de execução (SSR, variável ausente ou inválida), e\n * tokens.test.ts confere que elas batem com o globals.css. Valores em segundos e vetores de 4\n * números, o formato que o Motion aceita.\n */\n\nexport type Bezier = [number, number, number, number]\n\n/**\n * Reserva das durações, em segundos (SSR, ou variável ausente).\n * `press` e `fast` valem o mesmo (120 ms) com propósitos diferentes: o toque e a saída de overlay.\n */\nexport const DURATION = {\n press: 0.12,\n hover: 0.15,\n fast: 0.12,\n base: 0.2,\n move: 0.25,\n slow: 0.32,\n draw: 0.42,\n pulse: 1,\n}\nexport type DurationName = keyof typeof DURATION\n\n/**\n * Reveal: entrada de uso único (dashboard: bloco, cascata, contador e desenho do gráfico), mais\n * lenta que as interações do dia a dia. Reserva em segundos (SSR, ou variável ausente).\n */\nexport const REVEAL = { enter: 0.6, stagger: 0.12, count: 1.2, draw: 0.9 }\nexport type RevealName = keyof typeof REVEAL\n\n/**\n * Curvas do globals.css (`--rendra-ease-*`). `spring` é a curva \"back\" (quique): só para a cota\n * rara de encanto. `move` desloca na tela; `drawer` é a curva de gaveta e folha.\n */\nexport const EASE: Record<'out' | 'inOut' | 'spring' | 'move' | 'drawer', Bezier> = {\n out: [0.22, 1, 0.36, 1],\n inOut: [0.65, 0, 0.35, 1],\n spring: [0.34, 1.56, 0.64, 1],\n move: [0.77, 0, 0.175, 1],\n drawer: [0.32, 0.72, 0, 1],\n}\nexport type EaseName = keyof typeof EASE\n\n/** Nome da variável CSS de cada curva (`inOut` vira `in-out`). */\nconst EASE_VAR: Record<EaseName, string> = {\n out: 'out',\n inOut: 'in-out',\n spring: 'spring',\n move: 'move',\n drawer: 'drawer',\n}\n\n/**\n * Molas no formato \"duração e quique\" (Motion). `settle` assenta sem passar do ponto (layout,\n * overlay que entra, soltura do arraste); `sheet` é a folha depois do gesto, com quique mínimo.\n * Mola não é variável CSS: mora aqui, e o app a espelha em `dampingRatio`.\n */\nexport const SPRING = {\n settle: { duration: 0.4, bounce: 0 },\n sheet: { duration: 0.3, bounce: 0.2 },\n}\n\n/** Escalas da linguagem: entrada de overlay, tooltip, ponto pequeno, toque, pop e salto curto. */\nexport const SCALE = { enter: 0.95, tooltip: 0.97, small: 0.9, press: 0.97, pop: 0.8, bump: 1.08 }\n\n/** Desfoque (px) que disfarça o cruzamento entre dois estados (troca de passo). Abaixo de 20. */\nexport const BLUR = 2\n\nexport interface MotionTokens {\n duration: Record<DurationName, number>\n reveal: Record<RevealName, number>\n ease: Record<EaseName, Bezier>\n}\n\nfunction toSeconds(value: string): number | null {\n const v = value.trim()\n const n = parseFloat(v)\n if (!Number.isFinite(n)) return null\n if (v.endsWith('ms')) return n / 1000\n if (v.endsWith('s')) return n\n return null\n}\n\n/** `cubic-bezier(a, b, c, d)` em vetor; qualquer outra coisa (`ease-in`, vazio) vira `null`. */\nfunction toBezier(value: string): Bezier | null {\n const m = /^cubic-bezier\\(([^)]+)\\)$/.exec(value.trim())\n if (!m) return null\n const parts = m[1]!.split(',').map((n) => parseFloat(n))\n if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n))) return null\n return parts as Bezier\n}\n\n/** Lê as durações e as curvas do documento; o que faltar (ou sem window) vem da reserva. */\nexport function readMotionTokens(): MotionTokens {\n const duration = { ...DURATION }\n const reveal = { ...REVEAL }\n const ease = { ...EASE }\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n const style = getComputedStyle(document.documentElement)\n for (const name of Object.keys(DURATION) as DurationName[]) {\n const read = toSeconds(style.getPropertyValue(`--rendra-duration-${name}`))\n if (read !== null) duration[name] = read\n }\n for (const name of Object.keys(REVEAL) as RevealName[]) {\n const read = toSeconds(style.getPropertyValue(`--rendra-reveal-${name}`))\n if (read !== null) reveal[name] = read\n }\n for (const name of Object.keys(EASE) as EaseName[]) {\n const read = toBezier(style.getPropertyValue(`--rendra-ease-${EASE_VAR[name]}`))\n if (read !== null) ease[name] = read\n }\n }\n return { duration, reveal, ease }\n}\n","import type { Target, TargetAndTransition, Transition } from 'motion/react'\nimport { BLUR, readMotionTokens, SCALE, SPRING, type Bezier, type MotionTokens } from './tokens'\n\n/*\n * Presets do caminho `on` (linguagem única de movimento): fade, scale/open, sheet, tooltip,\n * indicator, pop, slide, reveal, press, move, settle e stagger. Toda duração e toda curva vêm de\n * readMotionTokens (globals.css); nenhum número de duração mora neste arquivo (o presets.test.ts\n * varre o código-fonte atrás de literal). As molas e as escalas vêm de tokens.ts.\n *\n * Duas regras moram aqui:\n * - Assimetria: o que o usuário decidiu (abrir) entra no tempo `base`, e o que o sistema\n * responde ao fechar sai em `fast`, só em opacidade. Gaveta e folha saem em `base`, de volta\n * pelo lado de onde vieram.\n * - Reduzido: sem deslocamento, escala, filtro nem cascata; a opacidade usa `base` (não zero),\n * porque o esmaecimento é o que explica a mudança de estado.\n */\n\nexport interface MotionPreset {\n initial: Target\n animate: TargetAndTransition\n exit: TargetAndTransition\n transition: Transition\n}\n\n/** Toque: o alvo do `whileTap` (`undefined` no reduzido) e a transição de ida e de volta. */\nexport interface PressPreset {\n whileTap: TargetAndTransition | undefined\n transition: Transition\n}\n\nexport type SlideFrom = 'left' | 'right' | 'top' | 'bottom'\n\n/** Distância do slide: `full` (painel que entra da borda) ou `short` (conteúdo que assenta). */\nexport type SlideDistance = 'full' | 'short'\n\nconst SHORT_PX = 8\n\nexport interface Presets {\n reduced: boolean\n /** Toque do botão, do polegar e dos controles: 120 ms, `ease.out`, escala 0,97. */\n press: PressPreset\n /** Alias de `press.whileTap`, o nome antigo. Sem movimento reduzido vem `undefined`. */\n tap: TargetAndTransition | undefined\n /**\n * Salto curto de escala (célula do OTP), com a transição dentro do alvo. Estável entre\n * renders; `undefined` se reduzido.\n */\n bump: TargetAndTransition | undefined\n tokens: MotionTokens\n fade: MotionPreset\n /** Alias de `open()`: escala 0,95 com mola a partir da origem, saída rápida só em opacidade. */\n scale: MotionPreset\n /**\n * Cota rara de encanto (check do passo concluído): 0,8 -> 1 com a curva back, em `slow`. Nunca\n * em controle de uso frequente.\n */\n pop: MotionPreset\n /**\n * Indicador de controle frequente (check do Checkbox, ponto do Radio): 0,9 -> 1 com opacidade\n * em `fast`, sem quique e sem partir de zero.\n */\n indicator: MotionPreset\n slide: (from: SlideFrom, distance?: SlideDistance) => MotionPreset\n /**\n * Overlay ancorado (popover, menu, modal, painel do select). Número = escala de partida\n * (padrão 0,95); `{ y }` = entrada plana, sem escala, para a superfície em tela cheia.\n * Entra em mola criticamente amortecida (sem quique) em `base` e sai em `fast`, em opacidade.\n */\n open: (from?: number | { y: number }) => MotionPreset\n /** Gaveta e folha: entram de `from` em `slow` com `ease.drawer`, saem em `fast` pelo mesmo lado. */\n sheet: (from: SlideFrom) => MotionPreset\n /** Tooltip: escala 0,97 em `fast`; aberto em `instant-open` não anima. */\n tooltip: (instant: boolean) => MotionPreset\n /**\n * Troca de conteúdo no lugar (passo do wizard), sem esperar a saída: o que sai esmaece com\n * `blur` de 2 px em `fast`; o que entra vem de `direction` (1 avança, -1 volta), 8 px, em\n * `base`. O desfoque disfarça o cruzamento: sem ele o olho vê dois objetos trocando de lugar.\n */\n swap: (direction: 1 | -1) => MotionPreset\n /**\n * Entrada de uso único (reveal do dashboard): desloca 8 px e dura `reveal.enter`, mais lenta\n * que `slide`. Não serve a interação repetida (overlay, tab, botão).\n */\n reveal: (from: SlideFrom) => MotionPreset\n /** Deslocamento na tela (indicador, reordenação): `move` em `ease.move`. */\n move: Transition\n /** Nome antigo de `move`. */\n layout: Transition\n /** Mola sem quique: onde há gesto ou soltura (drop do kanban, folha que volta). */\n settle: Transition\n /** Mola da folha depois do arraste (quique mínimo). */\n springSheet: Transition\n /**\n * A mesma mola da folha em rigidez e amortecimento (massa 1), que é o que o arraste do Motion\n * (`dragTransition`) pede para a volta à origem: rigidez = (2π / duração)², amortecimento =\n * 2 (1 - quique) raiz(rigidez).\n */\n sheetBounce: { bounceStiffness: number; bounceDamping: number }\n /** Atraso de entrada do item `index`, limitado a `limit` itens (padrão 8: 480 ms). */\n stagger: (index: number, limit?: number) => Transition\n /** Atraso do bloco `index` no reveal (passo `reveal.stagger`), limitado a `limit` blocos. */\n staggerReveal: (index: number, limit?: number) => Transition\n}\n\n/** Mola em \"duração e quique\" para rigidez e amortecimento (massa 1). */\nfunction springToBounce({ duration, bounce }: { duration: number; bounce: number }) {\n const stiffness = ((2 * Math.PI) / duration) ** 2\n return {\n bounceStiffness: Math.round(stiffness),\n bounceDamping: Math.round(2 * (1 - bounce) * Math.sqrt(stiffness)),\n }\n}\n\nexport function createPresets(tokens: MotionTokens, reduced: boolean): Presets {\n const { duration, reveal, ease } = tokens\n const base: Transition = { duration: duration.base, ease: ease.out }\n const fastOut: Transition = { duration: duration.fast, ease: ease.out }\n const settle: Transition = { type: 'spring', ...SPRING.settle }\n const enter: Transition = {\n type: 'spring',\n duration: duration.base,\n bounce: SPRING.settle.bounce,\n }\n\n /** O que sobra sob \"reduzir movimento\": só opacidade, em `base`. */\n const flat = (): MotionPreset => ({\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: base,\n })\n const make = (initial: Target, animate: Target, time: number, curve = ease.out): MotionPreset =>\n reduced\n ? flat()\n : {\n initial,\n animate,\n exit: initial,\n transition: { duration: time, ease: curve },\n }\n\n const offset = (from: SlideFrom, distance: SlideDistance): Target => {\n const far = distance === 'full' ? '100%' : SHORT_PX\n const sign = from === 'left' || from === 'top' ? -1 : 1\n const value = typeof far === 'string' ? `${sign * 100}%` : sign * far\n return from === 'left' || from === 'right' ? { x: value, opacity: 0 } : { y: value, opacity: 0 }\n }\n const settled = (initial: Target): Target => ({\n opacity: 1,\n ...(initial.x !== undefined ? { x: 0 } : {}),\n ...(initial.y !== undefined ? { y: 0 } : {}),\n })\n\n const fade: MotionPreset = reduced\n ? flat()\n : {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0, transition: fastOut },\n transition: base,\n }\n\n const open = (from: number | { y: number } = SCALE.enter): MotionPreset => {\n if (reduced) return flat()\n const initial: Target =\n typeof from === 'number' ? { opacity: 0, scale: from } : { opacity: 0, y: from.y }\n const to: Target = typeof from === 'number' ? { opacity: 1, scale: 1 } : { opacity: 1, y: 0 }\n return {\n initial,\n animate: { ...to, transition: enter },\n exit: { opacity: 0, transition: fastOut },\n transition: enter,\n }\n }\n\n const sheet = (from: SlideFrom): MotionPreset => {\n if (reduced) return flat()\n const sign = from === 'left' || from === 'top' ? -1 : 1\n const axis = from === 'left' || from === 'right' ? 'x' : 'y'\n const away = { [axis]: `${sign * 100}%` }\n return {\n initial: away,\n animate: { [axis]: 0 },\n exit: { ...away, transition: { duration: duration.fast, ease: ease.drawer } },\n transition: { duration: duration.slow, ease: ease.drawer },\n }\n }\n\n const tooltip = (instant: boolean): MotionPreset => {\n if (reduced) return instant ? { ...flat(), transition: { duration: 0 } } : flat()\n return {\n initial: { opacity: 0, scale: SCALE.tooltip },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, transition: fastOut },\n transition: instant ? { duration: 0 } : fastOut,\n }\n }\n\n const blurred = `blur(${BLUR}px)`\n const swap = (direction: 1 | -1): MotionPreset => {\n if (reduced) return flat()\n return {\n initial: { opacity: 0, x: direction * SHORT_PX, filter: blurred },\n animate: { opacity: 1, x: 0, filter: 'blur(0px)', transition: base },\n exit: { opacity: 0, filter: blurred, transition: fastOut },\n transition: base,\n }\n }\n\n const indicatorInitial: Target = { opacity: 0, scale: SCALE.small }\n const press: PressPreset = {\n whileTap: reduced ? undefined : { scale: SCALE.press },\n transition: { duration: duration.press, ease: ease.out },\n }\n const move: Transition = reduced ? { duration: 0 } : { duration: duration.move, ease: ease.move }\n\n return {\n reduced,\n press,\n tap: press.whileTap,\n bump: reduced ? undefined : { scale: [SCALE.bump, 1], transition: fastOut },\n tokens,\n fade,\n scale: open(),\n pop: make(\n { opacity: 0, scale: SCALE.pop },\n { opacity: 1, scale: 1 },\n duration.slow,\n ease.spring,\n ),\n indicator: reduced\n ? flat()\n : {\n initial: indicatorInitial,\n animate: { opacity: 1, scale: 1 },\n exit: indicatorInitial,\n transition: fastOut,\n },\n slide: (from, distance = 'full') => {\n const initial = offset(from, distance)\n return make(initial, settled(initial), distance === 'full' ? duration.slow : duration.base)\n },\n open,\n sheet,\n tooltip,\n swap,\n reveal: (from) => {\n const initial = offset(from, 'short')\n return make(initial, settled(initial), reveal.enter)\n },\n move,\n layout: move,\n settle: reduced ? { duration: 0 } : settle,\n springSheet: reduced ? { duration: 0 } : { type: 'spring', ...SPRING.sheet },\n sheetBounce: springToBounce(SPRING.sheet),\n stagger: (index, limit = 8) => ({\n delay: reduced ? 0 : Math.min(index, limit) * (duration.fast / 2),\n }),\n staggerReveal: (index, limit = 8) => ({\n delay: reduced ? 0 : Math.min(index, limit) * reveal.stagger,\n }),\n }\n}\n\n/** Curva no formato do recharts: `cubic-bezier(a,b,c,d)`, sem espaços. */\nexport function toCubicBezier([\n a,\n b,\n c,\n d,\n]: Bezier): `cubic-bezier(${number},${number},${number},${number})` {\n return `cubic-bezier(${a},${b},${c},${d})`\n}\n\n/** Presets com os tokens lidos agora do documento. */\nexport function presetsFromDocument(reduced: boolean): Presets {\n return createPresets(readMotionTokens(), reduced)\n}\n","import { useMemo, useSyncExternalStore } from 'react'\nimport { getReducedMotion, subscribeReducedMotion } from '@/hooks/use-reduced-motion'\nimport { useMotionMode } from './motion-context'\nimport { createPresets, presetsFromDocument, type Presets } from './presets'\nimport { DURATION, EASE, REVEAL } from './tokens'\n\n/** Em `off` ninguém lê o documento nem assina o matchMedia: um objeto único e inerte. */\nconst OFF_PRESETS = createPresets({ duration: DURATION, reveal: REVEAL, ease: EASE }, false)\nconst noSubscribe = () => () => {}\nconst never = () => false\n\n/**\n * Presets do motion para o componente. A preferência \"reduzir movimento\" vem do mesmo\n * `matchMedia` do hook do projeto (`use-reduced-motion.ts`: Spinner, Progress), a fonte única,\n * reativa e testável, sem `MotionConfig reducedMotion` somando por cima. Só em `on` a\n * preferência é assinada e os tokens lidos do documento; em `off` o custo é zero.\n */\nexport function useMotionPresets(): Presets {\n const on = useMotionMode() === 'on'\n const reduced = useSyncExternalStore(\n on ? subscribeReducedMotion : noSubscribe,\n on ? getReducedMotion : never,\n never,\n )\n return useMemo(() => (on ? presetsFromDocument(reduced) : OFF_PRESETS), [on, reduced])\n}\n"],"mappings":";;;;;;;;AAgBA,IAAa,WAAW;CACtB,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;AACT;;;;;AAOA,IAAa,SAAS;CAAE,OAAO;CAAK,SAAS;CAAM,OAAO;CAAK,MAAM;AAAI;;;;;AAOzE,IAAa,OAAuE;CAClF,KAAK;EAAC;EAAM;EAAG;EAAM;CAAC;CACtB,OAAO;EAAC;EAAM;EAAG;EAAM;CAAC;CACxB,QAAQ;EAAC;EAAM;EAAM;EAAM;CAAC;CAC5B,MAAM;EAAC;EAAM;EAAG;EAAO;CAAC;CACxB,QAAQ;EAAC;EAAM;EAAM;EAAG;CAAC;AAC3B;;AAIA,IAAM,WAAqC;CACzC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;AACV;;;;;;AAOA,IAAa,SAAS;CACpB,QA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,aAAc,CAAC,IAAI,OAAO,CAAC;AACvF"}
1
+ {"version":3,"file":"use-motion-presets-D3ww1oJX.js","names":[],"sources":["../src/lib/motion/tokens.ts","../src/lib/motion/presets.ts","../src/lib/motion/use-motion-presets.ts"],"sourcesContent":["/*\n * Durações e curvas do motion (linguagem única, web e app). A fonte é o globals.css:\n * --rendra-duration-* bloco :root fora de camada (vai para o dist/tokens.css do pacote);\n * --rendra-ease-* no mesmo bloco, então o host as sobrescreve; o @theme guarda os nomes\n * do Tailwind (--ease-out, --ease-move...) como alias delas.\n * As constantes daqui são a reserva em tempo de execução (SSR, variável ausente ou inválida), e\n * tokens.test.ts confere que elas batem com o globals.css. Valores em segundos e vetores de 4\n * números, o formato que o Motion aceita.\n */\n\nexport type Bezier = [number, number, number, number]\n\n/**\n * Reserva das durações, em segundos (SSR, ou variável ausente).\n * `press` e `fast` valem o mesmo (120 ms) com propósitos diferentes: o toque e a saída de overlay.\n */\nexport const DURATION = {\n press: 0.12,\n hover: 0.15,\n fast: 0.12,\n base: 0.2,\n move: 0.25,\n slow: 0.32,\n draw: 0.42,\n pulse: 1,\n}\nexport type DurationName = keyof typeof DURATION\n\n/**\n * Reveal: entrada de uso único (dashboard: bloco, cascata, contador e desenho do gráfico), mais\n * lenta que as interações do dia a dia. Reserva em segundos (SSR, ou variável ausente).\n */\nexport const REVEAL = { enter: 0.6, stagger: 0.12, count: 1.2, draw: 0.9 }\nexport type RevealName = keyof typeof REVEAL\n\n/**\n * Curvas do globals.css (`--rendra-ease-*`). `spring` é a curva \"back\" (quique): só para a cota\n * rara de encanto. `move` desloca na tela; `drawer` é a curva de gaveta e folha.\n */\nexport const EASE: Record<'out' | 'inOut' | 'spring' | 'move' | 'drawer', Bezier> = {\n out: [0.22, 1, 0.36, 1],\n inOut: [0.65, 0, 0.35, 1],\n spring: [0.34, 1.56, 0.64, 1],\n move: [0.77, 0, 0.175, 1],\n drawer: [0.32, 0.72, 0, 1],\n}\nexport type EaseName = keyof typeof EASE\n\n/** Nome da variável CSS de cada curva (`inOut` vira `in-out`). */\nconst EASE_VAR: Record<EaseName, string> = {\n out: 'out',\n inOut: 'in-out',\n spring: 'spring',\n move: 'move',\n drawer: 'drawer',\n}\n\n/**\n * Molas no formato \"duração e quique\" (Motion). `settle` assenta sem passar do ponto (layout,\n * overlay que entra, soltura do arraste); `sheet` é a folha depois do gesto, com quique mínimo.\n * Mola não é variável CSS: mora aqui, e o app a espelha em `dampingRatio`.\n */\nexport const SPRING = {\n settle: { duration: 0.4, bounce: 0 },\n sheet: { duration: 0.3, bounce: 0.2 },\n}\n\n/** Escalas da linguagem: entrada de overlay, tooltip, ponto pequeno, toque, pop e salto curto. */\nexport const SCALE = { enter: 0.95, tooltip: 0.97, small: 0.9, press: 0.97, pop: 0.8, bump: 1.08 }\n\n/** Desfoque (px) que disfarça o cruzamento entre dois estados (troca de passo). Abaixo de 20. */\nexport const BLUR = 2\n\nexport interface MotionTokens {\n duration: Record<DurationName, number>\n reveal: Record<RevealName, number>\n ease: Record<EaseName, Bezier>\n}\n\nfunction toSeconds(value: string): number | null {\n const v = value.trim()\n const n = parseFloat(v)\n if (!Number.isFinite(n)) return null\n if (v.endsWith('ms')) return n / 1000\n if (v.endsWith('s')) return n\n return null\n}\n\n/** `cubic-bezier(a, b, c, d)` em vetor; qualquer outra coisa (`ease-in`, vazio) vira `null`. */\nfunction toBezier(value: string): Bezier | null {\n const m = /^cubic-bezier\\(([^)]+)\\)$/.exec(value.trim())\n if (!m) return null\n const parts = m[1]!.split(',').map((n) => parseFloat(n))\n if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n))) return null\n return parts as Bezier\n}\n\n/** Lê as durações e as curvas do documento; o que faltar (ou sem window) vem da reserva. */\nexport function readMotionTokens(): MotionTokens {\n const duration = { ...DURATION }\n const reveal = { ...REVEAL }\n const ease = { ...EASE }\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n const style = getComputedStyle(document.documentElement)\n for (const name of Object.keys(DURATION) as DurationName[]) {\n const read = toSeconds(style.getPropertyValue(`--rendra-duration-${name}`))\n if (read !== null) duration[name] = read\n }\n for (const name of Object.keys(REVEAL) as RevealName[]) {\n const read = toSeconds(style.getPropertyValue(`--rendra-reveal-${name}`))\n if (read !== null) reveal[name] = read\n }\n for (const name of Object.keys(EASE) as EaseName[]) {\n const read = toBezier(style.getPropertyValue(`--rendra-ease-${EASE_VAR[name]}`))\n if (read !== null) ease[name] = read\n }\n }\n return { duration, reveal, ease }\n}\n","import type { Target, TargetAndTransition, Transition } from 'motion/react'\nimport { BLUR, readMotionTokens, SCALE, SPRING, type Bezier, type MotionTokens } from './tokens'\n\n/*\n * Presets do caminho `on` (linguagem única de movimento): fade, scale/open, sheet, tooltip,\n * indicator, pop, slide, reveal, press, move, settle e stagger. Toda duração e toda curva vêm de\n * readMotionTokens (globals.css); nenhum número de duração mora neste arquivo (o presets.test.ts\n * varre o código-fonte atrás de literal). As molas e as escalas vêm de tokens.ts.\n *\n * Duas regras moram aqui:\n * - Assimetria: o que o usuário decidiu (abrir) entra no tempo `base`, e o que o sistema\n * responde ao fechar sai em `fast`, só em opacidade. Gaveta e folha saem em `base`, de volta\n * pelo lado de onde vieram.\n * - Reduzido: sem deslocamento, escala, filtro nem cascata; a opacidade usa `base` (não zero),\n * porque o esmaecimento é o que explica a mudança de estado.\n */\n\nexport interface MotionPreset {\n initial: Target\n animate: TargetAndTransition\n exit: TargetAndTransition\n transition: Transition\n}\n\n/** Toque: o alvo do `whileTap` (`undefined` no reduzido) e a transição de ida e de volta. */\nexport interface PressPreset {\n whileTap: TargetAndTransition | undefined\n transition: Transition\n}\n\nexport type SlideFrom = 'left' | 'right' | 'top' | 'bottom'\n\n/** Distância do slide: `full` (painel que entra da borda) ou `short` (conteúdo que assenta). */\nexport type SlideDistance = 'full' | 'short'\n\nconst SHORT_PX = 8\n\nexport interface Presets {\n reduced: boolean\n /** Toque do botão, do polegar e dos controles: 120 ms, `ease.out`, escala 0,97. */\n press: PressPreset\n /** Alias de `press.whileTap`, o nome antigo. Sem movimento reduzido vem `undefined`. */\n tap: TargetAndTransition | undefined\n /**\n * Salto curto de escala (célula do OTP), com a transição dentro do alvo. Estável entre\n * renders; `undefined` se reduzido.\n */\n bump: TargetAndTransition | undefined\n tokens: MotionTokens\n fade: MotionPreset\n /** Alias de `open()`: escala 0,95 com mola a partir da origem, saída rápida só em opacidade. */\n scale: MotionPreset\n /**\n * Cota rara de encanto (check do passo concluído): 0,8 -> 1 com a curva back, em `slow`. Nunca\n * em controle de uso frequente.\n */\n pop: MotionPreset\n /**\n * Indicador de controle frequente (check do Checkbox, ponto do Radio): 0,9 -> 1 com opacidade\n * em `fast`, sem quique e sem partir de zero.\n */\n indicator: MotionPreset\n slide: (from: SlideFrom, distance?: SlideDistance) => MotionPreset\n /**\n * Overlay ancorado (popover, menu, modal, painel do select). Número = escala de partida\n * (padrão 0,95); `{ y }` = entrada plana, sem escala, para a superfície em tela cheia.\n * Entra em mola criticamente amortecida (sem quique) em `base` e sai em `fast`, em opacidade.\n */\n open: (from?: number | { y: number }) => MotionPreset\n /** Gaveta e folha: entram de `from` em `slow` com `ease.drawer`, saem em `fast` pelo mesmo lado. */\n sheet: (from: SlideFrom) => MotionPreset\n /** Tooltip: escala 0,97 em `fast`; aberto em `instant-open` não anima. */\n tooltip: (instant: boolean) => MotionPreset\n /**\n * Troca de conteúdo no lugar (passo do wizard), sem esperar a saída: o que sai esmaece com\n * `blur` de 2 px em `fast`; o que entra vem de `direction` (1 avança, -1 volta), 8 px, em\n * `base`. O desfoque disfarça o cruzamento: sem ele o olho vê dois objetos trocando de lugar.\n */\n swap: (direction: 1 | -1) => MotionPreset\n /**\n * Entrada de uso único (reveal do dashboard): desloca 8 px e dura `reveal.enter`, mais lenta\n * que `slide`. Não serve a interação repetida (overlay, tab, botão).\n */\n reveal: (from: SlideFrom) => MotionPreset\n /** Deslocamento na tela (indicador, reordenação): `move` em `ease.move`. */\n move: Transition\n /** Nome antigo de `move`. */\n layout: Transition\n /** Mola sem quique: onde há gesto ou soltura (drop do kanban, folha que volta). */\n settle: Transition\n /** Mola da folha depois do arraste (quique mínimo). */\n springSheet: Transition\n /**\n * A mesma mola da folha em rigidez e amortecimento (massa 1), que é o que o arraste do Motion\n * (`dragTransition`) pede para a volta à origem: rigidez = (2π / duração)², amortecimento =\n * 2 (1 - quique) raiz(rigidez).\n */\n sheetBounce: { bounceStiffness: number; bounceDamping: number }\n /** Atraso de entrada do item `index`, limitado a `limit` itens (padrão 8: 480 ms). */\n stagger: (index: number, limit?: number) => Transition\n /** Atraso do bloco `index` no reveal (passo `reveal.stagger`), limitado a `limit` blocos. */\n staggerReveal: (index: number, limit?: number) => Transition\n}\n\n/** Mola em \"duração e quique\" para rigidez e amortecimento (massa 1). */\nfunction springToBounce({ duration, bounce }: { duration: number; bounce: number }) {\n const stiffness = ((2 * Math.PI) / duration) ** 2\n return {\n bounceStiffness: Math.round(stiffness),\n bounceDamping: Math.round(2 * (1 - bounce) * Math.sqrt(stiffness)),\n }\n}\n\nexport function createPresets(tokens: MotionTokens, reduced: boolean): Presets {\n const { duration, reveal, ease } = tokens\n const base: Transition = { duration: duration.base, ease: ease.out }\n const fastOut: Transition = { duration: duration.fast, ease: ease.out }\n const settle: Transition = { type: 'spring', ...SPRING.settle }\n const enter: Transition = {\n type: 'spring',\n duration: duration.base,\n bounce: SPRING.settle.bounce,\n }\n\n /** O que sobra sob \"reduzir movimento\": só opacidade, em `base`. */\n const flat = (): MotionPreset => ({\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0 },\n transition: base,\n })\n const make = (initial: Target, animate: Target, time: number, curve = ease.out): MotionPreset =>\n reduced\n ? flat()\n : {\n initial,\n animate,\n exit: initial,\n transition: { duration: time, ease: curve },\n }\n\n const offset = (from: SlideFrom, distance: SlideDistance): Target => {\n const far = distance === 'full' ? '100%' : SHORT_PX\n const sign = from === 'left' || from === 'top' ? -1 : 1\n const value = typeof far === 'string' ? `${sign * 100}%` : sign * far\n return from === 'left' || from === 'right' ? { x: value, opacity: 0 } : { y: value, opacity: 0 }\n }\n const settled = (initial: Target): Target => ({\n opacity: 1,\n ...(initial.x !== undefined ? { x: 0 } : {}),\n ...(initial.y !== undefined ? { y: 0 } : {}),\n })\n\n const fade: MotionPreset = reduced\n ? flat()\n : {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: { opacity: 0, transition: fastOut },\n transition: base,\n }\n\n const open = (from: number | { y: number } = SCALE.enter): MotionPreset => {\n if (reduced) return flat()\n const initial: Target =\n typeof from === 'number' ? { opacity: 0, scale: from } : { opacity: 0, y: from.y }\n const to: Target = typeof from === 'number' ? { opacity: 1, scale: 1 } : { opacity: 1, y: 0 }\n return {\n initial,\n animate: { ...to, transition: enter },\n exit: { opacity: 0, transition: fastOut },\n transition: enter,\n }\n }\n\n const sheet = (from: SlideFrom): MotionPreset => {\n if (reduced) return flat()\n const sign = from === 'left' || from === 'top' ? -1 : 1\n const axis = from === 'left' || from === 'right' ? 'x' : 'y'\n const away = { [axis]: `${sign * 100}%` }\n return {\n initial: away,\n animate: { [axis]: 0 },\n exit: { ...away, transition: { duration: duration.fast, ease: ease.drawer } },\n transition: { duration: duration.slow, ease: ease.drawer },\n }\n }\n\n const tooltip = (instant: boolean): MotionPreset => {\n if (reduced) return instant ? { ...flat(), transition: { duration: 0 } } : flat()\n return {\n initial: { opacity: 0, scale: SCALE.tooltip },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, transition: fastOut },\n transition: instant ? { duration: 0 } : fastOut,\n }\n }\n\n const blurred = `blur(${BLUR}px)`\n const swap = (direction: 1 | -1): MotionPreset => {\n if (reduced) return flat()\n return {\n initial: { opacity: 0, x: direction * SHORT_PX, filter: blurred },\n animate: { opacity: 1, x: 0, filter: 'blur(0px)', transition: base },\n exit: { opacity: 0, filter: blurred, transition: fastOut },\n transition: base,\n }\n }\n\n const indicatorInitial: Target = { opacity: 0, scale: SCALE.small }\n const press: PressPreset = {\n whileTap: reduced ? undefined : { scale: SCALE.press },\n transition: { duration: duration.press, ease: ease.out },\n }\n const move: Transition = reduced ? { duration: 0 } : { duration: duration.move, ease: ease.move }\n\n return {\n reduced,\n press,\n tap: press.whileTap,\n bump: reduced ? undefined : { scale: [SCALE.bump, 1], transition: fastOut },\n tokens,\n fade,\n scale: open(),\n pop: make(\n { opacity: 0, scale: SCALE.pop },\n { opacity: 1, scale: 1 },\n duration.slow,\n ease.spring,\n ),\n indicator: reduced\n ? flat()\n : {\n initial: indicatorInitial,\n animate: { opacity: 1, scale: 1 },\n exit: indicatorInitial,\n transition: fastOut,\n },\n slide: (from, distance = 'full') => {\n const initial = offset(from, distance)\n return make(initial, settled(initial), distance === 'full' ? duration.slow : duration.base)\n },\n open,\n sheet,\n tooltip,\n swap,\n reveal: (from) => {\n const initial = offset(from, 'short')\n return make(initial, settled(initial), reveal.enter)\n },\n move,\n layout: move,\n settle: reduced ? { duration: 0 } : settle,\n springSheet: reduced ? { duration: 0 } : { type: 'spring', ...SPRING.sheet },\n sheetBounce: springToBounce(SPRING.sheet),\n stagger: (index, limit = 8) => ({\n delay: reduced ? 0 : Math.min(index, limit) * (duration.fast / 2),\n }),\n staggerReveal: (index, limit = 8) => ({\n delay: reduced ? 0 : Math.min(index, limit) * reveal.stagger,\n }),\n }\n}\n\n/** Curva no formato do recharts: `cubic-bezier(a,b,c,d)`, sem espaços. */\nexport function toCubicBezier([\n a,\n b,\n c,\n d,\n]: Bezier): `cubic-bezier(${number},${number},${number},${number})` {\n return `cubic-bezier(${a},${b},${c},${d})`\n}\n\n/** Presets com os tokens lidos agora do documento. */\nexport function presetsFromDocument(reduced: boolean): Presets {\n return createPresets(readMotionTokens(), reduced)\n}\n","import { useMemo, useSyncExternalStore } from 'react'\nimport { getReducedMotion, subscribeReducedMotion } from '@/hooks/use-reduced-motion'\nimport { useMotionMode } from './motion-context'\nimport { createPresets, presetsFromDocument, type Presets } from './presets'\nimport { DURATION, EASE, REVEAL } from './tokens'\n\n/** Em `off` ninguém lê o documento nem assina o matchMedia: um objeto único e inerte. */\nconst OFF_PRESETS = createPresets({ duration: DURATION, reveal: REVEAL, ease: EASE }, false)\nconst noSubscribe = () => () => {}\nconst never = () => false\n\n/**\n * Presets do motion para o componente. A preferência \"reduzir movimento\" vem do mesmo\n * `matchMedia` do hook do projeto (`use-reduced-motion.ts`: Spinner, Progress), a fonte única,\n * reativa e testável, sem `MotionConfig reducedMotion` somando por cima. Só em `on` a\n * preferência é assinada e os tokens lidos do documento; em `off` o custo é zero.\n */\nexport function useMotionPresets(): Presets {\n const on = useMotionMode() === 'on'\n const reduced = useSyncExternalStore(\n on ? subscribeReducedMotion : noSubscribe,\n on ? getReducedMotion : never,\n never,\n )\n return useMemo(() => (on ? presetsFromDocument(reduced) : OFF_PRESETS), [on, reduced])\n}\n"],"mappings":";;;;;;;;AAgBA,IAAa,WAAW;CACtB,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;AACT;;;;;AAOA,IAAa,SAAS;CAAE,OAAO;CAAK,SAAS;CAAM,OAAO;CAAK,MAAM;AAAI;;;;;AAOzE,IAAa,OAAuE;CAClF,KAAK;EAAC;EAAM;EAAG;EAAM;CAAC;CACtB,OAAO;EAAC;EAAM;EAAG;EAAM;CAAC;CACxB,QAAQ;EAAC;EAAM;EAAM;EAAM;CAAC;CAC5B,MAAM;EAAC;EAAM;EAAG;EAAO;CAAC;CACxB,QAAQ;EAAC;EAAM;EAAM;EAAG;CAAC;AAC3B;;AAIA,IAAM,WAAqC;CACzC,KAAK;CACL,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;AACV;;;;;;AAOA,IAAa,SAAS;CACpB,QAAQ;EAAE,UAAU;EAAK,QAAQ;CAAE;CACnC,OAAO;EAAE,UAAU;EAAK,QAAQ;CAAI;AACtC;;AAGA,IAAa,QAAQ;CAAE,OAAO;CAAM,SAAS;CAAM,OAAO;CAAK,OAAO;CAAM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
+ /*! Rendra Design System v2.7.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
2
+ import { t as cn } from "./cn-B0N3Pek0.js";
3
3
  import { GripVertical } from "lucide-react";
4
4
  import { useMemo, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rendra-ui/web",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "type": "module",
5
5
  "description": "Rendra, design system e boilerplate React (Vite, TypeScript, Tailwind v4, Radix), com CLI de catálogo, auditoria e troca de variante.",
6
6
  "author": {
@@ -64,6 +64,14 @@
64
64
  "types": "./dist/types/chart.d.ts",
65
65
  "import": "./dist/chart.js"
66
66
  },
67
+ "./motion": {
68
+ "types": "./dist/types/motion.d.ts",
69
+ "import": "./dist/motion.js"
70
+ },
71
+ "./flow": {
72
+ "types": "./dist/types/flow.d.ts",
73
+ "import": "./dist/flow.js"
74
+ },
67
75
  "./widget-grid": {
68
76
  "types": "./dist/types/widget-grid.d.ts",
69
77
  "import": "./dist/widget-grid.js"
@@ -94,6 +102,8 @@
94
102
  "build": "tsc -b && vite build",
95
103
  "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json && node scripts/fix-dts-aliases.mjs && node scripts/build-lib.mjs",
96
104
  "verify:pack": "node scripts/verify-pack.mjs",
105
+ "verify:bundle:app": "node scripts/bundle-inicial.mjs --verificar --app dist",
106
+ "verify:bundle:lib": "node scripts/bundle-inicial.mjs --verificar --lib dist",
97
107
  "preview": "vite preview",
98
108
  "typecheck": "tsc -b",
99
109
  "lint": "eslint .",
@@ -115,6 +125,8 @@
115
125
  "test:visual": "playwright test --project=visual",
116
126
  "test:visual:update": "playwright test --project=visual --update-snapshots",
117
127
  "test:motion": "playwright test --project=motion --project=estados",
128
+ "test:lazy": "playwright test --project=lazy",
129
+ "test:flow": "playwright test --project=flow",
118
130
  "test:css-layers": "playwright test --project=css-layers",
119
131
  "test:site": "playwright test -c playwright.site.config.ts",
120
132
  "registry:build": "node scripts/build-registry.mjs",
@@ -131,6 +143,7 @@
131
143
  "@tiptap/pm": "^3.31.3",
132
144
  "@tiptap/react": "^3.31.3",
133
145
  "@tiptap/starter-kit": "^3.31.3",
146
+ "@xyflow/react": "^12.12.0",
134
147
  "class-variance-authority": "^0.7.1",
135
148
  "clsx": "^2.1.1",
136
149
  "cmdk": "^1.1.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"button-BzJgR2gH.js","names":[],"sources":["../src/components/ui/spinner.tsx","../src/lib/motion/native-events.ts","../src/components/ui/button.tsx"],"sourcesContent":["import { Loader2 } from 'lucide-react'\nimport { usePrefersReducedMotion } from '@/hooks/use-reduced-motion'\nimport { cn } from '@/lib/cn'\n\n/*\n * Indicador de carregamento único do sistema (A17 do plano da v2). Substitui qualquer\n * `Loader2 animate-spin` solto em Button, Input e Select. Sem label é decorativo\n * (aria-hidden); com label, anuncia o carregamento a quem usa leitor de tela. Para de girar\n * quando o sistema pede menos movimento.\n */\n\nexport interface SpinnerProps {\n size?: 'sm' | 'md' | 'lg'\n /** Nome do que está carregando. Vazio (padrão): decorativo, sem anúncio de leitor de tela. */\n label?: string\n className?: string\n}\n\nconst sizeClass: Record<NonNullable<SpinnerProps['size']>, string> = {\n sm: 'size-icon-sm',\n md: 'size-icon-md',\n lg: 'size-icon-lg',\n}\n\nexport function Spinner({ size = 'md', label, className }: SpinnerProps) {\n const reduced = usePrefersReducedMotion()\n const icon = (\n <Loader2 aria-hidden className={cn(sizeClass[size], reduced ? '' : 'animate-spin')} />\n )\n\n if (!label) {\n return (\n <span data-rendra=\"SPIN-001\" aria-hidden className={cn('inline-flex', className)}>\n {icon}\n </span>\n )\n }\n\n return (\n <span\n data-rendra=\"SPIN-001\"\n role=\"status\"\n className={cn('inline-flex items-center gap-2', className)}\n >\n {icon}\n <span className=\"sr-only\">{label}</span>\n </span>\n )\n}\n","/*\n * O Motion toma `onDrag`, `onDragStart`, `onDragEnd` e `onAnimationStart` para os gestos e\n * animações dele: tira essas props do DOM e as tipa com outra assinatura. Em `m.button` e\n * `m.li`, o consumidor que passa o evento nativo (HTML5 drag, animationstart do CSS) o perderia.\n * Estes ajudantes separam essas chaves das props e as ligam como ouvintes nativos no elemento.\n */\n\nconst NATIVE_EVENTS = {\n onDrag: 'drag',\n onDragStart: 'dragstart',\n onDragEnd: 'dragend',\n onAnimationStart: 'animationstart',\n} as const\n\ntype NativeKey = keyof typeof NATIVE_EVENTS\ntype Handler = ((event: never) => void) | undefined\n\n/** Separa as quatro chaves em conflito; o resto segue para o elemento do Motion. */\nexport function splitNativeEvents<P extends object>(props: P) {\n const native: Partial<Record<NativeKey, Handler>> = {}\n const rest: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(props)) {\n if (key in NATIVE_EVENTS) native[key as NativeKey] = value as Handler\n else rest[key] = value\n }\n return { native, rest: rest as Omit<P, NativeKey> }\n}\n\n/** Liga os manipuladores como ouvintes nativos. Devolve a função que os remove. */\nexport function bindNativeEvents(el: HTMLElement, native: Partial<Record<NativeKey, Handler>>) {\n const bound: [string, EventListener][] = []\n for (const [key, type] of Object.entries(NATIVE_EVENTS)) {\n const handler = native[key as NativeKey]\n if (!handler) continue\n const listener = ((event: Event) => handler(event as never)) as EventListener\n el.addEventListener(type, listener)\n bound.push([type, listener])\n }\n return () => bound.forEach(([type, listener]) => el.removeEventListener(type, listener))\n}\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { m } from 'motion/react'\nimport { Slot } from 'radix-ui'\nimport { forwardRef, type ButtonHTMLAttributes, type ReactNode, type Ref } from 'react'\nimport { resolveCatalogCode } from '@/catalog/components'\nimport { Spinner } from '@/components/ui/spinner'\nimport { cn } from '@/lib/cn'\nimport { useMotionMode, useMotionPresets } from '@/lib/motion'\nimport { bindNativeEvents, splitNativeEvents } from '@/lib/motion/native-events'\n\n/**\n * Botão único do sistema. Variantes, tamanho, ícone, só ícone, carregamento e\n * largura total são props: nunca crie outro arquivo de botão.\n * Altura vem de h-control-*: 44px ou mais no mobile, compacta a partir de md.\n */\nexport const buttonVariants = cva(\n 'inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-control font-medium whitespace-nowrap transition-[color,background-color,border-color,box-shadow,transform] duration-(--rendra-duration-press) ease-out select-none active:scale-97 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 motion-reduce:active:scale-100 [&_svg]:pointer-events-none [&_svg]:shrink-0',\n {\n variants: {\n variant: {\n // Hover troca para a cor de hover da marca e eleva um nível; pressionar comprime.\n primary:\n 'bg-primary text-primary-foreground shadow-sm hover:bg-primary-hover hover:text-primary-hover-foreground hover:shadow-md active:bg-primary-hover active:text-primary-hover-foreground active:shadow-sm',\n secondary:\n 'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary-hover hover:text-secondary-hover-foreground hover:shadow-md active:bg-secondary-hover active:text-secondary-hover-foreground active:shadow-sm',\n outline:\n 'border border-input bg-card text-foreground hover:border-primary hover:bg-primary-soft hover:text-primary-soft-foreground active:bg-primary-soft',\n // Transparentes: no hover, assumem a cor primária do template.\n ghost:\n 'text-foreground hover:bg-primary-soft hover:text-primary-soft-foreground active:bg-primary-soft',\n destructive:\n 'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive-hover hover:shadow-md active:bg-destructive-hover active:shadow-sm',\n link: 'min-h-touch min-w-touch text-primary-text underline-offset-4 hover:text-primary-hover hover:underline md:min-h-0 md:min-w-0',\n },\n size: {\n sm: 'h-control-sm px-3 text-sm [&_svg]:size-icon-sm',\n md: 'h-control-md px-4 text-sm [&_svg]:size-icon-sm',\n lg: 'h-control-lg px-6 text-base [&_svg]:size-icon-md',\n },\n iconOnly: { true: 'px-0', false: '' },\n fullWidth: { true: 'w-full', false: '' },\n },\n compoundVariants: [\n { iconOnly: true, size: 'sm', className: 'w-control-sm' },\n { iconOnly: true, size: 'md', className: 'w-control-md' },\n { iconOnly: true, size: 'lg', className: 'w-control-lg' },\n { variant: 'link', className: 'h-auto px-0' },\n ],\n defaultVariants: { variant: 'primary', size: 'md', iconOnly: false, fullWidth: false },\n },\n)\n\ntype Variants = VariantProps<typeof buttonVariants>\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>, Omit<Variants, 'iconOnly' | 'fullWidth'> {\n /** Ícone à esquerda do texto (ou o próprio conteúdo, com iconOnly). */\n icon?: ReactNode\n /** Ícone à direita do texto. */\n iconRight?: ReactNode\n /** Botão só com ícone: quadrado, e aria-label passa a ser obrigatório. */\n iconOnly?: boolean\n /** Mostra indicador, bloqueia cliques e marca aria-busy. */\n loading?: boolean\n /** Ocupa toda a largura do contêiner. */\n fullWidth?: boolean\n /** Renderiza o filho (ex.: <Link>) com a aparência de botão. */\n asChild?: boolean\n}\n\ntype MotionButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & {\n children: ReactNode\n}\n\n/**\n * O botão de `on`: `m.button` com toque discreto (whileTap). Os eventos que o Motion toma\n * (`onDrag*` e `onAnimationStart`) saem das props dele e viram ouvintes nativos no elemento,\n * então o consumidor continua recebendo o evento. Só existe em `on`; por isso os hooks de motion\n * moram aqui e o `off` não paga nada.\n */\nconst MotionButton = forwardRef<HTMLButtonElement, MotionButtonProps>(\n function MotionButton(props, ref) {\n const presets = useMotionPresets()\n const { native, rest } = splitNativeEvents(props)\n const attach = (el: HTMLButtonElement | null) => {\n assignRef(ref, el)\n if (!el) return\n const unbind = bindNativeEvents(el, native)\n return () => {\n unbind()\n assignRef(ref, null)\n }\n }\n return (\n <m.button\n ref={attach}\n whileTap={presets.press.whileTap}\n transition={presets.press.transition}\n {...rest}\n />\n )\n },\n)\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === 'function') ref(value)\n else if (ref) ref.current = value\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n className,\n variant,\n size,\n icon,\n iconRight,\n iconOnly = false,\n loading = false,\n fullWidth = false,\n asChild = false,\n disabled,\n type = 'button',\n children,\n ...props\n },\n ref,\n) {\n if (import.meta.env.DEV && iconOnly && !props['aria-label']) {\n console.warn('Button com iconOnly precisa de aria-label.')\n }\n const on = useMotionMode() === 'on'\n // Em `on` o toque é do whileTap: a classe `active:scale-97` sairia somando com ele, e o\n // `transform` sai da lista de transition (senão o CSS transiciona cada quadro que o Motion grava\n // e o toque chega atrasado). Com asChild nada disso: é só CSS, como em `off`.\n const classes = cn(\n buttonVariants({ variant, size, iconOnly, fullWidth }),\n on &&\n !asChild &&\n 'transition-[color,background-color,border-color,box-shadow] active:scale-100',\n className,\n )\n const code = resolveCatalogCode('Button', { variant: variant ?? 'primary' })\n\n if (asChild) {\n return (\n <Slot.Root ref={ref} data-rendra={code} className={classes} {...props}>\n {children}\n </Slot.Root>\n )\n }\n\n // Ícone dentro do botão segue o tamanho do próprio botão (sm/md -> sm, lg -> md, como o\n // [&_svg]:size-icon-* de buttonVariants já fazia com o Loader2 solto).\n const leading = loading ? <Spinner size={size === 'lg' ? 'md' : 'sm'} /> : icon\n if (on) {\n return (\n <MotionButton\n ref={ref}\n type={type}\n data-rendra={code}\n className={classes}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {leading}\n {iconOnly ? (loading ? null : children) : children}\n {!iconOnly && iconRight}\n </MotionButton>\n )\n }\n return (\n <button\n ref={ref}\n type={type}\n data-rendra={code}\n className={classes}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {leading}\n {iconOnly ? (loading ? null : children) : children}\n {!iconOnly && iconRight}\n </button>\n )\n})\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAM,YAA+D;CACnE,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AAEA,SAAgB,QAAQ,EAAE,OAAO,MAAM,OAAO,aAA2B;CACvE,MAAM,UAAU,wBAAwB;CACxC,MAAM,OACJ,oBAAC,SAAD;EAAS,eAAA;EAAY,WAAW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ACF,OACE,oBAAC,KAAK,MAAN;EAAgB;EAAK,eAAa;EAAM,WAAW;EAAS,GAAI;EAC7D;CACQ,CAAA;CAMf,MAAM,UAAU,UAAU,oBAAC,SAAD,EAAS,MAAM,SAAS,OAAO,OAAO,KAAO,CAAA,IAAI;CAC3E,IAAI,IACF,OACE,qBAAC,cAAD;EACO;EACC;EACN,eAAa;EACb,WAAW;EACX,UAAU,YAAY;EACtB,aAAW,WAAW,KAAA;EACtB,GAAI;EAPN,UAAA;GASG;GACA,WAAY,UAAU,OAAO,WAAY;GACzC,CAAC,YAAY;EACF;;CAGlB,OACE,qBAAC,UAAD;EACO;EACC;EACN,eAAa;EACb,WAAW;EACX,UAAU,YAAY;EACtB,aAAW,WAAW,KAAA;EACtB,GAAI;EAPN,UAAA;GASG;GACA,WAAY,UAAU,OAAO,WAAY;GACzC,CAAC,YAAY;EACR;;AAEZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"empty-state-Cdb1vkMT.js","names":[],"sources":["../src/brand/brand-context.ts","../src/brand/use-brand.ts","../src/components/ui/brand-feedback-icon.tsx","../src/components/ui/empty-state.tsx"],"sourcesContent":["import { createContext } from 'react'\nimport type { Shape } from '@/lib/shape'\nimport type { BrandConfig, PaletteConfig } from './types'\n\nexport type ColorMode = 'light' | 'dark' | 'system'\n\nexport interface BrandContextValue {\n brand: BrandConfig\n brands: BrandConfig[]\n setBrandId: (id: string) => void\n mode: ColorMode\n resolvedMode: 'light' | 'dark'\n setMode: (mode: ColorMode) => void\n /** Formato do template ativo (fixo por template). */\n shape: Shape\n /** Paleta de cores em uso (por padrão, a do próprio modelo). */\n palette: PaletteConfig\n palettes: PaletteConfig[]\n /** Usa a paleta de outro template; null volta às cores do próprio modelo. */\n setPaletteId: (id: string | null) => void\n /** Logotipo adequado para a sidebar com a paleta atual. */\n sidebarLogoVariant: 'light' | 'dark'\n}\n\nexport const BrandContext = createContext<BrandContextValue | null>(null)\n","import { useContext } from 'react'\nimport { BrandContext } from './brand-context'\n\nexport function useBrand() {\n const ctx = useContext(BrandContext)\n if (!ctx) throw new Error('useBrand precisa estar dentro de <BrandProvider>.')\n return ctx\n}\n","import { cva, type VariantProps } from 'class-variance-authority'\nimport { CircleCheck, CircleX, Info, TriangleAlert, type LucideIcon } from 'lucide-react'\nimport type { SVGProps } from 'react'\nimport { useBrand } from '@/brand/use-brand'\nimport type { FeedbackType } from '@/brand/types'\nimport { cn } from '@/lib/cn'\n\nconst sizes = {\n sm: 'size-icon-sm',\n md: 'size-icon-md',\n lg: 'size-icon-lg',\n xl: 'size-12',\n '2xl': 'size-16',\n} as const\n\nconst iconVariants = cva('relative inline-flex shrink-0', {\n variants: { size: sizes },\n defaultVariants: { size: 'md' },\n})\n\n/** Cor do estado (tinge o símbolo e, em statusBadge, o ícone ao lado). */\nconst stateText: Record<FeedbackType, string> = {\n success: 'text-success',\n error: 'text-destructive',\n warning: 'text-warning',\n info: 'text-info',\n}\n\n/** Ícone Lucide do selo ao lado do símbolo (statusBadge). */\nconst badgeIcons: Record<FeedbackType, LucideIcon> = {\n success: CircleCheck,\n error: CircleX,\n warning: TriangleAlert,\n info: Info,\n}\n\n/** Tamanho do ícone ao lado, proporcional ao do símbolo. */\nconst badgeIconSize: Record<keyof typeof sizes, string> = {\n sm: 'size-3',\n md: 'size-icon-sm',\n lg: 'size-icon-md',\n xl: 'size-icon-lg',\n '2xl': 'size-icon-lg',\n}\n\nconst badgeTone: Record<FeedbackType, string> = {\n success: 'bg-success text-success-foreground',\n error: 'bg-destructive text-destructive-foreground',\n warning: 'bg-warning text-warning-foreground',\n info: 'bg-info text-info-foreground',\n}\n\nexport const feedbackLabels: Record<FeedbackType, string> = {\n success: 'Sucesso',\n error: 'Erro',\n warning: 'Atenção',\n info: 'Informação',\n}\n\n/** Glifos universais de status desenhados em traço, herdando currentColor. */\nfunction StatusGlyph({\n type,\n animated,\n ...props\n}: { type: FeedbackType; animated?: boolean } & SVGProps<SVGSVGElement>) {\n // pathLength=1 normaliza o traço: o desenho anima de 1 a 0 em qualquer glifo.\n const draw = animated\n ? ({ pathLength: 1, strokeDasharray: 1, className: 'animate-draw' } as const)\n : {}\n const common = {\n viewBox: '0 0 12 12',\n fill: 'none',\n stroke: 'currentColor',\n strokeWidth: 2,\n strokeLinecap: 'round' as const,\n strokeLinejoin: 'round' as const,\n 'aria-hidden': true,\n ...props,\n }\n switch (type) {\n case 'success':\n return (\n <svg {...common}>\n <path d=\"M3 6.2 5.1 8.2 9 4\" {...draw} />\n </svg>\n )\n case 'error':\n return (\n <svg {...common}>\n <path d=\"M4 4l4 4M8 4 4 8\" {...draw} />\n </svg>\n )\n case 'warning':\n return (\n <svg {...common}>\n <path d=\"M6 3.2v3.3M6 8.8v0\" {...draw} />\n </svg>\n )\n case 'info':\n return (\n <svg {...common}>\n <path d=\"M6 3.2v0M6 5.5v3.3\" {...draw} />\n </svg>\n )\n }\n}\n\nexport interface BrandFeedbackIconProps extends VariantProps<typeof iconVariants> {\n type: FeedbackType\n /** Texto para leitores de tela. Sem ele o ícone é decorativo (o texto ao lado informa). */\n label?: string\n /**\n * Anima a entrada: o símbolo entra com mola e o glifo se desenha (check se formando,\n * X se riscando). O erro treme ao final. Respeita reduzir movimento.\n * Troque a key do componente para repetir a animação.\n */\n animated?: boolean\n /**\n * Cor do símbolo. `state` (padrão): a cor do estado (verde, vermelho, amarelo, azul).\n * `brand`: a cor primária da marca (`text-primary-text`); o selo de estado mantém a cor do\n * estado, para o significado não depender só da cor.\n */\n symbolTone?: 'state' | 'brand'\n /**\n * `false` (padrão): selo de estado sobreposto ao símbolo. `true`: o ícone do estado\n * (Lucide, na cor do estado) fica ao lado do símbolo, no lugar do selo sobreposto. Com um\n * SVG próprio em `brand.feedbackIcons[type]`, o SVG vence e nenhum selo é desenhado.\n */\n statusBadge?: boolean\n /**\n * Só vale com `animated`. `pop` (padrão): entra com mola, o glifo se desenha e o erro\n * treme. `encaixe`: entra em 240 ms, curva de saída suave, sem quique, sem desenho e sem\n * tremor. Com \"reduzir movimento\" do sistema, nenhuma animação roda.\n */\n animation?: 'pop' | 'encaixe'\n className?: string\n}\n\n/**\n * Ícone de feedback da marca: o símbolo da marca em currentColor, tingido pela cor\n * semântica, com um selo de status para que o significado não dependa só da cor.\n * Cada tipo pode ser substituído por um SVG próprio em brand.config.ts (feedbackIcons).\n */\nexport function BrandFeedbackIcon({\n type,\n size,\n label,\n animated = false,\n symbolTone = 'state',\n statusBadge = false,\n animation = 'pop',\n className,\n}: BrandFeedbackIconProps) {\n const { brand } = useBrand()\n const Custom = brand.feedbackIcons?.[type]\n const Symbol = brand.symbol\n const a11y = label\n ? ({ role: 'img', 'aria-label': label } as const)\n : ({ 'aria-hidden': true } as const)\n const encaixe = animation === 'encaixe'\n // Com `symbolTone=\"state\"` o texto do estado fica na raiz (como sempre); com `brand` sai da raiz.\n const rootTone = symbolTone === 'state' ? stateText[type] : undefined\n const symbolTonal = symbolTone === 'brand' && 'text-primary-text'\n const symbolAnim = animated && (encaixe ? 'animate-encaixe' : 'animate-pop')\n const badgeAnim = animated && (encaixe ? 'animate-encaixe' : 'animate-pop anim-delay-1')\n const BadgeIcon = badgeIcons[type]\n const sideBadge = statusBadge && !Custom\n\n return (\n <span\n data-slot=\"feedback-icon\"\n data-rendra=\"BFI-001\"\n className={cn(\n sideBadge ? 'relative inline-flex shrink-0 items-center gap-1' : iconVariants({ size }),\n rootTone,\n animated && !encaixe && type === 'error' && 'animate-shake',\n className,\n )}\n {...a11y}\n >\n {Custom ? (\n <Custom className={cn('size-full', symbolTonal, symbolAnim)} />\n ) : sideBadge ? (\n <>\n <Symbol className={cn(sizes[size ?? 'md'], symbolTonal, symbolAnim)} />\n <BadgeIcon\n aria-hidden\n className={cn('shrink-0', badgeIconSize[size ?? 'md'], stateText[type], badgeAnim)}\n />\n </>\n ) : (\n <>\n <Symbol className={cn('size-full mask-status-cutout', symbolTonal, symbolAnim)} />\n <span\n className={cn(\n 'absolute right-0 bottom-0 flex size-1/2 items-center justify-center rounded-full',\n badgeTone[type],\n badgeAnim,\n )}\n >\n <StatusGlyph type={type} animated={animated && !encaixe} className=\"size-full\" />\n </span>\n </>\n )}\n </span>\n )\n}\n","import { m } from 'motion/react'\nimport type { ElementType, ReactNode } from 'react'\nimport type { FeedbackType } from '@/brand/types'\nimport { BrandFeedbackIcon } from '@/components/ui/brand-feedback-icon'\nimport { cn } from '@/lib/cn'\nimport { useMotionMode, useMotionPresets } from '@/lib/motion'\n\nexport interface EmptyStateProps {\n title: string\n description?: ReactNode\n /** Tipo do ícone de feedback da marca. info para \"sem dados\", error para falha. */\n type?: FeedbackType\n /** Ações: no máximo uma principal e uma secundária. */\n actions?: ReactNode\n /** compact: dentro de tabela ou card pequeno. */\n size?: 'default' | 'compact'\n /**\n * Classes extras, que vencem as do componente. Para zerar o respiro vertical (por exemplo,\n * dentro de um card que já tem o seu) use `className=\"py-0 md:py-0\"`.\n */\n className?: string\n}\n\n/** Estado vazio (e de erro) com o ícone de feedback da marca. */\nexport function EmptyState({\n title,\n description,\n type = 'info',\n actions,\n size = 'default',\n className,\n}: EmptyStateProps) {\n const on = useMotionMode() === 'on'\n const presets = useMotionPresets()\n // Em `on` as quatro partes (ícone, título, descrição e ações) sobem em cascata de 60 ms, cada\n // uma com o deslize curto; a raiz em si não anima. Estado vazio é cota de encanto: ocasional,\n // sem teclado no caminho. Em `off` o HTML é o de sempre.\n const Icon: ElementType = on ? m.span : 'span'\n const Title: ElementType = on ? m.p : 'p'\n const Description: ElementType = on ? m.p : 'p'\n const Actions: ElementType = on ? m.div : 'div'\n const part = (index: number) => {\n if (!on) return {}\n const enter = presets.slide('bottom', 'short')\n return { ...enter, transition: { ...enter.transition, ...presets.stagger(index) } }\n }\n return (\n <div\n data-rendra=\"VAZ-001\"\n className={cn(\n 'flex flex-col items-center justify-center gap-4 text-center',\n size === 'compact' ? 'px-4 py-8' : 'px-4 py-12 md:py-16',\n className,\n )}\n >\n <Icon className=\"relative flex items-center justify-center\" {...part(0)}>\n <span aria-hidden className=\"absolute size-16 rounded-full bg-gradient-soft\" />\n <BrandFeedbackIcon\n type={type}\n size={size === 'compact' ? 'xl' : '2xl'}\n className=\"relative\"\n />\n </Icon>\n <div className=\"flex w-full flex-col gap-1\">\n <Title className=\"text-base font-semibold wrap-break-word\" {...part(1)}>\n {title}\n </Title>\n {description && (\n <Description className=\"text-sm wrap-break-word text-muted-foreground\" {...part(2)}>\n {description}\n </Description>\n )}\n </div>\n {actions && (\n <Actions className=\"flex flex-wrap justify-center gap-3\" {...part(3)}>\n {actions}\n </Actions>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;AAwBA,IAAa,eAAe,cAAwC,IAAI;;;ACrBxE,SAAgB,WAAW;CACzB,MAAM,MAAM,WAAW,YAAY;CACnC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,mDAAmD;CAC7E,OAAO;AACT;;;ACAA,IAAM,QAAQ;CACZ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;AACT;AAEA,IAAM,eAAe,IAAI,iCAAiC;CACxD,UAAU,EAAE,MAAM,MAAM;CACxB,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;;AAGD,IAAM,YAA0C;CAC9C,SAAS;CACT,OAAO;CACP,SAAS;CACT,MAAM;AACR;;AAGA,IAAM,aAA+C;CACnD,SAAS;CACT,OAAO;CACP,SAAS;CACT,MAAM;AACR;;AAGA,IAAM,gBAAoD;CACxD,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;AACT;AAEA,IAAM,YAA0C;CAC9C,SAAS;CACT,OAAO;CACP,SAAS;CACT,MAAM;AACR;AAEA,IAAa,iBAA+C;CAC1D,SAAS;CACT,OAAO;CACP,SAAS;CACT,MAAM;AACR;;AAGA,SAAS,YAAY,EACnB,MACA,UACA,GAAG,SACoE;CAEvE,MAAM,OAAO,WACR;EAAE,YAAY;EAAG,iBAAiB;EAAG,WAAW;CAAe,IAChE,CAAC;C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,uBACnC,SACF;EANF,UAAA;GAQE,qBAAC,MAAD;IAAM,WAAU;IAA4C,GAAI,KAAK,CAAC;IAAtE,UAAA,CACE,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAU;IAAkD,CAAA,GAC9E,oBAAC,mBAAD;KACQ;KACN,MAAM,SAAS,YAAY,OAAO;KAClC,WAAU;IACX,CAAA,CACG;;GACN,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,OAAD;KAAO,WAAU;KAA0C,GAAI,KAAK,CAAC;KAClE,UAAA;IACI,CAAA,GACN,eACC,oBAAC,aAAD;KAAa,WAAU;KAAgD,GAAI,KAAK,CAAC;KAC9E,UAAA;IACU,CAAA,CAEZ;;GACJ,WACC,oBAAC,SAAD;IAAS,WAAU;IAAsC,GAAI,KAAK,CAAC;IAChE,UAAA;GACM,CAAA;EAER;;AAET"}
@@ -1,107 +0,0 @@
1
- /*! Rendra Design System v2.5.0 | MIT | © 2026 Bruno Magalhaes | brunomagalhaes.me */
2
- import { LazyMotion, MotionConfig, domAnimation } from "motion/react";
3
- import { createContext, useContext, useMemo, useState, useSyncExternalStore } from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- //#region src/hooks/use-reduced-motion.ts
6
- /** Fonte única da preferência (também usada pelo motion, que só a assina em `on`). */
7
- function subscribeReducedMotion(cb) {
8
- const mq = matchMedia("(prefers-reduced-motion: reduce)");
9
- mq.addEventListener("change", cb);
10
- return () => mq.removeEventListener("change", cb);
11
- }
12
- function getReducedMotion() {
13
- return matchMedia("(prefers-reduced-motion: reduce)").matches;
14
- }
15
- function usePrefersReducedMotion() {
16
- return useSyncExternalStore(subscribeReducedMotion, getReducedMotion, () => false);
17
- }
18
- //#endregion
19
- //#region src/lib/motion/motion-context.tsx
20
- var MotionContext = createContext({
21
- mode: "off",
22
- layoutReady: false
23
- });
24
- /** Modo de motion do provider mais próximo (`off` sem provider). */
25
- function useMotionMode() {
26
- return useContext(MotionContext).mode;
27
- }
28
- /**
29
- * Em `on`, o chunk do `domMax` já chegou. Um `m.*` com `layout` ou `layoutId` só ganha o nó de
30
- * projeção se for criado DEPOIS disso (o Motion não monta a projeção de um elemento que já
31
- * estava na tela), então quem usa layout liga a prop e remonta o item quando isto vira `true`.
32
- */
33
- function useLayoutReady() {
34
- const { mode, layoutReady } = useContext(MotionContext);
35
- return mode === "on" && layoutReady;
36
- }
37
- var RevealContext = createContext(false);
38
- /** O componente está dentro de um `RevealScope`? */
39
- function useRevealScope() {
40
- return useContext(RevealContext);
41
- }
42
- /** Só troca o modo lido pelos componentes; não monta nem desmonta o LazyMotion. */
43
- function MotionModeScope({ mode, children }) {
44
- const { layoutReady } = useContext(MotionContext);
45
- const value = useMemo(() => ({
46
- mode,
47
- layoutReady
48
- }), [mode, layoutReady]);
49
- return /* @__PURE__ */ jsx(MotionContext.Provider, {
50
- value,
51
- children
52
- });
53
- }
54
- /** O carregador do `domMax` (chunk à parte): layout, layoutId e arraste do Motion. */
55
- var loadMax = () => import("./features-max--5VEt6M7.js").then((m) => m.default);
56
- /**
57
- * Em `off`, só o contexto (nenhum nó novo, nenhum LazyMotion). Em `on`, dois `LazyMotion` (os
58
- * dois `strict`: só `m.*` entra, um `motion.*` esquecido quebra em vez de puxar o pacote inteiro):
59
- * o de fora carrega o `domMax` sob demanda (layout e arraste), em chunk separado; o de dentro traz
60
- * o `domAnimation` síncrono (animação e gestos) e é o que os `m.*` enxergam. Nessa ordem o
61
- * renderer síncrono já está no contexto na primeira renderização (elementos e gestos funcionam
62
- * na hora), e os recursos de layout se juntam quando o chunk chega. A ordem contrária esconderia
63
- * o renderer até o chunk terminar de baixar.
64
- *
65
- * O `MotionConfig` recebe "reduzir movimento" da mesma fonte dos presets (o `matchMedia` de
66
- * `use-reduced-motion.ts`, reativo): com `always`, o Motion também tira o deslocamento e o layout
67
- * de qualquer animação que um componente escreva à mão, e mantém a opacidade. Não é uma segunda
68
- * fonte: é a primeira, lida uma vez, entregue a dois consumidores.
69
- */
70
- function MotionProvider({ mode, children }) {
71
- if (mode !== "on") return /* @__PURE__ */ jsx(MotionModeScope, {
72
- mode: "off",
73
- children
74
- });
75
- return /* @__PURE__ */ jsx(OnProvider, { children });
76
- }
77
- function OnProvider({ children }) {
78
- const [layoutReady, setLayoutReady] = useState(false);
79
- const reduced = usePrefersReducedMotion();
80
- const value = useMemo(() => ({
81
- mode: "on",
82
- layoutReady
83
- }), [layoutReady]);
84
- const load = useMemo(() => () => loadMax().then((features) => {
85
- setTimeout(() => setLayoutReady(true), 0);
86
- return features;
87
- }), []);
88
- return /* @__PURE__ */ jsx(LazyMotion, {
89
- features: load,
90
- strict: true,
91
- children: /* @__PURE__ */ jsx(LazyMotion, {
92
- features: domAnimation,
93
- strict: true,
94
- children: /* @__PURE__ */ jsx(MotionConfig, {
95
- reducedMotion: reduced ? "always" : "never",
96
- children: /* @__PURE__ */ jsx(MotionContext.Provider, {
97
- value,
98
- children
99
- })
100
- })
101
- })
102
- });
103
- }
104
- //#endregion
105
- export { getReducedMotion as a, useRevealScope as i, useLayoutReady as n, subscribeReducedMotion as o, useMotionMode as r, usePrefersReducedMotion as s, MotionProvider as t };
106
-
107
- //# sourceMappingURL=motion-context-5BRIQAJm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"motion-context-5BRIQAJm.js","names":[],"sources":["../src/hooks/use-reduced-motion.ts","../src/lib/motion/motion-context.tsx"],"sourcesContent":["import { useSyncExternalStore } from 'react'\n\n/*\n * Único hook de leitura de \"menos movimento\" do sistema operacional (prefers-reduced-motion).\n * Usado pelo Spinner e pelo Progress indeterminado para parar a animação sem depender só do\n * CSS, e assim ficar testável (mocke matchMedia para simular a preferência).\n */\n\n/** Fonte única da preferência (também usada pelo motion, que só a assina em `on`). */\nexport function subscribeReducedMotion(cb: () => void) {\n const mq = matchMedia('(prefers-reduced-motion: reduce)')\n mq.addEventListener('change', cb)\n return () => mq.removeEventListener('change', cb)\n}\n\nexport function getReducedMotion() {\n return matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n\nexport function usePrefersReducedMotion() {\n return useSyncExternalStore(subscribeReducedMotion, getReducedMotion, () => false)\n}\n","import { domAnimation, LazyMotion, MotionConfig } from 'motion/react'\nimport { createContext, useContext, useMemo, useState, type ReactNode } from 'react'\nimport { usePrefersReducedMotion } from '@/hooks/use-reduced-motion'\n\n/*\n * Modo de motion do Rendra. `off` (padrão): nada do Motion é montado, e o DOM e o\n * comportamento são os de sempre. `on`: os componentes trocam o elemento por `m.*` e animam.\n * O estado vive neste contexto próprio, não no do RendraProvider: o provider só o alimenta\n * pela prop `motion`, e uma tela (a de comparação) aninha o contexto para trocar on e off.\n */\n\nexport type MotionMode = 'off' | 'on'\n\ninterface MotionState {\n mode: MotionMode\n /**\n * O chunk do `domMax` (layout e arraste) já chegou. O contexto muda quando ele chega, para\n * os componentes que leem o modo renderizarem de novo: um `m.*` montado antes disso não tem\n * nó de projeção, e `layout`/`layoutId` só passam a valer na renderização seguinte.\n */\n layoutReady: boolean\n}\n\nconst MotionContext = createContext<MotionState>({ mode: 'off', layoutReady: false })\n\n/** Modo de motion do provider mais próximo (`off` sem provider). */\nexport function useMotionMode(): MotionMode {\n return useContext(MotionContext).mode\n}\n\n/**\n * Em `on`, o chunk do `domMax` já chegou. Um `m.*` com `layout` ou `layoutId` só ganha o nó de\n * projeção se for criado DEPOIS disso (o Motion não monta a projeção de um elemento que já\n * estava na tela), então quem usa layout liga a prop e remonta o item quando isto vira `true`.\n */\nexport function useLayoutReady(): boolean {\n const { mode, layoutReady } = useContext(MotionContext)\n return mode === 'on' && layoutReady\n}\n\nconst RevealContext = createContext(false)\n\n/**\n * Marca um trecho da árvore como \"chegada de painel\" (o dashboard): lá, o gráfico desenha no\n * tempo do reveal (900 ms) em vez do tempo de rotina (`draw`, 420 ms). Fora dele, o gráfico de\n * uma tela de uso diário desenha uma vez e rápido.\n */\nexport function RevealScope({ children }: { children: ReactNode }) {\n return <RevealContext.Provider value>{children}</RevealContext.Provider>\n}\n\n/** O componente está dentro de um `RevealScope`? */\nexport function useRevealScope(): boolean {\n return useContext(RevealContext)\n}\n\n/** Só troca o modo lido pelos componentes; não monta nem desmonta o LazyMotion. */\nexport function MotionModeScope({ mode, children }: { mode: MotionMode; children: ReactNode }) {\n const { layoutReady } = useContext(MotionContext)\n const value = useMemo(() => ({ mode, layoutReady }), [mode, layoutReady])\n return <MotionContext.Provider value={value}>{children}</MotionContext.Provider>\n}\n\n/** O carregador do `domMax` (chunk à parte): layout, layoutId e arraste do Motion. */\nconst loadMax = () => import('./features-max').then((m) => m.default)\n\n/**\n * Em `off`, só o contexto (nenhum nó novo, nenhum LazyMotion). Em `on`, dois `LazyMotion` (os\n * dois `strict`: só `m.*` entra, um `motion.*` esquecido quebra em vez de puxar o pacote inteiro):\n * o de fora carrega o `domMax` sob demanda (layout e arraste), em chunk separado; o de dentro traz\n * o `domAnimation` síncrono (animação e gestos) e é o que os `m.*` enxergam. Nessa ordem o\n * renderer síncrono já está no contexto na primeira renderização (elementos e gestos funcionam\n * na hora), e os recursos de layout se juntam quando o chunk chega. A ordem contrária esconderia\n * o renderer até o chunk terminar de baixar.\n *\n * O `MotionConfig` recebe \"reduzir movimento\" da mesma fonte dos presets (o `matchMedia` de\n * `use-reduced-motion.ts`, reativo): com `always`, o Motion também tira o deslocamento e o layout\n * de qualquer animação que um componente escreva à mão, e mantém a opacidade. Não é uma segunda\n * fonte: é a primeira, lida uma vez, entregue a dois consumidores.\n */\nexport function MotionProvider({ mode, children }: { mode: MotionMode; children: ReactNode }) {\n if (mode !== 'on') return <MotionModeScope mode=\"off\">{children}</MotionModeScope>\n return <OnProvider>{children}</OnProvider>\n}\n\nfunction OnProvider({ children }: { children: ReactNode }) {\n const [layoutReady, setLayoutReady] = useState(false)\n const reduced = usePrefersReducedMotion()\n const value = useMemo(() => ({ mode: 'on' as const, layoutReady }), [layoutReady])\n // O LazyMotion registra os recursos DEPOIS de a promessa do carregador resolver; o aviso vai\n // para o ciclo seguinte, para a renderização que ele provoca já enxergar o layout.\n const load = useMemo(\n () => () =>\n loadMax().then((features) => {\n setTimeout(() => setLayoutReady(true), 0)\n return features\n }),\n [],\n )\n return (\n <LazyMotion features={load} strict>\n <LazyMotion features={domAnimation} strict>\n <MotionConfig reducedMotion={reduced ? 'always' : 'never'}>\n <MotionContext.Provider value={value}>{children}</MotionContext.Provider>\n </MotionConfig>\n </LazyMotion>\n </LazyMotion>\n )\n}\n"],"mappings":";;;;;;AASA,SAAgB,uBAAuB,IAAgB;CACrD,MAAM,KAAK,WAAW,kCAAkC;CACxD,GAAG,iBAAiB,UAAU,EAAE;CAChC,aAAa,GAAG,oBAAoB,UAAU,EAAE;AAClD;AAEA,SAAgB,mBAAmB;CACjC,OAAO,WAAW,kCAAkC,CAAC,CAAC;AACxD;AAEA,SAAgB,0BAA0B;CACxC,OAAO,qBAAqB,wBAAwB,wBAAwB,KAAK;AACnF;;;ACEA,IAAM,gBAAgB,cAA2B;CAAE,MAAM;CAAO,aAAa;AAAM,CAAC;;AAGpF,SAAgB,gBAA4B;CAC1C,OAAO,WAAW,aAAa,CAAC,CAAC;AACnC;;;;;;AAOA,SAAgB,iBAA0B;CACxC,MAAM,EAAE,MAAM,gBAAgB,WAAW,aAAa;CACtD,OAAO,SAAS,QAAQ;AAC1B;AAEA,IAAM,gBAAgB,cAAc,KAAK;;AAYzC,SAAgB,iBAA0B;CACxC,OAAO,WAAW,aAAa;AACjC;;AAGA,SAAgB,gBAAgB,EAAE,MAAM,YAAuD;CAC7F,MAAM,EAAE,gBAAgB,WAAW,aAAa;CAChD,MAAM,QAAQ,eAAe;EAAE;EAAM;CAAY,IAAI,CAAC,MAAM,WAAW,CAAC;CACxE,OAAO,oBAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC,CAAA;AACjF;;AAGA,IAAM,gBAAgB,OAAO,6BAAiB,CAAC,MAAM,MAAM,EAAE,OAAO;;;;;;;;;;;;;;;AAgBpE,SAAgB,eAAe,EAAE,MAAM,YAAuD;CAC5F,I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