silvery 0.21.1 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Text-BRf-59j2.mjs → Text-4tWKabKH.mjs} +46 -46
- package/dist/Text-4tWKabKH.mjs.map +1 -0
- package/dist/{ag-BeFC4S2N.mjs → ag-B-7XAHL8.mjs} +42 -19
- package/dist/ag-B-7XAHL8.mjs.map +1 -0
- package/dist/{animation-N8MFybTk.mjs → animation-CZ4x2R7C.mjs} +1 -1
- package/dist/{animation-N8MFybTk.mjs.map → animation-CZ4x2R7C.mjs.map} +1 -1
- package/dist/{ansi-C6Qs1Wn2.mjs → ansi-CLmIMnop.mjs} +1 -1
- package/dist/{ansi-C6Qs1Wn2.mjs.map → ansi-CLmIMnop.mjs.map} +1 -1
- package/dist/{ansi-CBkam1ty.d.mts → ansi-qYRTDp5m.d.mts} +1 -1
- package/dist/{ansi-CBkam1ty.d.mts.map → ansi-qYRTDp5m.d.mts.map} +1 -1
- package/dist/chain-bridge-B7LNJwVF.mjs +4149 -0
- package/dist/chain-bridge-B7LNJwVF.mjs.map +1 -0
- package/dist/cli-CuNV0hTE.mjs +4 -0
- package/dist/{context-BU5LkkIy.mjs → context-CEhuD1R_.mjs} +1 -1
- package/dist/{context-BU5LkkIy.mjs.map → context-CEhuD1R_.mjs.map} +1 -1
- package/dist/devtools-BuTq07Zb.mjs +2 -0
- package/dist/{devtools-9zfhpFyG.mjs → devtools-akTjVxxX.mjs} +3 -3
- package/dist/{devtools-9zfhpFyG.mjs.map → devtools-akTjVxxX.mjs.map} +1 -1
- package/dist/{easing-B0oZKDki.d.mts → easing-8OlNopWv.d.mts} +1 -1
- package/dist/{easing-B0oZKDki.d.mts.map → easing-8OlNopWv.d.mts.map} +1 -1
- package/dist/{eta-DGOuC8yU.mjs → eta-CPZ45g_P.mjs} +1 -1
- package/dist/{eta-DGOuC8yU.mjs.map → eta-CPZ45g_P.mjs.map} +1 -1
- package/dist/{flexily-zero-adapter-D6hcFgrH.mjs → flexily-zero-adapter-DktX3HsX.mjs} +1 -1
- package/dist/{flexily-zero-adapter-CEJOcbNp.mjs → flexily-zero-adapter-VoBGHG14.mjs} +1 -1
- package/dist/{flexily-zero-adapter-CEJOcbNp.mjs.map → flexily-zero-adapter-VoBGHG14.mjs.map} +1 -1
- package/dist/hit-registry-DRV2ig-Y.d.mts +71 -0
- package/dist/hit-registry-DRV2ig-Y.d.mts.map +1 -0
- package/dist/{image-1nRyKa60.mjs → image-o2WpbrD1.mjs} +7 -7
- package/dist/{image-1nRyKa60.mjs.map → image-o2WpbrD1.mjs.map} +1 -1
- package/dist/{index-2E1jYgak.d.mts → index-3vAxA_EQ.d.mts} +35 -12
- package/dist/index-3vAxA_EQ.d.mts.map +1 -0
- package/dist/{index-DnuadDNL.d.mts → index-BKujGENR.d.mts} +8590 -11173
- package/dist/index-BKujGENR.d.mts.map +1 -0
- package/dist/{index-Bi4Jdz5g.d.mts → index-C6oOd9eE.d.mts} +2 -2
- package/dist/{index-Bi4Jdz5g.d.mts.map → index-C6oOd9eE.d.mts.map} +1 -1
- package/dist/{index-Dg1YaeJb.d.mts → index-DhYF3m7V.d.mts} +2 -2
- package/dist/{index-Dg1YaeJb.d.mts.map → index-DhYF3m7V.d.mts.map} +1 -1
- package/dist/index.d.mts +12 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +18 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{layout-engine-Ca_nbtfL.mjs → layout-engine-BYp49XPD.mjs} +3 -3
- package/dist/{layout-engine-Ca_nbtfL.mjs.map → layout-engine-BYp49XPD.mjs.map} +1 -1
- package/dist/{layout-engine-CgsoBRIn.mjs → layout-engine-D0dXw5fr.mjs} +1 -1
- package/dist/{layout-signals-Dch2EiCy.mjs → layout-signals-uQadGDmO.mjs} +2 -2
- package/dist/layout-signals-uQadGDmO.mjs.map +1 -0
- package/dist/{mouse-events-hnbJZRwK.mjs → mouse-events-Pg-XKR3T.mjs} +35 -6
- package/dist/mouse-events-Pg-XKR3T.mjs.map +1 -0
- package/dist/{bound-term-BumfuXXW.d.mts → mouse-events-UoUWNIdS.d.mts} +559 -401
- package/dist/mouse-events-UoUWNIdS.d.mts.map +1 -0
- package/dist/{multi-progress-CaXTuL9G.mjs → multi-progress-Bvd1BYED.mjs} +3 -3
- package/dist/{multi-progress-CaXTuL9G.mjs.map → multi-progress-Bvd1BYED.mjs.map} +1 -1
- package/dist/{multi-progress-Bg4ngK80.d.mts → multi-progress-DPOCjomS.d.mts} +2 -2
- package/dist/{multi-progress-Bg4ngK80.d.mts.map → multi-progress-DPOCjomS.d.mts.map} +1 -1
- package/dist/{node-BiFu8I9Y.mjs → node-Cl-kzQcl.mjs} +1 -1
- package/dist/{node-BiFu8I9Y.mjs.map → node-Cl-kzQcl.mjs.map} +1 -1
- package/dist/{progress-B_UPy6zk.mjs → progress-1r6M_ZAP.mjs} +4 -4
- package/dist/{progress-B_UPy6zk.mjs.map → progress-1r6M_ZAP.mjs.map} +1 -1
- package/dist/{progress-bar-DmIMPdL0.mjs → progress-bar-DzW1DzNj.mjs} +4 -4
- package/dist/{progress-bar-DmIMPdL0.mjs.map → progress-bar-DzW1DzNj.mjs.map} +1 -1
- package/dist/{reconciler-NBDSEm8k.mjs → reconciler-lsTL1y8i.mjs} +111 -110
- package/dist/reconciler-lsTL1y8i.mjs.map +1 -0
- package/dist/{render-string-B4h4SmK7.mjs → render-string-2ZcV8n3B.mjs} +15 -11
- package/dist/render-string-2ZcV8n3B.mjs.map +1 -0
- package/dist/{render-string-BntLj7Xq.mjs → render-string-BJZqo5Rr.mjs} +1 -1
- package/dist/runtime.d.mts +3 -2
- package/dist/runtime.mjs +3 -2
- package/dist/{schemes-DYt2ushj.mjs → schemes-C4SUgVea.mjs} +2 -2
- package/dist/{schemes-DYt2ushj.mjs.map → schemes-C4SUgVea.mjs.map} +1 -1
- package/dist/{spinner-Py8_-hn9.mjs → spinner-Ck3SdCpW.mjs} +3 -3
- package/dist/{spinner-Py8_-hn9.mjs.map → spinner-Ck3SdCpW.mjs.map} +1 -1
- package/dist/{spinner-CLgzJ_QF.d.mts → spinner-CpcGtQ9L.d.mts} +2 -2
- package/dist/{spinner-CLgzJ_QF.d.mts.map → spinner-CpcGtQ9L.d.mts.map} +1 -1
- package/dist/{src-WeA_J4BV.mjs → src-B6MuVlOK.mjs} +88 -45
- package/dist/src-B6MuVlOK.mjs.map +1 -0
- package/dist/{src-CbhWmUnF.mjs → src-BZOfzNeo.mjs} +1484 -1488
- package/dist/src-BZOfzNeo.mjs.map +1 -0
- package/dist/{src-B9S_woYc.mjs → src-ChuXo--x.mjs} +20290 -23261
- package/dist/src-ChuXo--x.mjs.map +1 -0
- package/dist/{src-Dvq-s8iD.mjs → src-DdGaRDi9.mjs} +3 -3
- package/dist/{src-Dvq-s8iD.mjs.map → src-DdGaRDi9.mjs.map} +1 -1
- package/dist/{src-Oe6x5PrS.mjs → src-DorsnS70.mjs} +190 -76
- package/dist/src-DorsnS70.mjs.map +1 -0
- package/dist/{steps-DYrzCUCK.d.mts → steps-DV34gm_Z.d.mts} +1 -1
- package/dist/{steps-DYrzCUCK.d.mts.map → steps-DV34gm_Z.d.mts.map} +1 -1
- package/dist/{svg-DhxQkz-O.mjs → svg-NmV9dgB9.mjs} +1 -1
- package/dist/{svg-DhxQkz-O.mjs.map → svg-NmV9dgB9.mjs.map} +1 -1
- package/dist/{svg-Hk7lIl4F.d.mts → svg-wvIEu-RS.d.mts} +1 -1
- package/dist/{svg-Hk7lIl4F.d.mts.map → svg-wvIEu-RS.d.mts.map} +1 -1
- package/dist/term.d.mts +3 -3
- package/dist/term.mjs +4 -4
- package/dist/test.d.mts +673 -0
- package/dist/test.d.mts.map +1 -0
- package/dist/test.mjs +2829 -0
- package/dist/test.mjs.map +1 -0
- package/dist/theme.d.mts +2 -2
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +3 -3
- package/dist/{types-Bx-XZNbE.d.mts → types-VyreAPAB.d.mts} +1 -1
- package/dist/{types-Bx-XZNbE.d.mts.map → types-VyreAPAB.d.mts.map} +1 -1
- package/dist/ui/animation.d.mts +2 -2
- package/dist/ui/animation.mjs +1 -1
- package/dist/ui/ansi.d.mts +1 -1
- package/dist/ui/ansi.mjs +1 -1
- package/dist/ui/cli.d.mts +3 -3
- package/dist/ui/cli.mjs +5 -5
- package/dist/ui/image.d.mts +1 -1
- package/dist/ui/image.mjs +1 -1
- package/dist/ui/progress.d.mts +4 -4
- package/dist/ui/progress.mjs +4 -4
- package/dist/ui/react.d.mts +1 -1
- package/dist/ui/react.mjs +2 -2
- package/dist/ui/recording-chrome-react.d.mts +1 -1
- package/dist/ui/recording-chrome-react.mjs +2 -2
- package/dist/ui/recording-chrome.d.mts +1 -1
- package/dist/ui/recording-chrome.mjs +1 -1
- package/dist/ui/utils.mjs +1 -1
- package/dist/ui/wrappers.d.mts +2 -2
- package/dist/ui/wrappers.mjs +1 -1
- package/dist/ui.d.mts +6 -6
- package/dist/ui.mjs +7 -7
- package/dist/{ansi-OYRLxxZQ.mjs → unicode-X43-fdGF.mjs} +7317 -6909
- package/dist/unicode-X43-fdGF.mjs.map +1 -0
- package/dist/{useLatest-DC8i7guK.d.mts → useLatest-D9p0ZDAC.d.mts} +2 -2
- package/dist/{useLatest-DC8i7guK.d.mts.map → useLatest-D9p0ZDAC.d.mts.map} +1 -1
- package/dist/{useLayout-BKsQl2Or.mjs → useLayout-Cx01rHVI.mjs} +4 -4
- package/dist/{useLayout-BKsQl2Or.mjs.map → useLayout-Cx01rHVI.mjs.map} +1 -1
- package/dist/{with-text-input-DG4f7JII.d.mts → with-text-input-CW8MR9Th.d.mts} +3 -3
- package/dist/{with-text-input-DG4f7JII.d.mts.map → with-text-input-CW8MR9Th.d.mts.map} +1 -1
- package/dist/wrap-measurer-registration-DNBmtFNM.d.mts +3106 -0
- package/dist/wrap-measurer-registration-DNBmtFNM.d.mts.map +1 -0
- package/dist/{wrapper-D7gNSsgf.mjs → wrapper-DpMauwdI.mjs} +15 -17
- package/dist/wrapper-DpMauwdI.mjs.map +1 -0
- package/dist/{wrappers-CypAzrMO.mjs → wrappers-DHMzvbRo.mjs} +6 -6
- package/dist/{wrappers-CypAzrMO.mjs.map → wrappers-DHMzvbRo.mjs.map} +1 -1
- package/dist/yoga-adapter-B-DCP4Bx.mjs +2 -0
- package/dist/{yoga-adapter-SsEIqMc1.mjs → yoga-adapter-CB_7pLyl.mjs} +2 -2
- package/dist/{yoga-adapter-SsEIqMc1.mjs.map → yoga-adapter-CB_7pLyl.mjs.map} +1 -1
- package/package.json +21 -16
- package/dist/Text-BRf-59j2.mjs.map +0 -1
- package/dist/ag-BeFC4S2N.mjs.map +0 -1
- package/dist/ansi-OYRLxxZQ.mjs.map +0 -1
- package/dist/bound-term-BumfuXXW.d.mts.map +0 -1
- package/dist/cli-DG6zsfsS.mjs +0 -4
- package/dist/devtools-nmPUmYU_.mjs +0 -2
- package/dist/index-2E1jYgak.d.mts.map +0 -1
- package/dist/index-DnuadDNL.d.mts.map +0 -1
- package/dist/layout-signals-Dch2EiCy.mjs.map +0 -1
- package/dist/mouse-events-hnbJZRwK.mjs.map +0 -1
- package/dist/reconciler-NBDSEm8k.mjs.map +0 -1
- package/dist/render-string-B4h4SmK7.mjs.map +0 -1
- package/dist/src-B9S_woYc.mjs.map +0 -1
- package/dist/src-CbhWmUnF.mjs.map +0 -1
- package/dist/src-Oe6x5PrS.mjs.map +0 -1
- package/dist/src-WeA_J4BV.mjs.map +0 -1
- package/dist/ui/display.d.mts +0 -35
- package/dist/ui/display.d.mts.map +0 -1
- package/dist/ui/display.mjs +0 -123
- package/dist/ui/display.mjs.map +0 -1
- package/dist/ui/input.d.mts +0 -184
- package/dist/ui/input.d.mts.map +0 -1
- package/dist/ui/input.mjs +0 -283
- package/dist/ui/input.mjs.map +0 -1
- package/dist/wrapper-D7gNSsgf.mjs.map +0 -1
- package/dist/yoga-adapter-1ex8r0ws.mjs +0 -2
|
@@ -1,10 +1,49 @@
|
|
|
1
|
-
import { r as effect } from "./src-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
1
|
+
import { r as effect } from "./src-B6MuVlOK.mjs";
|
|
2
|
+
import { o as getLayoutSignals, u as observeLayoutSignal } from "./layout-signals-uQadGDmO.mjs";
|
|
3
|
+
import { a as KNOWN_VARIANTS } from "./src-DorsnS70.mjs";
|
|
4
|
+
import { a as defaultDarkTheme } from "./schemes-C4SUgVea.mjs";
|
|
5
|
+
import { a as NodeContext } from "./context-CEhuD1R_.mjs";
|
|
6
6
|
import { createContext, forwardRef, useContext, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region packages/ag-react/src/ThemeContext.tsx
|
|
9
|
+
/**
|
|
10
|
+
* ThemeContext — delivers a Theme to the component tree.
|
|
11
|
+
*
|
|
12
|
+
* Wrap your app (or a subtree) in `<ThemeProvider theme={…}>` to make
|
|
13
|
+
* `$token` color props resolve against that theme. Components call
|
|
14
|
+
* `useTheme()` to read the current theme.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import { ThemeProvider, defaultDarkTheme } from '@silvery/ag-react'
|
|
19
|
+
*
|
|
20
|
+
* <ThemeProvider theme={defaultDarkTheme}>
|
|
21
|
+
* <App />
|
|
22
|
+
* </ThemeProvider>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
/** @internal Exported for ThemeProvider and Text component — not public API. */
|
|
26
|
+
const ThemeContext = createContext(defaultDarkTheme);
|
|
27
|
+
/**
|
|
28
|
+
* Context that carries scheme detection metadata (name, source, confidence).
|
|
29
|
+
*
|
|
30
|
+
* Separate from ThemeContext because scheme metadata is orthogonal to the
|
|
31
|
+
* theme token bag. Populated by `<ThemeProvider scheme={...}>` when the
|
|
32
|
+
* caller passes detection provenance (e.g. from `runThemed`). Null when
|
|
33
|
+
* no scheme metadata was injected.
|
|
34
|
+
*
|
|
35
|
+
* @internal Exported for ThemeProvider.
|
|
36
|
+
*/
|
|
37
|
+
const ActiveSchemeContext = createContext(null);
|
|
38
|
+
/**
|
|
39
|
+
* Read the current theme from context.
|
|
40
|
+
*
|
|
41
|
+
* Returns `defaultDarkTheme` when no `ThemeProvider` is present.
|
|
42
|
+
*/
|
|
43
|
+
function useTheme() {
|
|
44
|
+
return useContext(ThemeContext);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
8
47
|
//#region packages/ag-react/src/components/Box.tsx
|
|
9
48
|
/**
|
|
10
49
|
* Silvery Box Component
|
|
@@ -98,45 +137,6 @@ const Box = forwardRef(function Box(props, ref) {
|
|
|
98
137
|
});
|
|
99
138
|
});
|
|
100
139
|
//#endregion
|
|
101
|
-
//#region packages/ag-react/src/ThemeContext.tsx
|
|
102
|
-
/**
|
|
103
|
-
* ThemeContext — delivers a Theme to the component tree.
|
|
104
|
-
*
|
|
105
|
-
* Wrap your app (or a subtree) in `<ThemeProvider theme={…}>` to make
|
|
106
|
-
* `$token` color props resolve against that theme. Components call
|
|
107
|
-
* `useTheme()` to read the current theme.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* ```tsx
|
|
111
|
-
* import { ThemeProvider, defaultDarkTheme } from '@silvery/ag-react'
|
|
112
|
-
*
|
|
113
|
-
* <ThemeProvider theme={defaultDarkTheme}>
|
|
114
|
-
* <App />
|
|
115
|
-
* </ThemeProvider>
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
/** @internal Exported for ThemeProvider and Text component — not public API. */
|
|
119
|
-
const ThemeContext = createContext(defaultDarkTheme);
|
|
120
|
-
/**
|
|
121
|
-
* Context that carries scheme detection metadata (name, source, confidence).
|
|
122
|
-
*
|
|
123
|
-
* Separate from ThemeContext because scheme metadata is orthogonal to the
|
|
124
|
-
* theme token bag. Populated by `<ThemeProvider scheme={...}>` when the
|
|
125
|
-
* caller passes detection provenance (e.g. from `runThemed`). Null when
|
|
126
|
-
* no scheme metadata was injected.
|
|
127
|
-
*
|
|
128
|
-
* @internal Exported for ThemeProvider.
|
|
129
|
-
*/
|
|
130
|
-
const ActiveSchemeContext = createContext(null);
|
|
131
|
-
/**
|
|
132
|
-
* Read the current theme from context.
|
|
133
|
-
*
|
|
134
|
-
* Returns `defaultDarkTheme` when no `ThemeProvider` is present.
|
|
135
|
-
*/
|
|
136
|
-
function useTheme() {
|
|
137
|
-
return useContext(ThemeContext);
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
140
|
//#region packages/ag-react/src/components/Text.tsx
|
|
141
141
|
/**
|
|
142
142
|
* Silvery Text Component
|
|
@@ -232,6 +232,6 @@ const Text = forwardRef(function Text(props, ref) {
|
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
234
|
//#endregion
|
|
235
|
-
export {
|
|
235
|
+
export { useTheme as a, ThemeContext as i, Box as n, ActiveSchemeContext as r, Text as t };
|
|
236
236
|
|
|
237
|
-
//# sourceMappingURL=Text-
|
|
237
|
+
//# sourceMappingURL=Text-4tWKabKH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text-4tWKabKH.mjs","names":["signalEffect"],"sources":["../packages/ag-react/src/ThemeContext.tsx","../packages/ag-react/src/components/Box.tsx","../packages/ag-react/src/components/Text.tsx"],"sourcesContent":["/**\n * ThemeContext — delivers a Theme to the component tree.\n *\n * Wrap your app (or a subtree) in `<ThemeProvider theme={…}>` to make\n * `$token` color props resolve against that theme. Components call\n * `useTheme()` to read the current theme.\n *\n * @example\n * ```tsx\n * import { ThemeProvider, defaultDarkTheme } from '@silvery/ag-react'\n *\n * <ThemeProvider theme={defaultDarkTheme}>\n * <App />\n * </ThemeProvider>\n * ```\n */\n\nimport { createContext, useContext } from \"react\"\nimport type { Theme, ActiveScheme } from \"@silvery/ansi\"\nimport { defaultDarkTheme } from \"@silvery/theme/schemes\"\n\n// ============================================================================\n// Context\n// ============================================================================\n\n/** @internal Exported for ThemeProvider and Text component — not public API. */\nexport const ThemeContext = createContext<Theme>(defaultDarkTheme)\n\n/**\n * Context that carries scheme detection metadata (name, source, confidence).\n *\n * Separate from ThemeContext because scheme metadata is orthogonal to the\n * theme token bag. Populated by `<ThemeProvider scheme={...}>` when the\n * caller passes detection provenance (e.g. from `runThemed`). Null when\n * no scheme metadata was injected.\n *\n * @internal Exported for ThemeProvider.\n */\nexport const ActiveSchemeContext = createContext<ActiveScheme | null>(null)\n\n// ============================================================================\n// Hook\n// ============================================================================\n\n/**\n * Read the current theme from context.\n *\n * Returns `defaultDarkTheme` when no `ThemeProvider` is present.\n */\nexport function useTheme(): Theme {\n return useContext(ThemeContext)\n}\n","/**\n * Silvery Box Component\n *\n * The primary layout primitive for Silvery. Box is a flexbox container that can hold\n * other Box or Text components. It supports all standard flexbox properties,\n * dimensions, spacing, and borders.\n *\n * Box renders to an 'silvery-box' host element that the reconciler converts to an\n * SilveryNode with an associated Yoga layout node.\n *\n * Box provides NodeContext to its children, enabling useBoxRect/useScrollRect hooks.\n * It also supports forwardRef for imperative access and onLayout for layout callbacks.\n */\n\nimport {\n type ForwardedRef,\n type JSX,\n type ReactNode,\n forwardRef,\n useImperativeHandle,\n useLayoutEffect,\n useRef,\n useState,\n} from \"react\"\nimport { effect as signalEffect } from \"@silvery/signals\"\nimport { NodeContext } from \"../context\"\nimport { getLayoutSignals, observeLayoutSignal } from \"@silvery/ag/layout-signals\"\nimport type { BoxProps as BoxPropsType, AgNode, Rect } from \"@silvery/ag/types\"\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface BoxProps extends BoxPropsType {\n /** Child elements */\n children?: ReactNode\n}\n\n/**\n * Methods exposed via ref on Box component.\n */\nexport interface BoxHandle {\n /** Get the underlying SilveryNode */\n getNode(): AgNode | null\n /** Get the current content-relative layout rect */\n getBoxRect(): Rect | null\n /** Get the current screen-relative layout rect */\n getScrollRect(): Rect | null\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Flexbox container component for terminal UIs.\n *\n * Provides NodeContext to children, enabling useBoxRect/useScrollRect hooks.\n * Supports forwardRef for imperative access and onLayout for layout callbacks.\n *\n * @example\n * ```tsx\n * // Basic vertical layout (default)\n * <Box>\n * <Text>Line 1</Text>\n * <Text>Line 2</Text>\n * </Box>\n *\n * // Horizontal layout with spacing\n * <Box flexDirection=\"row\" gap={2}>\n * <Box width={10}><Text>Left</Text></Box>\n * <Box flexGrow={1}><Text>Center</Text></Box>\n * <Box width={10}><Text>Right</Text></Box>\n * </Box>\n *\n * // With border\n * <Box borderStyle=\"single\" borderColor=\"green\" padding={1}>\n * <Text>Boxed content</Text>\n * </Box>\n *\n * // With ref and onLayout\n * const boxRef = useRef<BoxHandle>(null);\n * <Box\n * ref={boxRef}\n * onLayout={(layout) => console.log('Size:', layout.width, layout.height)}\n * >\n * <Text>Content</Text>\n * </Box>\n * ```\n */\nexport const Box = forwardRef(function Box(\n props: BoxProps,\n ref: ForwardedRef<BoxHandle>,\n): JSX.Element {\n const { children, onLayout, ...restProps } = props\n const nodeRef = useRef<AgNode | null>(null)\n const [node, setNode] = useState<AgNode | null>(null)\n\n // Track the last layout we reported to onLayout to avoid duplicate calls\n const lastReportedLayout = useRef<Rect | null>(null)\n\n // After mount, ref points to the SilveryNode. Update state once to provide\n // the node to children via context. Only runs on mount ([] deps).\n useLayoutEffect(() => {\n if (nodeRef.current) {\n setNode(nodeRef.current)\n }\n }, [])\n\n // Wire up onLayout callback - subscribe via layout signals\n useLayoutEffect(() => {\n if (!onLayout || !node) return\n\n const releaseObservation = observeLayoutSignal(node, \"boxRect\")\n const signals = getLayoutSignals(node)\n const onLayoutRef = { current: onLayout }\n onLayoutRef.current = onLayout\n\n const dispose = signalEffect(() => {\n const layout = signals.boxRect()\n if (!layout) return\n\n // Only call onLayout if layout actually changed\n const last = lastReportedLayout.current\n if (\n !last ||\n last.x !== layout.x ||\n last.y !== layout.y ||\n last.width !== layout.width ||\n last.height !== layout.height\n ) {\n lastReportedLayout.current = layout\n onLayoutRef.current(layout)\n }\n })\n\n return () => {\n dispose()\n releaseObservation()\n }\n }, [node, onLayout])\n\n // Expose imperative methods via ref\n useImperativeHandle(\n ref,\n () => ({\n getNode: () => nodeRef.current,\n getBoxRect: () => nodeRef.current?.boxRect ?? null,\n getScrollRect: () => nodeRef.current?.scrollRect ?? null,\n }),\n [],\n )\n\n // Render silvery-box with ref, wrap children in NodeContext\n // The reconciler creates an SilveryNode, ref gives us access to it\n return (\n <silvery-box ref={nodeRef} {...restProps}>\n <NodeContext.Provider value={node}>{children}</NodeContext.Provider>\n </silvery-box>\n )\n})\n","/**\n * Silvery Text Component\n *\n * The primitive for rendering text content in Silvery. Text supports styling\n * (colors, bold, italic, etc.) and text wrapping/truncation modes.\n *\n * Text renders to an 'silvery-text' host element that the reconciler converts\n * to an SilveryNode containing the text content.\n *\n * Supports forwardRef for imperative access to the underlying node.\n */\n\nimport { type ForwardedRef, type JSX, type ReactNode, forwardRef, useContext } from \"react\"\nimport type { AgNode, TextProps as TextPropsType } from \"@silvery/ag/types\"\nimport type { KnownVariant, Theme } from \"@silvery/ansi\"\nimport { KNOWN_VARIANTS } from \"@silvery/ansi\"\nimport { ThemeContext } from \"../ThemeContext\"\n\n// ============================================================================\n// Runtime variant warning — fires once per (theme, variantName) pair.\n// Warns the developer that a variant lookup returned undefined (typo, etc.).\n// Does NOT throw — silent no-op rendering is still the correct behavior.\n// Only fires in development/test (process.env.NODE_ENV !== \"production\").\n// ============================================================================\n\n/** Per-theme set of variant names that have already triggered a warning. */\nconst _warnedVariants = new WeakMap<Theme, Set<string>>()\n\nfunction warnOnce(theme: Theme, variant: string): void {\n if (process.env.NODE_ENV === \"production\") return\n let warned = _warnedVariants.get(theme)\n if (warned === undefined) {\n warned = new Set<string>()\n _warnedVariants.set(theme, warned)\n }\n if (warned.has(variant)) return\n warned.add(variant)\n const known = KNOWN_VARIANTS.join(\", \")\n // eslint-disable-next-line no-console\n console.warn(\n `[silvery] <Text variant=\"${variant}\"> — unknown variant, defaulting to bare. ` +\n `Known: ${known}. ` +\n `Register custom variants via <ThemeProvider tokens={{ variants: { ${variant}: {...} } }}>.`,\n )\n}\n\n// ============================================================================\n// Props\n// ============================================================================\n\nexport interface TextProps extends TextPropsType {\n /** Text content (string, number, or nested Text elements) */\n children?: ReactNode\n /**\n * Typography variant — pulls defaults from `theme.variants[variant]`.\n * Caller props always win over variant values (variant is the *default*).\n *\n * @example\n * ```tsx\n * <Text variant=\"h1\">Title</Text>\n * // → uses theme.variants.h1 as defaults ({ color: \"$fg-accent\", bold: true })\n *\n * <Text variant=\"h1\" color=\"$fg-success\">Done</Text>\n * // → color=\"$fg-success\" wins; bold still comes from variant\n * ```\n */\n variant?: KnownVariant\n}\n\n/**\n * Methods exposed via ref on Text component.\n */\nexport interface TextHandle {\n /** Get the underlying SilveryNode */\n getNode(): AgNode | null\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Text rendering component for terminal UIs.\n *\n * Supports forwardRef for imperative access to the underlying node.\n *\n * @example\n * ```tsx\n * // Basic text\n * <Text>Hello, world!</Text>\n *\n * // Colored text\n * <Text color=\"green\">Success!</Text>\n * <Text color=\"#ff6600\">Orange text</Text>\n *\n * // Styled text\n * <Text bold>Important</Text>\n * <Text italic underline>Emphasized</Text>\n *\n * // Combined styles\n * <Text color=\"red\" bold inverse>Alert!</Text>\n *\n * // Nested text with different styles\n * <Text>\n * Normal <Text bold>bold</Text> normal\n * </Text>\n *\n * // Truncation modes\n * <Text wrap=\"truncate\">This long text will be truncated...</Text>\n * <Text wrap=\"truncate-middle\">Long...text</Text>\n *\n * // With ref\n * const textRef = useRef<TextHandle>(null);\n * <Text ref={textRef}>Hello</Text>\n *\n * // With variant — typography presets from theme\n * <Text variant=\"h1\">Page Title</Text>\n * <Text variant=\"body-muted\">Caption text</Text>\n * <Text variant=\"h1\" color=\"$fg-success\">Done</Text> // caller color wins\n * ```\n */\nexport const Text = forwardRef(function Text(\n props: TextProps,\n ref: ForwardedRef<TextHandle>,\n): JSX.Element {\n const { children, variant, ...callerProps } = props\n const theme = useContext(ThemeContext)\n\n // Resolve variant defaults. Variant is the DEFAULT; caller props always win.\n //\n // Merge strategy (three passes):\n // 1. callerProps — base layer: all caller props including undefined values\n // (preserves non-style props like wrap, data-*, etc.)\n // 2. variantDefaults — overwrite only where callerProps was undefined\n // (fills in color/bold/etc when caller didn't specify)\n // 3. definedCallerProps — restore any explicitly provided caller overrides\n // (e.g. color=\"$fg-success\", bold={false} win over variant)\n //\n // Example: `<Text variant=\"h1\">T</Text>` (color not passed → undefined)\n // callerProps = { color: undefined }\n // variantDefaults = { color: \"$fg-accent\", bold: true }\n // definedCallerProps = {} (color=undefined excluded)\n // → { color: \"$fg-accent\", bold: true } ✓\n //\n // Example: `<Text variant=\"h1\" color=\"$fg-success\">T</Text>`\n // callerProps = { color: \"$fg-success\" }\n // variantDefaults = { color: \"$fg-accent\", bold: true }\n // definedCallerProps = { color: \"$fg-success\" }\n // → { color: \"$fg-success\", bold: true } ✓ (caller color wins)\n let styleProps = callerProps\n if (variant != null) {\n const resolved = theme.variants?.[variant]\n if (resolved === undefined) {\n warnOnce(theme, variant)\n }\n const variantDefaults = resolved ?? {}\n const definedCallerProps: Record<string, unknown> = {}\n for (const key of Object.keys(callerProps)) {\n const v = (callerProps as Record<string, unknown>)[key]\n if (v !== undefined) definedCallerProps[key] = v\n }\n styleProps = { ...callerProps, ...variantDefaults, ...definedCallerProps } as typeof callerProps\n }\n\n // For Text, we need to pass the ref through to the host element\n // The reconciler's getPublicInstance will return the SilveryNode\n // We wrap it in a TextHandle for type safety\n return (\n <silvery-text\n ref={(node: AgNode | null) => {\n // Handle both callback refs and RefObjects\n if (typeof ref === \"function\") {\n ref(node ? { getNode: () => node } : null)\n } else if (ref) {\n ref.current = node ? { getNode: () => node } : null\n }\n }}\n {...styleProps}\n >\n {children}\n </silvery-text>\n )\n})\n"],"mappings":";;;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-1,11 +1,11 @@
|
|
|
1
|
-
import { i as signal, n as computed } from "./src-
|
|
2
|
-
import { _ as rectEqual, c as hasObservedLayoutSignal, d as syncDecorationRects, p as syncRectSignals, s as hasLayoutSignals } from "./layout-signals-
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
1
|
+
import { i as signal, n as computed } from "./src-B6MuVlOK.mjs";
|
|
2
|
+
import { _ as rectEqual, c as hasObservedLayoutSignal, d as syncDecorationRects, p as syncRectSignals, s as hasLayoutSignals } from "./layout-signals-uQadGDmO.mjs";
|
|
3
|
+
import { Ct as isStrictEnabled, D as runWithMeasurer, E as parseAnsiText, I as wrapText, M as splitGraphemesAnsiAware, O as sliceByWidth, St as isStrictAnyEnabled, Xt as ansi256ToRgb, Yt as TerminalBuffer, _ as isLikelyEmoji, a as displayWidthAnsi, an as isDefaultBg, c as fixSgrAcrossWrappedLines, f as graphemeWidth, in as createTextFrame, j as splitGraphemes, k as sliceByWidthFromEnd, l as getActiveLineHeight, o as ensureEmojiPresentation, p as hasAnsi, qt as DEFAULT_BG, rn as createMutableCell, s as fixOsc8AcrossWrappedLines, t as canBreakAnywhere, v as isSoftBreakPoint, x as isWordBoundary } from "./unicode-X43-fdGF.mjs";
|
|
4
|
+
import { _ as kittyDeleteAllScrimPlacements, g as cupTo, h as buildScrimPixels, m as backdropPlacementId, p as resolveThemeColor, u as monoAttrsForColorString, v as kittyPlaceAt, y as kittyUploadScrimImage } from "./src-DorsnS70.mjs";
|
|
5
|
+
import { C as isDirty, S as isCurrentEpoch, _ as measureStats, b as getRenderEpoch, h as hasScrollDirty, m as clearDirtyTracking, v as collectPlainText, x as isAnyDirty, y as advanceRenderEpoch } from "./reconciler-lsTL1y8i.mjs";
|
|
6
|
+
import { r as getLayoutEngine } from "./layout-engine-BYp49XPD.mjs";
|
|
7
|
+
import "./src-DdGaRDi9.mjs";
|
|
8
|
+
import { t as ansi16DarkTheme } from "./schemes-C4SUgVea.mjs";
|
|
9
9
|
import { createLogger } from "loggily";
|
|
10
10
|
import { hexToOklch, mixSrgb, oklchToHex, relativeLuminance } from "@silvery/color";
|
|
11
11
|
import { appendFileSync } from "node:fs";
|
|
@@ -2682,7 +2682,7 @@ function getTextStyle(props) {
|
|
|
2682
2682
|
else if (typeof props.underline === "string") underlineStyle = props.underline;
|
|
2683
2683
|
else if (props.underline === true) underlineStyle = "single";
|
|
2684
2684
|
let bold = props.bold;
|
|
2685
|
-
let dim;
|
|
2685
|
+
let dim = props.internal_dim;
|
|
2686
2686
|
let italic = props.italic;
|
|
2687
2687
|
let underline = !!props.underline || !!underlineStyle;
|
|
2688
2688
|
let strikethrough = props.strikethrough;
|
|
@@ -4495,22 +4495,44 @@ function clearBgConflictWarnings() {
|
|
|
4495
4495
|
*/
|
|
4496
4496
|
function styleToAnsi(style) {
|
|
4497
4497
|
const parts = [];
|
|
4498
|
+
let bold = style.bold;
|
|
4499
|
+
let dim = style.dim;
|
|
4500
|
+
let italic = style.italic;
|
|
4501
|
+
let underline = style.underline;
|
|
4502
|
+
let underlineStyle = style.underlineStyle;
|
|
4503
|
+
let inverse = style.inverse;
|
|
4504
|
+
let strikethrough = style.strikethrough;
|
|
4505
|
+
if (getActiveColorLevel() === "mono") {
|
|
4506
|
+
const monoAttrs = getTextStyle({
|
|
4507
|
+
color: style.color,
|
|
4508
|
+
backgroundColor: style.backgroundColor
|
|
4509
|
+
}).attrs;
|
|
4510
|
+
if (monoAttrs.bold) bold = true;
|
|
4511
|
+
if (monoAttrs.dim) dim = true;
|
|
4512
|
+
if (monoAttrs.italic) italic = true;
|
|
4513
|
+
if (monoAttrs.underline) {
|
|
4514
|
+
underline = true;
|
|
4515
|
+
if (!underlineStyle) underlineStyle = "single";
|
|
4516
|
+
}
|
|
4517
|
+
if (monoAttrs.inverse) inverse = true;
|
|
4518
|
+
if (monoAttrs.strikethrough) strikethrough = true;
|
|
4519
|
+
}
|
|
4498
4520
|
if (style.color) {
|
|
4499
4521
|
const color = parseColor(style.color);
|
|
4500
4522
|
if (color !== null) if (typeof color === "number") parts.push(`38;5;${color}`);
|
|
4501
4523
|
else parts.push(`38;2;${color.r};${color.g};${color.b}`);
|
|
4502
4524
|
}
|
|
4503
|
-
if (
|
|
4504
|
-
if (
|
|
4505
|
-
if (
|
|
4506
|
-
if (
|
|
4525
|
+
if (bold) parts.push("1");
|
|
4526
|
+
if (dim) parts.push("2");
|
|
4527
|
+
if (italic) parts.push("3");
|
|
4528
|
+
if (underlineStyle) parts.push({
|
|
4507
4529
|
single: "4:1",
|
|
4508
4530
|
double: "4:2",
|
|
4509
4531
|
curly: "4:3",
|
|
4510
4532
|
dotted: "4:4",
|
|
4511
4533
|
dashed: "4:5"
|
|
4512
|
-
}[
|
|
4513
|
-
else if (
|
|
4534
|
+
}[underlineStyle] ?? "4");
|
|
4535
|
+
else if (underline) parts.push("4");
|
|
4514
4536
|
if (style.underlineColor) {
|
|
4515
4537
|
const underlineSource = style.underlineColor === "currentColor" || style.underlineColor === "inherit" ? style.color : style.underlineColor;
|
|
4516
4538
|
if (underlineSource) {
|
|
@@ -4519,8 +4541,8 @@ function styleToAnsi(style) {
|
|
|
4519
4541
|
else parts.push(`58;2;${ulColor.r};${ulColor.g};${ulColor.b}`);
|
|
4520
4542
|
}
|
|
4521
4543
|
}
|
|
4522
|
-
if (
|
|
4523
|
-
if (
|
|
4544
|
+
if (inverse) parts.push("7");
|
|
4545
|
+
if (strikethrough) parts.push("9");
|
|
4524
4546
|
if (style.overline) parts.push("53");
|
|
4525
4547
|
if (parts.length === 0) return "";
|
|
4526
4548
|
return `\x1b[${parts.join(";")}m`;
|
|
@@ -4554,7 +4576,7 @@ function mergeStyleContext(parent, childProps) {
|
|
|
4554
4576
|
color: effectiveChildColor ?? parent.color,
|
|
4555
4577
|
backgroundColor: childProps.backgroundColor ?? parent.backgroundColor,
|
|
4556
4578
|
bold: childProps.bold ?? parent.bold,
|
|
4557
|
-
dim: parent.dim,
|
|
4579
|
+
dim: childProps.internal_dim ?? parent.dim,
|
|
4558
4580
|
italic: childProps.italic ?? parent.italic,
|
|
4559
4581
|
underline: childUnderline ?? parent.underline,
|
|
4560
4582
|
underlineStyle: childUnderlineStyle ?? parent.underlineStyle,
|
|
@@ -5484,6 +5506,7 @@ function renderText(node, buffer, layout, props, nodeState, inheritedBg, inherit
|
|
|
5484
5506
|
color: props.color,
|
|
5485
5507
|
backgroundColor: props.backgroundColor,
|
|
5486
5508
|
bold: props.bold,
|
|
5509
|
+
dim: props.internal_dim,
|
|
5487
5510
|
italic: props.italic,
|
|
5488
5511
|
underline: rootUnderline,
|
|
5489
5512
|
underlineStyle: rootUnderlineStyle,
|
|
@@ -8724,4 +8747,4 @@ function createAg(root, options) {
|
|
|
8724
8747
|
//#endregion
|
|
8725
8748
|
export { printPassHistogram as _, setActiveColorLevel as a, INSTRUMENT as c, assertBoundedConvergence as d, beginConvergenceLoop as f, notePassCommit as g, logPass as h, parseColor as i, MAX_CONVERGENCE_PASSES as l, formatPassRingBreakdown as m, createRenderPostState as n, FRESH_LAYOUT_STRICT_SLUG as o, beginPass as p, hexToRgb$1 as r, markLayoutTreeDirty as s, createAg as t, appendHistogramJson as u, recordPassRing as v, resetPassHistogram as y };
|
|
8726
8749
|
|
|
8727
|
-
//# sourceMappingURL=ag-
|
|
8750
|
+
//# sourceMappingURL=ag-B-7XAHL8.mjs.map
|