@gorilla-engine-sdk/ge-labeled-components 0.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.
- package/LICENSE.md +64 -0
- package/README.md +236 -0
- package/dist/components/LabeledComboBox.d.ts +36 -0
- package/dist/components/LabeledComboBox.js +70 -0
- package/dist/components/LabeledKnob.d.ts +40 -0
- package/dist/components/LabeledKnob.js +75 -0
- package/dist/components/LabeledMeterSlider.d.ts +53 -0
- package/dist/components/LabeledMeterSlider.js +76 -0
- package/dist/components/LabeledRTToggle.d.ts +36 -0
- package/dist/components/LabeledRTToggle.js +82 -0
- package/dist/components/LabeledSlider.d.ts +38 -0
- package/dist/components/LabeledSlider.js +75 -0
- package/dist/components/LabeledToggle.d.ts +35 -0
- package/dist/components/LabeledToggle.js +70 -0
- package/dist/core/LabeledComponent.d.ts +129 -0
- package/dist/core/LabeledComponent.js +90 -0
- package/dist/core/useLabelValue.d.ts +79 -0
- package/dist/core/useLabelValue.js +172 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +29 -0
- package/package.json +43 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LabeledMeterSlider = LabeledMeterSlider;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const LabeledComponent_1 = require("./../core/LabeledComponent");
|
|
39
|
+
const useLabelValue_1 = require("../core/useLabelValue");
|
|
40
|
+
/**
|
|
41
|
+
* A slider control combined with a level meter and text/value labels.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* This component overlays a slider on top of a level meter, useful for
|
|
45
|
+
* volume faders or other controls where you want to show both the
|
|
46
|
+
* current setting (slider) and a live level (meter).
|
|
47
|
+
*
|
|
48
|
+
* The slider binds to `instrumentProp` while the meter binds to `meterProp`,
|
|
49
|
+
* allowing them to display different parameters.
|
|
50
|
+
*
|
|
51
|
+
* @param props - Configuration for the labeled meter slider
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <LabeledMeterSlider
|
|
56
|
+
* x={50} y={50} width={50} height={250}
|
|
57
|
+
* instrument={instrument}
|
|
58
|
+
* instrumentProp={instrument.master_volume}
|
|
59
|
+
* meterProp={instrument.master_level_l}
|
|
60
|
+
* textLabel={{ y: 220, height: 20, text: "Master" }}
|
|
61
|
+
* valueLabel={{ y: 240, height: 20 }}
|
|
62
|
+
* meter={{ y: 0, width: 30, height: 200, style: "meter_default" }}
|
|
63
|
+
* slider={{ y: 0, width: 40, height: 200, style: "slider_transparent" }}
|
|
64
|
+
* />
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
function LabeledMeterSlider(props) {
|
|
68
|
+
const { instrument, instrumentProp, meter, slider, textLabel, valueLabel, ...container } = props;
|
|
69
|
+
const { labelText, labelVisible, valueText, valueVisible, onMouseEnter, onMouseExit, onMouseDown, onMouseUp, onValueChange, } = (0, useLabelValue_1.useLabelValue)(props);
|
|
70
|
+
return (React.createElement(React.Fragment, null,
|
|
71
|
+
React.createElement(LabeledComponent_1.LabeledComponent, { ...props, labelText: labelText, labelVisible: labelVisible, textLabel: props.textLabel, valueText: valueText, valueVisible: valueVisible, valueLabel: props.valueLabel },
|
|
72
|
+
React.createElement("geLevelMeter", { ...props.meter, bindings: props.meterProp ? { value: (0, LabeledComponent_1.getNativeBinding)(props.meterProp) } : {} }),
|
|
73
|
+
props.meterMask && React.createElement("geLabel", { interceptsMouseClicks: false, ...props.meterMask }),
|
|
74
|
+
React.createElement("geSlider", { onMouseEnter: onMouseEnter, onMouseExit: onMouseExit, onMouseDown: onMouseDown, onMouseUp: onMouseUp, ...props.slider, bindings: props.instrumentProp ? { value: (0, LabeledComponent_1.getNativeBinding)(props.instrumentProp) } : {} }))));
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGFiZWxlZE1ldGVyU2xpZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbXBvbmVudHMvTGFiZWxlZE1ldGVyU2xpZGVyLnRzeCJdLCJuY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7WUFFRCxLQUFLLENBQUMsU0FBUyxJQUFJLGlDQUFTLHFCQUFxQixFQUFFLEtBQUssS0FBTSxLQUFLLENBQUMsU0FBUyxHQUFJO1lBRWxGLGtDQUNFLFlBQVksRUFBRSxZQUFZLEVBQzFCLFdBQVcsRUFBRSxXQUFXLEVBQ3hCLFdBQVcsRUFBRSxXQUFXLEVBQ3hCLFNBQVMsRUFBRSxTQUFTLEtBQ2hCLEtBQUssQ0FBQyxNQUFNLEVBQ2hCLFFBQVEsRUFBRSxLQUFLLENBQUMsY0FBYyxDQUFDLENBQUMsQ0FBQyxFQUFFLEtBQUssRUFBRSxJQUFBLG1DQUFnQixFQUFDLEtBQUssQ0FBQyxjQUFjLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLEdBQ3ZGLENBQ2UsQ0FDbEIsQ0FDSixDQUFDO0FBQ0osQ0FBQyJ9
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GEButtonProps } from '@gorilla-engine-sdk/gorilla-engine-react';
|
|
3
|
+
import { LabeledComponentProps } from '../core/LabeledComponent';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the LabeledRTToggle component.
|
|
6
|
+
* @see LabeledComponentProps for inherited properties
|
|
7
|
+
*/
|
|
8
|
+
export type LabeledRTToggleProps = LabeledComponentProps & {
|
|
9
|
+
/** Configuration for the button control. */
|
|
10
|
+
button?: Partial<GEButtonProps> & {
|
|
11
|
+
style?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A momentary "real-time" toggle button with text and value labels.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Unlike LabeledToggle which toggles state on/off, LabeledRTToggle acts as a
|
|
19
|
+
* momentary switch: the parameter is set to 1 while the mouse button is held
|
|
20
|
+
* down, and returns to 0 when released. This is useful for trigger-style
|
|
21
|
+
* controls like sustain pedals or one-shot samples.
|
|
22
|
+
*
|
|
23
|
+
* @param props - Configuration for the labeled real-time toggle
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <LabeledRTToggle
|
|
28
|
+
* x={300} y={50} width={60} height={80}
|
|
29
|
+
* instrument={instrument}
|
|
30
|
+
* instrumentProp={instrument.trigger}
|
|
31
|
+
* textLabel={{ y: 50, height: 20, text: "Trigger" }}
|
|
32
|
+
* button={{ y: 0, width: 40, height: 40, style: "button_default" }}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function LabeledRTToggle(props: LabeledRTToggleProps): React.JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LabeledRTToggle = LabeledRTToggle;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const react_1 = require("react");
|
|
39
|
+
const LabeledComponent_1 = require("../core/LabeledComponent");
|
|
40
|
+
const useLabelValue_1 = require("../core/useLabelValue");
|
|
41
|
+
/**
|
|
42
|
+
* A momentary "real-time" toggle button with text and value labels.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Unlike LabeledToggle which toggles state on/off, LabeledRTToggle acts as a
|
|
46
|
+
* momentary switch: the parameter is set to 1 while the mouse button is held
|
|
47
|
+
* down, and returns to 0 when released. This is useful for trigger-style
|
|
48
|
+
* controls like sustain pedals or one-shot samples.
|
|
49
|
+
*
|
|
50
|
+
* @param props - Configuration for the labeled real-time toggle
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <LabeledRTToggle
|
|
55
|
+
* x={300} y={50} width={60} height={80}
|
|
56
|
+
* instrument={instrument}
|
|
57
|
+
* instrumentProp={instrument.trigger}
|
|
58
|
+
* textLabel={{ y: 50, height: 20, text: "Trigger" }}
|
|
59
|
+
* button={{ y: 0, width: 40, height: 40, style: "button_default" }}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
function LabeledRTToggle(props) {
|
|
64
|
+
const { instrument, instrumentProp, button, textLabel, ...container } = props;
|
|
65
|
+
const { labelText, labelVisible, valueText, valueVisible } = (0, useLabelValue_1.useLabelValue)(props);
|
|
66
|
+
const onMouseDown = (0, react_1.useCallback)(() => {
|
|
67
|
+
const property = (0, LabeledComponent_1.resolveInstrumentProperty)(instrument, instrumentProp);
|
|
68
|
+
if (property)
|
|
69
|
+
property.normValue = 1;
|
|
70
|
+
}, [instrument, instrumentProp]);
|
|
71
|
+
const onMouseUp = (0, react_1.useCallback)(() => {
|
|
72
|
+
const property = (0, LabeledComponent_1.resolveInstrumentProperty)(instrument, instrumentProp);
|
|
73
|
+
if (property)
|
|
74
|
+
property.normValue = 0;
|
|
75
|
+
}, [instrument, instrumentProp]);
|
|
76
|
+
return (React.createElement(React.Fragment, null,
|
|
77
|
+
React.createElement(LabeledComponent_1.LabeledComponent, { ...props, labelText: labelText, labelVisible: labelVisible, textLabel: props.textLabel, valueText: valueText, valueVisible: valueVisible, valueLabel: props.valueLabel },
|
|
78
|
+
React.createElement("geButton", { onMouseDown: onMouseDown, onMouseUp: onMouseUp, ...props.button, x: (props?.button?.x ?? props.button?.width)
|
|
79
|
+
? Math.round(container.width / 2 - props.button.width / 2)
|
|
80
|
+
: props.button?.x, bindings: props.instrumentProp ? { value: (0, LabeledComponent_1.getNativeBinding)(props.instrumentProp) } : {} }))));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGFiZWxlZFJUVG9nZ2xlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbXBvbmVudHMvTGFiZWxlZFJUVG9nZ2xlLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQTZDQSwwQ0EwQ0M7QUF2RkQsNkNBQStCO0FBQy9CLGlDQUErQztBQUsvQywrREFLa0M7QUFDbEMseURBQTBFO0FBVzFFOzs7Ozs7Ozs7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UyxFQUFFLFNBQVMsRUFDcEIsWUFBWSxFQUFFLFlBQVksRUFDMUIsVUFBVSxFQUFFLEtBQUssQ0FBQyxVQUFVO1lBRTVCLGtDQUNFLFdBQVcsRUFBRSxXQUFXLEVBQ3hCLFNBQVMsRUFBRSxTQUFTLEtBQ2hCLEtBQUssQ0FBQyxNQUFNLEVBQ2hCLENBQUMsRUFDQyxDQUFDLEtBQUssRUFBRSxNQUFNLEVBQUUsQ0FBQyxJQUFJLEtBQUssQ0FBQyxNQUFNLEVBQUUsS0FBSyxDQUFDO29CQUN2QyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxTQUFTLENBQUMsS0FBSyxHQUFHLENBQUMsR0FBRyxLQUFLLENBQUMsTUFBTSxDQUFDLEtBQUssR0FBRyxDQUFDLENBQUM7b0JBQzFELENBQUMsQ0FBQyxLQUFLLENBQUMsTUFBTSxFQUFFLENBQUMsRUFFckIsUUFBUSxFQUFFLEtBQUssQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLEVBQUUsS0FBSyxFQUFFLElBQUEsbUNBQWdCLEVBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLEVBQUUsR0FDdkYsQ0FDZSxDQUNsQixDQUNKLENBQUM7QUFDSixDQUFDIn0=
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GESliderProps } from '@gorilla-engine-sdk/gorilla-engine-react/dist/nativeWrappers/GESlider';
|
|
3
|
+
import { LabeledComponentProps } from './../core/LabeledComponent';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the LabeledSlider component.
|
|
6
|
+
* @see LabeledComponentProps for inherited properties
|
|
7
|
+
*/
|
|
8
|
+
export type LabeledSliderProps = LabeledComponentProps & {
|
|
9
|
+
/** Configuration for the slider control. */
|
|
10
|
+
slider?: Partial<GESliderProps> & {
|
|
11
|
+
style?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A slider control with text and value labels.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Combines a GESlider with configurable text and value labels that can
|
|
19
|
+
* show/hide based on user interaction (hover or mouse down).
|
|
20
|
+
*
|
|
21
|
+
* The slider is automatically bound to an instrument parameter when
|
|
22
|
+
* `instrument` and `instrumentProp` are provided.
|
|
23
|
+
*
|
|
24
|
+
* @param props - Configuration for the labeled slider
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <LabeledSlider
|
|
29
|
+
* x={150} y={50} width={40} height={220}
|
|
30
|
+
* instrument={instrument}
|
|
31
|
+
* instrumentProp={instrument.filter}
|
|
32
|
+
* textLabel={{ y: 180, height: 20, text: "Filter" }}
|
|
33
|
+
* valueLabel={{ y: 200, height: 20 }}
|
|
34
|
+
* slider={{ y: 0, width: 30, height: 160, style: "slider_default" }}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function LabeledSlider(props: LabeledSliderProps): React.JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LabeledSlider = LabeledSlider;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const LabeledComponent_1 = require("./../core/LabeledComponent");
|
|
39
|
+
const useLabelValue_1 = require("../core/useLabelValue");
|
|
40
|
+
/**
|
|
41
|
+
* A slider control with text and value labels.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Combines a GESlider with configurable text and value labels that can
|
|
45
|
+
* show/hide based on user interaction (hover or mouse down).
|
|
46
|
+
*
|
|
47
|
+
* The slider is automatically bound to an instrument parameter when
|
|
48
|
+
* `instrument` and `instrumentProp` are provided.
|
|
49
|
+
*
|
|
50
|
+
* @param props - Configuration for the labeled slider
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <LabeledSlider
|
|
55
|
+
* x={150} y={50} width={40} height={220}
|
|
56
|
+
* instrument={instrument}
|
|
57
|
+
* instrumentProp={instrument.filter}
|
|
58
|
+
* textLabel={{ y: 180, height: 20, text: "Filter" }}
|
|
59
|
+
* valueLabel={{ y: 200, height: 20 }}
|
|
60
|
+
* slider={{ y: 0, width: 30, height: 160, style: "slider_default" }}
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
function LabeledSlider(props) {
|
|
65
|
+
const { instrument, instrumentProp, slider, textLabel, valueLabel, children, ...container } = props;
|
|
66
|
+
const propsRef = React.useRef(props);
|
|
67
|
+
propsRef.current = props;
|
|
68
|
+
const { labelText, labelVisible, valueText, valueVisible, setValueText, onMouseEnter, onMouseExit, onMouseDown, onMouseUp, onValueChange, } = (0, useLabelValue_1.useLabelValue)(props);
|
|
69
|
+
return (React.createElement(React.Fragment, null,
|
|
70
|
+
React.createElement(LabeledComponent_1.LabeledComponent, { ...props, labelText: labelText, labelVisible: labelVisible, textLabel: props.textLabel, valueText: valueText, valueVisible: valueVisible, valueLabel: props.valueLabel },
|
|
71
|
+
React.createElement("geSlider", { onMouseEnter: onMouseEnter, onMouseExit: onMouseExit, onMouseDown: onMouseDown, onMouseUp: onMouseUp, ...props.slider, x: (props?.slider?.x ?? props.slider?.width)
|
|
72
|
+
? Math.round(container.width / 2 - props.slider.width / 2)
|
|
73
|
+
: props.slider?.x, bindings: props.instrumentProp ? { value: (0, LabeledComponent_1.getNativeBinding)(props.instrumentProp) } : {} }))));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGFiZWxlZFNsaWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb25lbnRzL0xhYmVsZWRTbGlkZXIudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBNENBLHNDQStDQztBQTNGRCw2Q0FBK0I7QUFJL0IsaUVBSW9D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UksS0FBSyxDQUFDLE1BQU0sRUFBRSxLQUFLLENBQUM7b0JBQ3ZDLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxLQUFLLEdBQUcsQ0FBQyxHQUFHLEtBQUssQ0FBQyxNQUFNLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQztvQkFDMUQsQ0FBQyxDQUFDLEtBQUssQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUVyQixRQUFRLEVBQUUsS0FBSyxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsSUFBQSxtQ0FBZ0IsRUFBQyxLQUFLLENBQUMsY0FBYyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsRUFBRSxHQUN2RixDQUNlLENBQ2xCLENBQ0osQ0FBQztBQUNKLENBQUMifQ==
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GEToggleProps } from '@gorilla-engine-sdk/gorilla-engine-react/dist/nativeWrappers/GEToggle';
|
|
3
|
+
import { LabeledComponentProps } from '../core/LabeledComponent';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the LabeledToggle component.
|
|
6
|
+
* @see LabeledComponentProps for inherited properties
|
|
7
|
+
*/
|
|
8
|
+
export type LabeleddToggleProps = LabeledComponentProps & {
|
|
9
|
+
/** Configuration for the toggle control. */
|
|
10
|
+
toggle?: Partial<GEToggleProps> & {
|
|
11
|
+
style?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A toggle (on/off switch) control with text and value labels.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Combines a GEToggle with configurable text and value labels.
|
|
19
|
+
* The toggle is automatically bound to an instrument parameter when
|
|
20
|
+
* `instrument` and `instrumentProp` are provided.
|
|
21
|
+
*
|
|
22
|
+
* @param props - Configuration for the labeled toggle
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <LabeledToggle
|
|
27
|
+
* x={220} y={50} width={60} height={80}
|
|
28
|
+
* instrument={instrument}
|
|
29
|
+
* instrumentProp={instrument.bypass}
|
|
30
|
+
* textLabel={{ y: 50, height: 20, text: "Bypass" }}
|
|
31
|
+
* toggle={{ y: 0, width: 40, height: 40, style: "toggle_default" }}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function LabeledToggle(props: LabeleddToggleProps): React.JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LabeledToggle = LabeledToggle;
|
|
37
|
+
const React = __importStar(require("react"));
|
|
38
|
+
const LabeledComponent_1 = require("../core/LabeledComponent");
|
|
39
|
+
const useLabelValue_1 = require("../core/useLabelValue");
|
|
40
|
+
/**
|
|
41
|
+
* A toggle (on/off switch) control with text and value labels.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Combines a GEToggle with configurable text and value labels.
|
|
45
|
+
* The toggle is automatically bound to an instrument parameter when
|
|
46
|
+
* `instrument` and `instrumentProp` are provided.
|
|
47
|
+
*
|
|
48
|
+
* @param props - Configuration for the labeled toggle
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <LabeledToggle
|
|
53
|
+
* x={220} y={50} width={60} height={80}
|
|
54
|
+
* instrument={instrument}
|
|
55
|
+
* instrumentProp={instrument.bypass}
|
|
56
|
+
* textLabel={{ y: 50, height: 20, text: "Bypass" }}
|
|
57
|
+
* toggle={{ y: 0, width: 40, height: 40, style: "toggle_default" }}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
function LabeledToggle(props) {
|
|
62
|
+
const { instrument, instrumentProp, toggle, textLabel, ...container } = props;
|
|
63
|
+
const { labelText, labelVisible, valueText, valueVisible } = (0, useLabelValue_1.useLabelValue)(props);
|
|
64
|
+
return (React.createElement(React.Fragment, null,
|
|
65
|
+
React.createElement(LabeledComponent_1.LabeledComponent, { ...props, labelText: labelText, labelVisible: labelVisible, textLabel: props.textLabel, valueText: valueText, valueVisible: valueVisible, valueLabel: props.valueLabel },
|
|
66
|
+
React.createElement("geToggle", { ...props.toggle, x: (props?.toggle?.x ?? props.toggle?.width)
|
|
67
|
+
? Math.round(container.width / 2 - props.toggle.width / 2)
|
|
68
|
+
: props.toggle?.x, bindings: props.instrumentProp ? { value: (0, LabeledComponent_1.getNativeBinding)(props.instrumentProp) } : {} }))));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGFiZWxlZFRvZ2dsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21wb25lbnRzL0xhYmVsZWRUb2dnbGUudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBeUNBLHNDQThCQztBQXZFRCw2Q0FBK0I7QUFJL0IsK0RBSWtDO0FBQ2xDLHlEQUEwRTtBQVcxRTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FvQkc7QUFDSCxTQUFnQixhQUFhLENBQUMsS0FBMEI7SUFDdEQsTUFBTSxFQUFFLFVBQVUsRUFBRSxjQUFjLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxHQUFHLFNBQVMsRUFBRSxHQUFHLEtBQUssQ0FBQztJQUU5RSxNQUFNLEVBQUUsU0FBUyxFQUFFLFlBQVksRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLEdBQUcsSUFBQSw2QkFBYSxFQUN4RSxLQUEyQixDQUM1QixDQUFDO0lBRUYsT0FBTyxDQUNMO1FBQ0Usb0JBQUMsbUNBQWdCLE9BQ1gsS0FBSyxFQUNULFNBQVMsRUFBRSxTQUFTLEVBQ3BCLFlBQVksRUFBRSxZQUFZLEVBQzFCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUyxFQUMxQixTQUFTLEVBQUUsU0FBUyxFQUNwQixZQUFZLEVBQUUsWUFBWSxFQUMxQixVQUFVLEVBQUUsS0FBSyxDQUFDLFVBQVU7WUFFNUIscUNBQ00sS0FBSyxDQUFDLE1BQU0sRUFDaEIsQ0FBQyxFQUNDLENBQUMsS0FBSyxFQUFFLE1BQU0sRUFBRSxDQUFDLElBQUksS0FBSyxDQUFDLE1BQU0sRUFBRSxLQUFLLENBQUM7b0JBQ3ZDLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFNBQVMsQ0FBQyxLQUFLLEdBQUcsQ0FBQyxHQUFHLEtBQUssQ0FBQyxNQUFNLENBQUMsS0FBSyxHQUFHLENBQUMsQ0FBQztvQkFDMUQsQ0FBQyxDQUFDLEtBQUssQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUVyQixRQUFRLEVBQUUsS0FBSyxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsSUFBQSxtQ0FBZ0IsRUFBQyxLQUFLLENBQUMsY0FBYyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsRUFBRSxHQUN2RixDQUNlLENBQ2xCLENBQ0osQ0FBQztBQUNKLENBQUMifQ==
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GELabelProps } from '@gorilla-engine-sdk/gorilla-engine-react';
|
|
3
|
+
/**
|
|
4
|
+
* Defines a numeric range with associated display text for formatting parameter values.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Used to display different text formats based on the current parameter value.
|
|
8
|
+
* For example, showing "Hz" for low frequencies and "kHz" for higher ones.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const frequencyRanges: LabelValueRanges[] = [
|
|
13
|
+
* { to: 999, text: "$value(0) Hz" },
|
|
14
|
+
* { from: 1000, text: "$value(2) kHz" }
|
|
15
|
+
* ];
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type LabelValueRanges = {
|
|
19
|
+
/** Range start value (inclusive). If omitted, matches any value up to `to`. */
|
|
20
|
+
from?: number;
|
|
21
|
+
/** Range end value (inclusive). If omitted, matches any value from `from` onwards. */
|
|
22
|
+
to?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Display text for this range. Supports special tokens:
|
|
25
|
+
* - `$value` or `$value(n)` - Raw numeric value, optionally with n decimal places
|
|
26
|
+
* - `$text_value` - The parameter's formatted text value
|
|
27
|
+
*/
|
|
28
|
+
text: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Internal props for controlling label visibility state.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export type LabelValueDisplayProps = {
|
|
35
|
+
labelText: string;
|
|
36
|
+
labelVisible: boolean;
|
|
37
|
+
valueText: string;
|
|
38
|
+
valueVisible: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** An instrument property object, or a legacy property name resolved through `instrument`. */
|
|
41
|
+
export type InstrumentPropertyBinding = string | GorillaEngine.InstrumentProperty;
|
|
42
|
+
/** Resolves either supported binding form to its instrument property object. */
|
|
43
|
+
export declare function resolveInstrumentProperty(instrument: GorillaEngine.Instrument | undefined, binding: InstrumentPropertyBinding | undefined): GorillaEngine.InstrumentProperty | undefined;
|
|
44
|
+
/** Returns the parameter key used by the instrument event API. */
|
|
45
|
+
export declare function getInstrumentPropertyKey(binding: InstrumentPropertyBinding | undefined): string | undefined;
|
|
46
|
+
/** Converts a labeled-component binding to the value expected by native controls. */
|
|
47
|
+
export declare function getNativeBinding(binding: InstrumentPropertyBinding | undefined): string | GorillaEngine.InstrumentProperty | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Base properties shared by all labeled components.
|
|
50
|
+
*
|
|
51
|
+
* @remarks
|
|
52
|
+
* Extends GELabelProps to provide container positioning and styling,
|
|
53
|
+
* plus additional properties for instrument binding and label behavior.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <LabeledKnob
|
|
58
|
+
* x={50} y={50} width={80} height={100}
|
|
59
|
+
* instrument={instrument}
|
|
60
|
+
* instrumentProp={instrument.volume}
|
|
61
|
+
* toggleVisibilityOnHover={true}
|
|
62
|
+
* hideValueLabel={true}
|
|
63
|
+
* textLabel={{ y: 80, height: 20 }}
|
|
64
|
+
* valueLabel={{ y: 80, height: 20 }}
|
|
65
|
+
* knob={{ y: 0, width: 60, height: 60 }}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export type LabeledComponentProps = Partial<GELabelProps> & {
|
|
70
|
+
/** The Gorilla Engine instrument instance for parameter binding. */
|
|
71
|
+
instrument?: GorillaEngine.Instrument;
|
|
72
|
+
/** The instrument property to bind to. String names remain supported for legacy consumers. */
|
|
73
|
+
instrumentProp?: InstrumentPropertyBinding;
|
|
74
|
+
/** Style identifier for the component. */
|
|
75
|
+
style?: string;
|
|
76
|
+
/** If true, hides the value label by default (shown on interaction). */
|
|
77
|
+
hideValueLabel?: boolean;
|
|
78
|
+
/** If true, hides the text label when the value label is shown. */
|
|
79
|
+
hideTextValue?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Controls when label visibility toggles:
|
|
82
|
+
* - `true`: Toggle on mouse hover
|
|
83
|
+
* - `false`: Toggle on mouse down/up (default)
|
|
84
|
+
*/
|
|
85
|
+
toggleVisibilityOnHover?: boolean;
|
|
86
|
+
/** Custom value formatting ranges. @see LabelValueRanges */
|
|
87
|
+
ranges?: LabelValueRanges[];
|
|
88
|
+
/** Props for the text (name) label. */
|
|
89
|
+
textLabel?: Partial<GELabelProps>;
|
|
90
|
+
/** Props for the value display label. */
|
|
91
|
+
valueLabel?: Partial<GELabelProps>;
|
|
92
|
+
/** Child elements to render inside the container. */
|
|
93
|
+
children?: any;
|
|
94
|
+
/** React key for list rendering. */
|
|
95
|
+
key?: any;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Combined props for the LabeledComponent container.
|
|
99
|
+
* @internal
|
|
100
|
+
*/
|
|
101
|
+
export type LabeledComponentContainerProps = LabelValueDisplayProps & LabeledComponentProps;
|
|
102
|
+
/**
|
|
103
|
+
* Base container component that wraps a control with text and value labels.
|
|
104
|
+
*
|
|
105
|
+
* @remarks
|
|
106
|
+
* This is the foundation for all labeled components. It renders a container
|
|
107
|
+
* with optional text and value labels, plus any child elements (the actual control).
|
|
108
|
+
* Label visibility and content are controlled by the parent component via props.
|
|
109
|
+
*
|
|
110
|
+
* Most developers should use the specific labeled components (LabeledKnob,
|
|
111
|
+
* LabeledSlider, etc.) rather than this base component directly.
|
|
112
|
+
*
|
|
113
|
+
* @param props - Configuration and display state for the labeled container
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```tsx
|
|
117
|
+
* // Internal usage by LabeledKnob:
|
|
118
|
+
* <LabeledComponent
|
|
119
|
+
* {...props}
|
|
120
|
+
* labelText={labelText}
|
|
121
|
+
* labelVisible={labelVisible}
|
|
122
|
+
* valueText={valueText}
|
|
123
|
+
* valueVisible={valueVisible}
|
|
124
|
+
* >
|
|
125
|
+
* <geKnob {...knobProps} />
|
|
126
|
+
* </LabeledComponent>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function LabeledComponent(props: LabeledComponentContainerProps): React.JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resolveInstrumentProperty = resolveInstrumentProperty;
|
|
37
|
+
exports.getInstrumentPropertyKey = getInstrumentPropertyKey;
|
|
38
|
+
exports.getNativeBinding = getNativeBinding;
|
|
39
|
+
exports.LabeledComponent = LabeledComponent;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
/** Resolves either supported binding form to its instrument property object. */
|
|
42
|
+
function resolveInstrumentProperty(instrument, binding) {
|
|
43
|
+
if (!binding)
|
|
44
|
+
return undefined;
|
|
45
|
+
return typeof binding === 'string' ? instrument?.[binding] : binding;
|
|
46
|
+
}
|
|
47
|
+
/** Returns the parameter key used by the instrument event API. */
|
|
48
|
+
function getInstrumentPropertyKey(binding) {
|
|
49
|
+
return typeof binding === 'string' ? binding : binding?.key;
|
|
50
|
+
}
|
|
51
|
+
/** Converts a labeled-component binding to the value expected by native controls. */
|
|
52
|
+
function getNativeBinding(binding) {
|
|
53
|
+
return typeof binding === 'string' ? `instrument.${binding}` : binding;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Base container component that wraps a control with text and value labels.
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* This is the foundation for all labeled components. It renders a container
|
|
60
|
+
* with optional text and value labels, plus any child elements (the actual control).
|
|
61
|
+
* Label visibility and content are controlled by the parent component via props.
|
|
62
|
+
*
|
|
63
|
+
* Most developers should use the specific labeled components (LabeledKnob,
|
|
64
|
+
* LabeledSlider, etc.) rather than this base component directly.
|
|
65
|
+
*
|
|
66
|
+
* @param props - Configuration and display state for the labeled container
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```tsx
|
|
70
|
+
* // Internal usage by LabeledKnob:
|
|
71
|
+
* <LabeledComponent
|
|
72
|
+
* {...props}
|
|
73
|
+
* labelText={labelText}
|
|
74
|
+
* labelVisible={labelVisible}
|
|
75
|
+
* valueText={valueText}
|
|
76
|
+
* valueVisible={valueVisible}
|
|
77
|
+
* >
|
|
78
|
+
* <geKnob {...knobProps} />
|
|
79
|
+
* </LabeledComponent>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function LabeledComponent(props) {
|
|
83
|
+
const { instrument, instrumentProp, style, hideTextValue, hideValueLabel, textLabel, children, labelText, labelVisible, valueLabel, valueText, valueVisible, key, ...container } = props;
|
|
84
|
+
return (React.createElement(React.Fragment, null,
|
|
85
|
+
React.createElement("geLabel", { interceptsMouseClicks: false, ...container },
|
|
86
|
+
props.textLabel && (React.createElement("geLabel", { interceptsMouseClicks: false, ...props.textLabel, text: props.labelText, width: props.textLabel.width ?? container.width, visible: props.labelVisible })),
|
|
87
|
+
props.valueLabel && (React.createElement("geLabel", { interceptsMouseClicks: false, ...props.valueLabel, text: props.valueText, width: props.valueLabel.width ?? container.width, visible: props.valueVisible })),
|
|
88
|
+
props.children)));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTGFiZWxlZENvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb3JlL0xhYmVsZWRDb21wb25lbnQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBOENBLDhEQU1DO0FBR0QsNERBSUM7QUFHRCw0Q0FJQztBQStGRCw0Q0E0Q0M7QUE3TUQsNkNBQStCO0FBNkMvQixnRkFBZ0Y7QUFDaEYsU0FBZ0IseUJBQXlCLENBQ3ZDLFVBQWdELEVBQ2hELE9BQThDO0lBRTlDLElBQUksQ0FBQyxPQUFPO1FBQUUsT0FBTyxTQUFTLENBQUM7SUFDL0IsT0FBTyxPQUFPLE9BQU8sS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDLFVBQVUsRUFBRSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUM7QUFDdkUsQ0FBQztBQUVELGtFQUFrRTtBQUNsRSxTQUFnQix3QkFBd0IsQ0FDdEMsT0FBOEM7SUFFOUMsT0FBTyxPQUFPLE9BQU8sS0FBSyxRQUFRLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsT0FBTyxFQUFFLEdBQUcsQ0FBQztBQUM5RCxDQUFDO0FBRUQscUZBQXFGO0FBQ3JGLFNBQWdCLGdCQUFnQixDQUM5QixPQUE4QztJQUU5QyxPQUFPLE9BQU8sT0FBTyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsY0FBYyxPQUFPLEVBQUUsQ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