@overlastic/react 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-PRESENT Hairyf<https://github.com/hairyf>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # @overlastic/react
2
+
3
+ @overlastic/react is used to define Overlay components in react and supports both imperative and declarative usage!
4
+
5
+ ## Install
6
+
7
+ With pnpm:
8
+ ```sh
9
+ pnpm add @overlastic/react
10
+ ```
11
+
12
+ With yarn:
13
+ ```sh
14
+ yarn add @overlastic/react
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ### Step 1: Define Component
20
+
21
+ ```tsx
22
+ // overlay.tsx
23
+ export function Component(props) {
24
+ const { visible, resolve, reject } = usePrograms({
25
+ // Duration of overlay duration, helps prevent premature component destruction
26
+ duration: 200,
27
+ })
28
+
29
+ return <div className={visible && 'is--visible'}>
30
+ <span onClick={() => resolve(`${props.title}:confirmed`)}> Confirm </span>
31
+ </div>
32
+ }
33
+ ```
34
+
35
+ ### Step 2: Create Overlay
36
+
37
+ You can convert the component into a modal dialog box by using the `defineOverlay` method, which allows you to call it in Javascript / Typescript.
38
+ ```ts
39
+ import { defineOverlay } from '@overlastic/react'
40
+ import { Component } from './overlay'
41
+
42
+ // Convert to imperative callback
43
+ const callback = defineOverlay(Component)
44
+ // Call the component and get the resolve callback value
45
+ const value = await callback({ title: 'callbackOverlay' })
46
+ // value === "callbackOverlay:confirmed"
47
+ ```
48
+
49
+ You can also directly call the component through `renderOverlay`, bypassing the `defineOverlay` method.
50
+
51
+ ```ts
52
+ import { renderOverlay } from '@overlastic/react'
53
+ import { Component } from './overlay'
54
+
55
+ const value = await renderOverlay(Component, {
56
+ title: 'usePrograms'
57
+ })
58
+ // value === "usePrograms:confirmed"
59
+ ```
60
+
61
+ ## Injection Holder
62
+
63
+ In addition to using `defineOverlay` and `renderOverlay` to create popup components, you can also use useOverlayHolder to create popup components within a component and inherit the current context of the application.
64
+
65
+ ```tsx
66
+ import { useOverlayHolder } from '@overlastic/react'
67
+ import { OverlayComponent } from './overlay'
68
+
69
+ export function Main() {
70
+ // Use useOverlayHolder(Component) to create a component holder that supports the current context.
71
+ const [holder, overlayApi] = useOverlayHolder(OverlayComponent)
72
+
73
+ function open() {
74
+ // Open the popup component
75
+ overlayApi()
76
+ .then((result) => {})
77
+ }
78
+ return (<>
79
+ <div onClick={open}> open </div>
80
+ {/* Mount the holder */}
81
+ {holder}
82
+ </>)
83
+ }
84
+ ```
85
+
86
+ ## Define Component
87
+
88
+ Components created using `@overlastic/react` support both imperative and declarative methods of calling. In addition to imperative methods, these components can also be used in JSX.
89
+
90
+ > This is an optional option that is very useful when porting old components.
91
+
92
+ ```tsx
93
+ // If using Typescript, use PropsWithOverlays to define props type
94
+ import type { PropsWithOverlays } from '@overlastic/react'
95
+ import { usePrograms } from '@overlastic/react'
96
+
97
+ export function Component(props: PropsWithOverlays<{ /* ...you props */ }>) {
98
+ const { visible, resolve, reject } = usePrograms({
99
+ // pass props to usePrograms for processing
100
+ props
101
+ })
102
+
103
+ return <div className={visible && 'is--visible'}>
104
+ ...
105
+ </div>
106
+ }
107
+ ```
108
+
109
+ Once the Overlay component has received props, the popup layer component can be used in JSX.
110
+
111
+ ```tsx
112
+ import { useState } from 'react'
113
+ import { Component } from './overlay'
114
+
115
+ export function Main() {
116
+ const [visible, setVisible] = useState(false)
117
+
118
+ function openOverlay() {
119
+ setVisible(true)
120
+ }
121
+
122
+ function onResolve(value) {
123
+ setVisible(false)
124
+ }
125
+
126
+ function onReject(value) {
127
+ setVisible(false)
128
+ }
129
+
130
+ return (
131
+ <Component visible={visible} onResolve={onResolve} onReject={onReject} />
132
+ )
133
+ }
134
+ ```
135
+
136
+ If you want to replace other fields and event names, you can do so using the `model` and `events` config of usePrograms.
137
+
138
+ ```jsx
139
+ function Component(props: { onOn?: Function; onNook?: Function; open: boolean }) {
140
+ const { visible, resolve, reject } = usePrograms({
141
+ events: { resolve: 'onOk', reject: 'onNook' },
142
+ model: 'open',
143
+ props,
144
+ })
145
+ // ...
146
+ }
147
+ ```
148
+
149
+ ## Customized
150
+
151
+ You can use `@overlastic/react` to modify existing components or component libraries
152
+
153
+ Take [antd(drawer)](https://ant.design/components/drawer-cn) as an example:
154
+
155
+ ```tsx
156
+ import type { PropsWithOverlays } from '@overlastic/react'
157
+ import { usePrograms } from '@overlastic/react'
158
+ import { Button, Drawer } from 'antd'
159
+
160
+ function MyDrawer(props: PropsWithOverlays<{ title: string }>) {
161
+ const { visible, resolve, reject } = usePrograms({
162
+ duration: 200,
163
+ props,
164
+ })
165
+
166
+ return (
167
+ <Drawer title={props.title} onClose={reject} open={visible}>
168
+ {/* Custom contents.... */}
169
+ <Button type="primary" onClick={() => resolve(`${props.title}:confirmed`)}>
170
+ Confirm
171
+ </Button>
172
+ </Drawer>
173
+ )
174
+ }
175
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ defineOverlay: () => defineOverlay,
24
+ renderOverlay: () => renderOverlay,
25
+ useOverlay: () => useOverlay,
26
+ useOverlayHolder: () => useOverlayHolder,
27
+ usePrograms: () => usePrograms
28
+ });
29
+ module.exports = __toCommonJS(src_exports);
30
+
31
+ // src/composable/usePrograms.ts
32
+ var import_core2 = require("@overlastic/core");
33
+ var import_react2 = require("react");
34
+
35
+ // src/internal/contexts.tsx
36
+ var import_core = require("@overlastic/core");
37
+ var import_react = require("react");
38
+ var ScriptsContext = (0, import_react.createContext)({
39
+ reject: import_core.noop,
40
+ resolve: import_core.noop,
41
+ setVisible: import_core.noop,
42
+ vanish: import_core.noop,
43
+ visible: false,
44
+ in_dec: true
45
+ });
46
+ var InstancesContext = (0, import_react.createContext)({});
47
+ InstancesContext.displayName = "OverlayInstancesContext";
48
+ ScriptsContext.displayName = "OverlayScriptsContext";
49
+
50
+ // src/internal/utils.ts
51
+ function defineAnonymousComponent(component) {
52
+ return { "--": component }["--"];
53
+ }
54
+
55
+ // src/composable/usePrograms.ts
56
+ function usePrograms(options = {}) {
57
+ const { immediate = true, duration = 0, automatic = true } = options;
58
+ const context = (0, import_react2.useContext)(ScriptsContext);
59
+ const dec = Reflect.get(context, "in_dec");
60
+ const overlay = dec ? useDeclarative(options) : context;
61
+ const { setVisible, vanish, deferred } = overlay;
62
+ async function destroy() {
63
+ setVisible(false);
64
+ await (0, import_core2.delay)(duration);
65
+ vanish == null ? void 0 : vanish();
66
+ return Promise.resolve();
67
+ }
68
+ useMount(() => immediate && setVisible(true));
69
+ useMount(() => {
70
+ if (!dec && automatic)
71
+ deferred == null ? void 0 : deferred.then(destroy).catch(destroy);
72
+ });
73
+ return overlay;
74
+ }
75
+ function useDeclarative(options = {}) {
76
+ const { props = {}, model = "visible", events = {} } = options;
77
+ const { reject = "onReject", resolve = "onResolve" } = events;
78
+ const _reject = (value) => {
79
+ var _a;
80
+ (_a = props[reject]) == null ? void 0 : _a.call(props, value);
81
+ };
82
+ const _resolve = (value) => {
83
+ var _a;
84
+ (_a = props[resolve]) == null ? void 0 : _a.call(props, value);
85
+ };
86
+ return {
87
+ reject: _reject,
88
+ resolve: _resolve,
89
+ visible: props[model],
90
+ vanish: import_core2.noop,
91
+ setVisible: import_core2.noop,
92
+ deferred: void 0
93
+ };
94
+ }
95
+ function useMount(callback = import_core2.noop) {
96
+ (0, import_react2.useEffect)(() => callback(), []);
97
+ }
98
+
99
+ // src/composable/useScripts.ts
100
+ var import_react3 = require("react");
101
+ function useScripts(options) {
102
+ const { reject: _reject } = options.deferred || {};
103
+ const { vanish: _vanish } = options;
104
+ const [visible, setVisible] = (0, import_react3.useState)(false);
105
+ function vanish() {
106
+ _vanish == null ? void 0 : _vanish();
107
+ _reject == null ? void 0 : _reject();
108
+ }
109
+ return {
110
+ resolve: options.deferred.resolve,
111
+ reject: options.deferred.reject,
112
+ deferred: options.deferred,
113
+ setVisible,
114
+ visible,
115
+ vanish
116
+ };
117
+ }
118
+
119
+ // src/composable/useOverlay.tsx
120
+ var import_core3 = require("@overlastic/core");
121
+ var import_react4 = require("react");
122
+ var import_pascal_case = require("pascal-case");
123
+ var import_react_dom = require("react-dom");
124
+ var import_jsx_runtime = require("react/jsx-runtime");
125
+ var { define } = (0, import_core3.createConstructor)((Instance, props, options) => {
126
+ const { container, id, deferred, render, vanish: _vanish } = options;
127
+ const InstanceWithProvider = defineAnonymousComponent(() => {
128
+ const content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
129
+ ScriptsContext.Provider,
130
+ {
131
+ value: useScripts({ deferred, vanish }),
132
+ ...{ id: (0, import_pascal_case.pascalCase)(id) },
133
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Instance, { ...props })
134
+ }
135
+ );
136
+ return (0, import_react_dom.createPortal)(content, container);
137
+ });
138
+ function vanish() {
139
+ _vanish(InstanceWithProvider);
140
+ container.remove();
141
+ }
142
+ render(InstanceWithProvider, props);
143
+ });
144
+ function useOverlay(Instance) {
145
+ const { render, vanish } = (0, import_react4.useContext)(InstancesContext);
146
+ return define(Instance, { render, vanish });
147
+ }
148
+
149
+ // src/composable/useOverlayHolder.tsx
150
+ var import_core4 = require("@overlastic/core");
151
+ var import_pascal_case2 = require("pascal-case");
152
+ var import_react5 = require("react");
153
+ var import_react_dom2 = require("react-dom");
154
+ var import_jsx_runtime2 = require("react/jsx-runtime");
155
+ function useOverlayHolder(Component, options = {}) {
156
+ const { callback, scripts, props, refresh } = useRefreshMetadata();
157
+ const name = (0, import_core4.defineName)(options.id, options.autoIncrement);
158
+ function render() {
159
+ const root = options.root || (typeof document !== "undefined" ? document.body : void 0);
160
+ const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { id: name, children: [
161
+ " ",
162
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ...props }),
163
+ " "
164
+ ] });
165
+ return options.root !== false && root ? (0, import_react_dom2.createPortal)(content, root) : content;
166
+ }
167
+ const holder = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
168
+ ScriptsContext.Provider,
169
+ {
170
+ value: scripts,
171
+ ...{ id: (0, import_pascal_case2.pascalCase)(name) },
172
+ children: refresh ? render() : null
173
+ }
174
+ );
175
+ return [holder, callback];
176
+ }
177
+ function useRefreshMetadata() {
178
+ const [props, setProps] = (0, import_react5.useState)();
179
+ const [refresh, setRefresh] = (0, import_react5.useState)(false);
180
+ const [visible, setVisible] = (0, import_react5.useState)(false);
181
+ const deferred = (0, import_react5.useRef)({});
182
+ const scripts = {
183
+ deferred: deferred.current,
184
+ resolve: deferred.current.resolve,
185
+ reject: deferred.current.reject,
186
+ vanish,
187
+ visible,
188
+ setVisible
189
+ };
190
+ function vanish() {
191
+ var _a;
192
+ setRefresh(false);
193
+ setProps({});
194
+ (_a = scripts.reject) == null ? void 0 : _a.call(scripts);
195
+ }
196
+ async function callback(props2) {
197
+ deferred.current = (0, import_core4.createDeferred)();
198
+ setProps(props2);
199
+ setRefresh(true);
200
+ return deferred.current;
201
+ }
202
+ return { callback, scripts, props, refresh };
203
+ }
204
+
205
+ // src/define/constructor.tsx
206
+ var import_core5 = require("@overlastic/core");
207
+ var import_client = require("react-dom/client");
208
+ var import_pascal_case3 = require("pascal-case");
209
+ var import_jsx_runtime3 = require("react/jsx-runtime");
210
+ var constructor = (0, import_core5.createConstructor)((Instance, props, options) => {
211
+ const { container, id, deferred } = options;
212
+ const root = (0, import_client.createRoot)(container);
213
+ const Provider = defineAnonymousComponent(() => {
214
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
215
+ ScriptsContext.Provider,
216
+ {
217
+ value: useScripts({ deferred, vanish }),
218
+ ...{ id: (0, import_pascal_case3.pascalCase)(id) },
219
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Instance, { ...props })
220
+ }
221
+ );
222
+ });
223
+ function vanish() {
224
+ const handle = requestAnimationFrame(() => {
225
+ root.unmount();
226
+ container.remove();
227
+ cancelAnimationFrame(handle);
228
+ });
229
+ }
230
+ root.render(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Provider, {}));
231
+ });
232
+
233
+ // src/define/index.ts
234
+ var defineOverlay = constructor.define;
235
+ var renderOverlay = constructor.render;
236
+ // Annotate the CommonJS export names for ESM import in node:
237
+ 0 && (module.exports = {
238
+ defineOverlay,
239
+ renderOverlay,
240
+ useOverlay,
241
+ useOverlayHolder,
242
+ usePrograms
243
+ });
@@ -0,0 +1,80 @@
1
+ import * as react from 'react';
2
+ import { Dispatch, SetStateAction, FC } from 'react';
3
+ import * as _overlastic_core from '@overlastic/core';
4
+ import { ImperativeOverlay, MountOptions } from '@overlastic/core';
5
+
6
+ type PropsWidthOverlays<P = unknown> = P & {
7
+ visible?: boolean;
8
+ onReject?: (value: any) => void;
9
+ onResolve?: (value: any) => void;
10
+ };
11
+
12
+ interface PromptifyEvents {
13
+ /**
14
+ * reject event name used by the template
15
+ *
16
+ * @default 'onReject'
17
+ */
18
+ reject?: string;
19
+ /**
20
+ * resolve event name used by the template
21
+ *
22
+ * @default 'onResolve'
23
+ */
24
+ resolve?: string;
25
+ }
26
+ interface ProgramsOptions {
27
+ /** animation duration to avoid premature destruction of components */
28
+ duration?: number;
29
+ /** whether to set visible to true immediately */
30
+ immediate?: boolean;
31
+ /**
32
+ * pass in the required props on jsx
33
+ */
34
+ props?: PropsWidthOverlays;
35
+ /**
36
+ * fields used by jsx show
37
+ *
38
+ * @default 'visible'
39
+ */
40
+ model?: string;
41
+ /**
42
+ * props use event name
43
+ */
44
+ events?: PromptifyEvents;
45
+ /**
46
+ * whether to automatically handle components based on visible and duration
47
+ *
48
+ * @default true
49
+ */
50
+ automatic?: boolean;
51
+ }
52
+ interface ProgramsReturn {
53
+ /** the notification reject, modify visible, and destroy it after the duration ends */
54
+ reject: Function;
55
+ /** the notification resolve, modify visible, and destroy it after the duration ends */
56
+ resolve: Function;
57
+ /** destroy the current instance (immediately) */
58
+ vanish: Function;
59
+ /** visible control popup display and hide */
60
+ visible: boolean;
61
+ /** visible dispatch change */
62
+ setVisible: Dispatch<SetStateAction<boolean>>;
63
+ /** current deferred */
64
+ deferred?: Promise<any>;
65
+ }
66
+ declare function usePrograms(options?: ProgramsOptions): ProgramsReturn;
67
+
68
+ interface Options {
69
+ render: (instance: FC, props: any) => void;
70
+ vanish: (instance: FC) => void;
71
+ }
72
+ declare function useOverlay<Props, Resolved>(Instance: FC<Props>): _overlastic_core.ImperativeOverlay<Props, Resolved, Options>;
73
+
74
+ type InjectionHolder<Props, Resolved> = [JSX.Element, ImperativeOverlay<Props, Resolved>];
75
+ declare function useOverlayHolder<Props, Resolved = void>(Component: FC<Props>, options?: MountOptions): InjectionHolder<Props, Resolved>;
76
+
77
+ declare const defineOverlay: <Props, Resolved = void>(instance: react.FC<any>, options?: _overlastic_core.GlobalMountOptions | undefined) => _overlastic_core.ImperativeOverlay<Props, Resolved, {}>;
78
+ declare const renderOverlay: <Props, Resolved = void>(instance: react.FC<any>, props?: Props | undefined, options?: _overlastic_core.GlobalMountOptions | undefined) => Promise<Resolved>;
79
+
80
+ export { type InjectionHolder, type ProgramsOptions, type ProgramsReturn, type PropsWidthOverlays, defineOverlay, renderOverlay, useOverlay, useOverlayHolder, usePrograms };
@@ -0,0 +1,80 @@
1
+ import * as react from 'react';
2
+ import { Dispatch, SetStateAction, FC } from 'react';
3
+ import * as _overlastic_core from '@overlastic/core';
4
+ import { ImperativeOverlay, MountOptions } from '@overlastic/core';
5
+
6
+ type PropsWidthOverlays<P = unknown> = P & {
7
+ visible?: boolean;
8
+ onReject?: (value: any) => void;
9
+ onResolve?: (value: any) => void;
10
+ };
11
+
12
+ interface PromptifyEvents {
13
+ /**
14
+ * reject event name used by the template
15
+ *
16
+ * @default 'onReject'
17
+ */
18
+ reject?: string;
19
+ /**
20
+ * resolve event name used by the template
21
+ *
22
+ * @default 'onResolve'
23
+ */
24
+ resolve?: string;
25
+ }
26
+ interface ProgramsOptions {
27
+ /** animation duration to avoid premature destruction of components */
28
+ duration?: number;
29
+ /** whether to set visible to true immediately */
30
+ immediate?: boolean;
31
+ /**
32
+ * pass in the required props on jsx
33
+ */
34
+ props?: PropsWidthOverlays;
35
+ /**
36
+ * fields used by jsx show
37
+ *
38
+ * @default 'visible'
39
+ */
40
+ model?: string;
41
+ /**
42
+ * props use event name
43
+ */
44
+ events?: PromptifyEvents;
45
+ /**
46
+ * whether to automatically handle components based on visible and duration
47
+ *
48
+ * @default true
49
+ */
50
+ automatic?: boolean;
51
+ }
52
+ interface ProgramsReturn {
53
+ /** the notification reject, modify visible, and destroy it after the duration ends */
54
+ reject: Function;
55
+ /** the notification resolve, modify visible, and destroy it after the duration ends */
56
+ resolve: Function;
57
+ /** destroy the current instance (immediately) */
58
+ vanish: Function;
59
+ /** visible control popup display and hide */
60
+ visible: boolean;
61
+ /** visible dispatch change */
62
+ setVisible: Dispatch<SetStateAction<boolean>>;
63
+ /** current deferred */
64
+ deferred?: Promise<any>;
65
+ }
66
+ declare function usePrograms(options?: ProgramsOptions): ProgramsReturn;
67
+
68
+ interface Options {
69
+ render: (instance: FC, props: any) => void;
70
+ vanish: (instance: FC) => void;
71
+ }
72
+ declare function useOverlay<Props, Resolved>(Instance: FC<Props>): _overlastic_core.ImperativeOverlay<Props, Resolved, Options>;
73
+
74
+ type InjectionHolder<Props, Resolved> = [JSX.Element, ImperativeOverlay<Props, Resolved>];
75
+ declare function useOverlayHolder<Props, Resolved = void>(Component: FC<Props>, options?: MountOptions): InjectionHolder<Props, Resolved>;
76
+
77
+ declare const defineOverlay: <Props, Resolved = void>(instance: react.FC<any>, options?: _overlastic_core.GlobalMountOptions | undefined) => _overlastic_core.ImperativeOverlay<Props, Resolved, {}>;
78
+ declare const renderOverlay: <Props, Resolved = void>(instance: react.FC<any>, props?: Props | undefined, options?: _overlastic_core.GlobalMountOptions | undefined) => Promise<Resolved>;
79
+
80
+ export { type InjectionHolder, type ProgramsOptions, type ProgramsReturn, type PropsWidthOverlays, defineOverlay, renderOverlay, useOverlay, useOverlayHolder, usePrograms };