@tooee/layout 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-layout.d.ts +1 -9
- package/dist/app-layout.d.ts.map +1 -1
- package/dist/app-layout.js +2 -8
- package/dist/app-layout.js.map +1 -1
- package/dist/app-layout.public-contract.typecheck.d.ts +17 -0
- package/dist/app-layout.public-contract.typecheck.d.ts.map +1 -0
- package/dist/app-layout.public-contract.typecheck.js +2 -0
- package/dist/app-layout.public-contract.typecheck.js.map +1 -0
- package/package.json +6 -6
- package/src/app-layout.public-contract.typecheck.ts +20 -0
- package/src/app-layout.tsx +5 -19
package/dist/app-layout.d.ts
CHANGED
|
@@ -18,16 +18,8 @@ export interface AppLayoutProps {
|
|
|
18
18
|
};
|
|
19
19
|
/** Configure the optional scrollbox used for the main content. */
|
|
20
20
|
scroll?: AppLayoutScroll;
|
|
21
|
-
/** @deprecated Use `scroll.ref` instead. */
|
|
22
|
-
scrollRef?: RefObject<ScrollBoxRenderable | null>;
|
|
23
|
-
/** @deprecated Move these options into `scroll`. */
|
|
24
|
-
scrollProps?: {
|
|
25
|
-
stickyScroll?: boolean;
|
|
26
|
-
stickyStart?: "bottom" | "top";
|
|
27
|
-
focused?: boolean;
|
|
28
|
-
};
|
|
29
21
|
searchBar?: SearchState;
|
|
30
22
|
children: ReactNode;
|
|
31
23
|
}
|
|
32
|
-
export declare const AppLayout: ({ titleBar, statusBar, scroll,
|
|
24
|
+
export declare const AppLayout: ({ titleBar, statusBar, scroll, searchBar, children, }: AppLayoutProps) => ReactNode;
|
|
33
25
|
//# sourceMappingURL=app-layout.d.ts.map
|
package/dist/app-layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-layout.d.ts","sourceRoot":"","sources":["../src/app-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CA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,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,SAAS,EAAE;QAAE,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IACtC,kEAAkE;IAClE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAaD,eAAO,MAAM,SAAS,0DAMnB,cAAc,KAAG,SAiDnB,CAAC"}
|
package/dist/app-layout.js
CHANGED
|
@@ -13,22 +13,16 @@ const hasRenderableOverlay = function hasRenderableOverlay(overlay) {
|
|
|
13
13
|
overlay !== 0 &&
|
|
14
14
|
overlay !== 0n);
|
|
15
15
|
};
|
|
16
|
-
export const AppLayout = function AppLayout({ titleBar, statusBar, scroll,
|
|
17
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported during its deprecation window
|
|
18
|
-
scrollRef,
|
|
19
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported during its deprecation window
|
|
20
|
-
scrollProps, searchBar, children, }) {
|
|
16
|
+
export const AppLayout = function AppLayout({ titleBar, statusBar, scroll, searchBar, children, }) {
|
|
21
17
|
const { theme } = useTheme();
|
|
22
18
|
const contextOverlay = useCurrentOverlay();
|
|
23
|
-
const resolvedScrollRef = scroll?.ref ?? scrollRef;
|
|
24
|
-
const resolvedScrollProps = scroll ?? scrollProps;
|
|
25
19
|
const handleSearchQueryChange = (query) => {
|
|
26
20
|
searchBar?.setSearchQuery(query);
|
|
27
21
|
};
|
|
28
22
|
const handleSearchSubmit = () => {
|
|
29
23
|
searchBar?.submitSearch();
|
|
30
24
|
};
|
|
31
|
-
return (_jsxs("box", { flexDirection: "column", width: "100%", height: "100%", backgroundColor: theme.background, children: [titleBar && _jsx(TitleBar, { title: titleBar.title, subtitle: titleBar.subtitle }), _jsxs("box", { style: { flexGrow: 1, position: "relative" }, children: [
|
|
25
|
+
return (_jsxs("box", { flexDirection: "column", width: "100%", height: "100%", backgroundColor: theme.background, children: [titleBar && _jsx(TitleBar, { title: titleBar.title, subtitle: titleBar.subtitle }), _jsxs("box", { style: { flexGrow: 1, position: "relative" }, children: [scroll ? (_jsx("scrollbox", { ref: scroll.ref, style: { flexGrow: 1 }, stickyScroll: scroll.stickyScroll, stickyStart: scroll.stickyStart, focused: scroll.focused ?? true, children: children })) : (_jsx("box", { style: { flexGrow: 1, overflow: "hidden" }, children: children })), hasRenderableOverlay(contextOverlay) && (_jsx("box", { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", children: contextOverlay })), _jsx(ToastContainer, {})] }), searchBar?.searchActive === true ? (_jsx(SearchBar, { query: searchBar.searchQuery, onQueryChange: handleSearchQueryChange, onSubmit: handleSearchSubmit, onCancel: () => {
|
|
32
26
|
searchBar.setSearchQuery("");
|
|
33
27
|
}, matchCount: searchBar.matchingLines.length, currentMatch: searchBar.currentMatchIndex })) : (_jsx(StatusBar, { items: statusBar.items }))] }));
|
|
34
28
|
};
|
package/dist/app-layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-layout.js","sourceRoot":"","sources":["../src/app-layout.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"app-layout.js","sourceRoot":"","sources":["../src/app-layout.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,E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AAC,CAAC,CAAC,CACR,oBACE,GAAG,EAAE,MAAM,CAAC,GAAG,EACf,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EACtB,YAAY,EAAE,MAAM,CAAC,YAAY,EACjC,WAAW,EAAE,MAAM,CAAC,WAAW,EAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,YAE9B,QAAQ,GACC,CACb,CAAC,CAAC,CAAC,CACF,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAG,QAAQ,GAAO,CAClE,EACA,oBAAoB,CAAC,cAAc,CAAC,IAAI,CACvC,cAAK,QAAQ,EAAC,UAAU,EAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,YACjE,cAAc,GACX,CACP,EACD,KAAC,cAAc,KAAG,IACd,EACL,SAAS,EAAE,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAClC,KAAC,SAAS,IACR,KAAK,EAAE,SAAS,CAAC,WAAW,EAC5B,aAAa,EAAE,uBAAuB,EACtC,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,GAAG,EAAE;oBACb,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC,EACD,UAAU,EAAE,SAAS,CAAC,aAAa,CAAC,MAAM,EAC1C,YAAY,EAAE,SAAS,CAAC,iBAAiB,GACzC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,KAAK,EAAE,SAAS,CAAC,KAAK,GAAI,CACtC,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Compile-time checks for AppLayout's 0.9 scroll configuration. */
|
|
2
|
+
import type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
|
|
3
|
+
type Assert<T extends true> = T;
|
|
4
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
5
|
+
type Has<TKeys, TName> = [Extract<TKeys, TName>] extends [never] ? false : true;
|
|
6
|
+
type LayoutKeys = keyof AppLayoutProps;
|
|
7
|
+
type ScrollKeys = keyof AppLayoutScroll;
|
|
8
|
+
type RetainedScrollProp = Assert<Has<LayoutKeys, "scroll">>;
|
|
9
|
+
type RemovedScrollAliases = Assert<IsNever<Extract<LayoutKeys, "scrollProps" | "scrollRef">>>;
|
|
10
|
+
type NestedScrollOptions = Assert<Has<ScrollKeys, "focused" | "ref" | "stickyScroll" | "stickyStart">>;
|
|
11
|
+
export type AppLayoutPublicContractChecks = [
|
|
12
|
+
RetainedScrollProp,
|
|
13
|
+
RemovedScrollAliases,
|
|
14
|
+
NestedScrollOptions
|
|
15
|
+
];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=app-layout.public-contract.typecheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-layout.public-contract.typecheck.d.ts","sourceRoot":"","sources":["../src/app-layout.public-contract.typecheck.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAChC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AACrD,KAAK,GAAG,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AAEhF,KAAK,UAAU,GAAG,MAAM,cAAc,CAAC;AACvC,KAAK,UAAU,GAAG,MAAM,eAAe,CAAC;AACxC,KAAK,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC5D,KAAK,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAC9F,KAAK,mBAAmB,GAAG,MAAM,CAC/B,GAAG,CAAC,UAAU,EAAE,SAAS,GAAG,KAAK,GAAG,cAAc,GAAG,aAAa,CAAC,CACpE,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-layout.public-contract.typecheck.js","sourceRoot":"","sources":["../src/app-layout.public-contract.typecheck.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tooee/layout",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Standard app chrome (title bar, status bar) for Tooee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"typecheck": "tsc --noEmit"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@tooee/commands": "0.
|
|
42
|
-
"@tooee/overlays": "0.
|
|
43
|
-
"@tooee/search": "0.
|
|
44
|
-
"@tooee/themes": "0.
|
|
45
|
-
"@tooee/toasts": "0.
|
|
41
|
+
"@tooee/commands": "0.9.0",
|
|
42
|
+
"@tooee/overlays": "0.9.0",
|
|
43
|
+
"@tooee/search": "0.9.0",
|
|
44
|
+
"@tooee/themes": "0.9.0",
|
|
45
|
+
"@tooee/toasts": "0.9.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@opentui/core": "^0.5.1",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Compile-time checks for AppLayout's 0.9 scroll configuration. */
|
|
2
|
+
import type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
|
|
3
|
+
|
|
4
|
+
type Assert<T extends true> = T;
|
|
5
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
6
|
+
type Has<TKeys, TName> = [Extract<TKeys, TName>] extends [never] ? false : true;
|
|
7
|
+
|
|
8
|
+
type LayoutKeys = keyof AppLayoutProps;
|
|
9
|
+
type ScrollKeys = keyof AppLayoutScroll;
|
|
10
|
+
type RetainedScrollProp = Assert<Has<LayoutKeys, "scroll">>;
|
|
11
|
+
type RemovedScrollAliases = Assert<IsNever<Extract<LayoutKeys, "scrollProps" | "scrollRef">>>;
|
|
12
|
+
type NestedScrollOptions = Assert<
|
|
13
|
+
Has<ScrollKeys, "focused" | "ref" | "stickyScroll" | "stickyStart">
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
export type AppLayoutPublicContractChecks = [
|
|
17
|
+
RetainedScrollProp,
|
|
18
|
+
RemovedScrollAliases,
|
|
19
|
+
NestedScrollOptions,
|
|
20
|
+
];
|
package/src/app-layout.tsx
CHANGED
|
@@ -21,14 +21,6 @@ export interface AppLayoutProps {
|
|
|
21
21
|
statusBar: { items: StatusBarItem[] };
|
|
22
22
|
/** Configure the optional scrollbox used for the main content. */
|
|
23
23
|
scroll?: AppLayoutScroll;
|
|
24
|
-
/** @deprecated Use `scroll.ref` instead. */
|
|
25
|
-
scrollRef?: RefObject<ScrollBoxRenderable | null>;
|
|
26
|
-
/** @deprecated Move these options into `scroll`. */
|
|
27
|
-
scrollProps?: {
|
|
28
|
-
stickyScroll?: boolean;
|
|
29
|
-
stickyStart?: "bottom" | "top";
|
|
30
|
-
focused?: boolean;
|
|
31
|
-
};
|
|
32
24
|
searchBar?: SearchState;
|
|
33
25
|
children: ReactNode;
|
|
34
26
|
}
|
|
@@ -48,17 +40,11 @@ export const AppLayout = function AppLayout({
|
|
|
48
40
|
titleBar,
|
|
49
41
|
statusBar,
|
|
50
42
|
scroll,
|
|
51
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported during its deprecation window
|
|
52
|
-
scrollRef,
|
|
53
|
-
// oxlint-disable-next-line typescript/no-deprecated -- compatibility alias remains supported during its deprecation window
|
|
54
|
-
scrollProps,
|
|
55
43
|
searchBar,
|
|
56
44
|
children,
|
|
57
45
|
}: AppLayoutProps): ReactNode {
|
|
58
46
|
const { theme } = useTheme();
|
|
59
47
|
const contextOverlay = useCurrentOverlay();
|
|
60
|
-
const resolvedScrollRef = scroll?.ref ?? scrollRef;
|
|
61
|
-
const resolvedScrollProps = scroll ?? scrollProps;
|
|
62
48
|
const handleSearchQueryChange = (query: string): void => {
|
|
63
49
|
searchBar?.setSearchQuery(query);
|
|
64
50
|
};
|
|
@@ -69,13 +55,13 @@ export const AppLayout = function AppLayout({
|
|
|
69
55
|
<box flexDirection="column" width="100%" height="100%" backgroundColor={theme.background}>
|
|
70
56
|
{titleBar && <TitleBar title={titleBar.title} subtitle={titleBar.subtitle} />}
|
|
71
57
|
<box style={{ flexGrow: 1, position: "relative" }}>
|
|
72
|
-
{
|
|
58
|
+
{scroll ? (
|
|
73
59
|
<scrollbox
|
|
74
|
-
ref={
|
|
60
|
+
ref={scroll.ref}
|
|
75
61
|
style={{ flexGrow: 1 }}
|
|
76
|
-
stickyScroll={
|
|
77
|
-
stickyStart={
|
|
78
|
-
focused={
|
|
62
|
+
stickyScroll={scroll.stickyScroll}
|
|
63
|
+
stickyStart={scroll.stickyStart}
|
|
64
|
+
focused={scroll.focused ?? true}
|
|
79
65
|
>
|
|
80
66
|
{children}
|
|
81
67
|
</scrollbox>
|