@aglyn/plugins-mui 1.0.0-beta.143
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 +201 -0
- package/README.md +22 -0
- package/package.json +47 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/accordion.d.ts +96 -0
- package/src/lib/components/accordion.js +392 -0
- package/src/lib/components/accordion.js.map +1 -0
- package/src/lib/components/app-bar.d.ts +32 -0
- package/src/lib/components/app-bar.js +86 -0
- package/src/lib/components/app-bar.js.map +1 -0
- package/src/lib/components/blocks.d.ts +46 -0
- package/src/lib/components/blocks.js +1007 -0
- package/src/lib/components/blocks.js.map +1 -0
- package/src/lib/components/box.d.ts +47 -0
- package/src/lib/components/box.js +125 -0
- package/src/lib/components/box.js.map +1 -0
- package/src/lib/components/breadcrumbs.d.ts +44 -0
- package/src/lib/components/breadcrumbs.js +172 -0
- package/src/lib/components/breadcrumbs.js.map +1 -0
- package/src/lib/components/button.d.ts +89 -0
- package/src/lib/components/button.js +272 -0
- package/src/lib/components/button.js.map +1 -0
- package/src/lib/components/card.d.ts +61 -0
- package/src/lib/components/card.js +336 -0
- package/src/lib/components/card.js.map +1 -0
- package/src/lib/components/collection.d.ts +514 -0
- package/src/lib/components/collection.js +2999 -0
- package/src/lib/components/collection.js.map +1 -0
- package/src/lib/components/container.d.ts +42 -0
- package/src/lib/components/container.js +169 -0
- package/src/lib/components/container.js.map +1 -0
- package/src/lib/components/custom-html.d.ts +78 -0
- package/src/lib/components/custom-html.js +219 -0
- package/src/lib/components/custom-html.js.map +1 -0
- package/src/lib/components/data-table.d.ts +57 -0
- package/src/lib/components/data-table.js +216 -0
- package/src/lib/components/data-table.js.map +1 -0
- package/src/lib/components/document-root.d.ts +77 -0
- package/src/lib/components/document-root.js +118 -0
- package/src/lib/components/document-root.js.map +1 -0
- package/src/lib/components/drawer.d.ts +93 -0
- package/src/lib/components/drawer.js +566 -0
- package/src/lib/components/drawer.js.map +1 -0
- package/src/lib/components/function-controls.d.ts +66 -0
- package/src/lib/components/function-controls.js +207 -0
- package/src/lib/components/function-controls.js.map +1 -0
- package/src/lib/components/function-scope.d.ts +110 -0
- package/src/lib/components/function-scope.js +478 -0
- package/src/lib/components/function-scope.js.map +1 -0
- package/src/lib/components/function-widget.d.ts +75 -0
- package/src/lib/components/function-widget.js +307 -0
- package/src/lib/components/function-widget.js.map +1 -0
- package/src/lib/components/grid.d.ts +91 -0
- package/src/lib/components/grid.js +322 -0
- package/src/lib/components/grid.js.map +1 -0
- package/src/lib/components/icon.d.ts +54 -0
- package/src/lib/components/icon.js +163 -0
- package/src/lib/components/icon.js.map +1 -0
- package/src/lib/components/image-list.d.ts +58 -0
- package/src/lib/components/image-list.js +336 -0
- package/src/lib/components/image-list.js.map +1 -0
- package/src/lib/components/image.d.ts +154 -0
- package/src/lib/components/image.js +451 -0
- package/src/lib/components/image.js.map +1 -0
- package/src/lib/components/inline-text.d.ts +74 -0
- package/src/lib/components/inline-text.js +407 -0
- package/src/lib/components/inline-text.js.map +1 -0
- package/src/lib/components/language-switcher.d.ts +35 -0
- package/src/lib/components/language-switcher.js +179 -0
- package/src/lib/components/language-switcher.js.map +1 -0
- package/src/lib/components/layout-slot.d.ts +68 -0
- package/src/lib/components/layout-slot.js +192 -0
- package/src/lib/components/layout-slot.js.map +1 -0
- package/src/lib/components/link-box-accessible-name.d.ts +79 -0
- package/src/lib/components/link-box-accessible-name.js +158 -0
- package/src/lib/components/link-box-accessible-name.js.map +1 -0
- package/src/lib/components/link-box.d.ts +66 -0
- package/src/lib/components/link-box.js +212 -0
- package/src/lib/components/link-box.js.map +1 -0
- package/src/lib/components/list-item-text.d.ts +22 -0
- package/src/lib/components/list-item-text.js +86 -0
- package/src/lib/components/list-item-text.js.map +1 -0
- package/src/lib/components/list-item.d.ts +32 -0
- package/src/lib/components/list-item.js +127 -0
- package/src/lib/components/list-item.js.map +1 -0
- package/src/lib/components/list.d.ts +34 -0
- package/src/lib/components/list.js +108 -0
- package/src/lib/components/list.js.map +1 -0
- package/src/lib/components/markdown.d.ts +129 -0
- package/src/lib/components/markdown.js +853 -0
- package/src/lib/components/markdown.js.map +1 -0
- package/src/lib/components/nav-menu.d.ts +68 -0
- package/src/lib/components/nav-menu.js +683 -0
- package/src/lib/components/nav-menu.js.map +1 -0
- package/src/lib/components/pagination.d.ts +59 -0
- package/src/lib/components/pagination.js +243 -0
- package/src/lib/components/pagination.js.map +1 -0
- package/src/lib/components/paper.d.ts +47 -0
- package/src/lib/components/paper.js +202 -0
- package/src/lib/components/paper.js.map +1 -0
- package/src/lib/components/plugin-frame.d.ts +64 -0
- package/src/lib/components/plugin-frame.js +335 -0
- package/src/lib/components/plugin-frame.js.map +1 -0
- package/src/lib/components/plugin.d.ts +95 -0
- package/src/lib/components/plugin.js +304 -0
- package/src/lib/components/plugin.js.map +1 -0
- package/src/lib/components/product.d.ts +40 -0
- package/src/lib/components/product.js +287 -0
- package/src/lib/components/product.js.map +1 -0
- package/src/lib/components/reusable-instance.d.ts +57 -0
- package/src/lib/components/reusable-instance.js +126 -0
- package/src/lib/components/reusable-instance.js.map +1 -0
- package/src/lib/components/screen-link.d.ts +85 -0
- package/src/lib/components/screen-link.js +324 -0
- package/src/lib/components/screen-link.js.map +1 -0
- package/src/lib/components/search-box.d.ts +41 -0
- package/src/lib/components/search-box.js +125 -0
- package/src/lib/components/search-box.js.map +1 -0
- package/src/lib/components/section.d.ts +56 -0
- package/src/lib/components/section.js +132 -0
- package/src/lib/components/section.js.map +1 -0
- package/src/lib/components/stack.d.ts +55 -0
- package/src/lib/components/stack.js +309 -0
- package/src/lib/components/stack.js.map +1 -0
- package/src/lib/components/tabs.d.ts +288 -0
- package/src/lib/components/tabs.js +788 -0
- package/src/lib/components/tabs.js.map +1 -0
- package/src/lib/components/theme-mode-switcher.d.ts +38 -0
- package/src/lib/components/theme-mode-switcher.js +168 -0
- package/src/lib/components/theme-mode-switcher.js.map +1 -0
- package/src/lib/components/toolbar.d.ts +37 -0
- package/src/lib/components/toolbar.js +117 -0
- package/src/lib/components/toolbar.js.map +1 -0
- package/src/lib/components/typography.d.ts +33 -0
- package/src/lib/components/typography.js +433 -0
- package/src/lib/components/typography.js.map +1 -0
- package/src/lib/components/video-lightbox-controls.d.ts +131 -0
- package/src/lib/components/video-lightbox-controls.js +536 -0
- package/src/lib/components/video-lightbox-controls.js.map +1 -0
- package/src/lib/components/video-lightbox.d.ts +60 -0
- package/src/lib/components/video-lightbox.js +247 -0
- package/src/lib/components/video-lightbox.js.map +1 -0
- package/src/lib/components/video-playback-beacon.d.ts +80 -0
- package/src/lib/components/video-playback-beacon.js +128 -0
- package/src/lib/components/video-playback-beacon.js.map +1 -0
- package/src/lib/components/video-player-frame.d.ts +58 -0
- package/src/lib/components/video-player-frame.js +51 -0
- package/src/lib/components/video-player-frame.js.map +1 -0
- package/src/lib/components/video.d.ts +220 -0
- package/src/lib/components/video.js +874 -0
- package/src/lib/components/video.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +17 -0
- package/src/lib/constants/bundle-common.js +18 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/field-presets.d.ts +93 -0
- package/src/lib/constants/field-presets.js +248 -0
- package/src/lib/constants/field-presets.js.map +1 -0
- package/src/lib/plugin.d.ts +80 -0
- package/src/lib/plugin.js +599 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/utils/author-html-label.d.ts +73 -0
- package/src/lib/utils/author-html-label.js +89 -0
- package/src/lib/utils/author-html-label.js.map +1 -0
- package/src/lib/utils/drop-cleared-props.d.ts +18 -0
- package/src/lib/utils/drop-cleared-props.js +74 -0
- package/src/lib/utils/drop-cleared-props.js.map +1 -0
- package/src/lib/utils/element-picker.d.ts +99 -0
- package/src/lib/utils/element-picker.js +140 -0
- package/src/lib/utils/element-picker.js.map +1 -0
- package/src/lib/utils/generate-preset-id.d.ts +19 -0
- package/src/lib/utils/generate-preset-id.js +25 -0
- package/src/lib/utils/generate-preset-id.js.map +1 -0
- package/src/lib/utils/link-target-props.d.ts +53 -0
- package/src/lib/utils/link-target-props.js +53 -0
- package/src/lib/utils/link-target-props.js.map +1 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
/**
|
|
19
|
+
* How one function parameter is ASKED (AGL-3202), shared by the Function
|
|
20
|
+
* Widget, which asks every parameter in a row, and the Function Input
|
|
21
|
+
* element, which asks one wherever the author put it.
|
|
22
|
+
*/
|
|
23
|
+
/** The control a parameter is drawn as. `auto` follows the parameter. */
|
|
24
|
+
export type FunctionControlKind = 'auto' | 'number' | 'text' | 'select' | 'chips' | 'switch';
|
|
25
|
+
export declare const FUNCTION_CONTROL_KINDS: readonly FunctionControlKind[];
|
|
26
|
+
/** What each input starts with: the parameter's own default, or nothing. */
|
|
27
|
+
export declare function initialFunctionArguments(definition: Aglyn.HostFunction | undefined): Record<string, string>;
|
|
28
|
+
/** A result as a visitor reads it. */
|
|
29
|
+
export declare function displayFunctionValue(value: number | string | boolean | undefined): string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a result counts as "yes" for an element that shows or hides on it.
|
|
32
|
+
* The strings a function is likely to have built — `'false'`, `'0'`, `'no'` —
|
|
33
|
+
* read as no, because a text local is the only way a function can carry a
|
|
34
|
+
* flag it computed from text.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isFunctionValueTruthy(value: number | string | boolean | undefined): boolean;
|
|
37
|
+
/** `control: auto` resolved against what the parameter is. */
|
|
38
|
+
export declare function resolveFunctionControl(control: FunctionControlKind | undefined, parameter: Pick<Aglyn.HostFunctionParameter, 'type' | 'options'> | undefined, hasChoices: boolean): Exclude<FunctionControlKind, 'auto'>;
|
|
39
|
+
export interface FunctionParameterControlProps {
|
|
40
|
+
/** The parameter's identifier; the label when nothing better is given. */
|
|
41
|
+
name: string;
|
|
42
|
+
type?: Aglyn.FunctionValueType;
|
|
43
|
+
required?: boolean;
|
|
44
|
+
control?: FunctionControlKind;
|
|
45
|
+
label?: string;
|
|
46
|
+
hideLabel?: boolean;
|
|
47
|
+
/** The choices offered by a select or a row of chips. */
|
|
48
|
+
options?: Aglyn.HostFunctionParameterOption[];
|
|
49
|
+
value: string;
|
|
50
|
+
onChange: (value: string) => void;
|
|
51
|
+
/** The besigner draws the control so it can be designed around; it is inert. */
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
width?: number | string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* One parameter, drawn as what it is.
|
|
57
|
+
*
|
|
58
|
+
* - **select** is NATIVE. A portal-mounted menu is one more thing a
|
|
59
|
+
* transformed or clipped ancestor can misplace, and on a phone the platform
|
|
60
|
+
* picker is the better control.
|
|
61
|
+
* - **chips** are quick picks: buttons that SET the value, pressed when the
|
|
62
|
+
* value matches. They are how a number box gets "10 · 25 · 50 · 100"
|
|
63
|
+
* beside it — two controls on one parameter, which is why this takes a
|
|
64
|
+
* value and an onChange and holds no state of its own.
|
|
65
|
+
*/
|
|
66
|
+
export declare function FunctionParameterControl(props: FunctionParameterControlProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
import Chip from "@mui/material/Chip";
|
|
19
|
+
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
20
|
+
import Stack from "@mui/material/Stack";
|
|
21
|
+
import Switch from "@mui/material/Switch";
|
|
22
|
+
import TextField from "@mui/material/TextField";
|
|
23
|
+
import Typography from "@mui/material/Typography";
|
|
24
|
+
import { useId } from "react";
|
|
25
|
+
export const FUNCTION_CONTROL_KINDS = [
|
|
26
|
+
'auto',
|
|
27
|
+
'number',
|
|
28
|
+
'text',
|
|
29
|
+
'select',
|
|
30
|
+
'chips',
|
|
31
|
+
'switch'
|
|
32
|
+
];
|
|
33
|
+
/** What each input starts with: the parameter's own default, or nothing. */ export function initialFunctionArguments(definition) {
|
|
34
|
+
var _ref;
|
|
35
|
+
const args = {};
|
|
36
|
+
for (const parameter of (_ref = definition == null ? void 0 : definition.parameters) != null ? _ref : []){
|
|
37
|
+
var _parameter_options;
|
|
38
|
+
if (parameter.defaultValue != null && parameter.defaultValue !== '') {
|
|
39
|
+
args[parameter.name] = String(parameter.defaultValue);
|
|
40
|
+
} else if ((_parameter_options = parameter.options) == null ? void 0 : _parameter_options.length) {
|
|
41
|
+
// A select always shows a choice, so the function has to receive the
|
|
42
|
+
// one on screen — not an empty string the visitor never saw.
|
|
43
|
+
args[parameter.name] = String(parameter.options[0].value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return args;
|
|
47
|
+
}
|
|
48
|
+
/** A result as a visitor reads it. */ export function displayFunctionValue(value) {
|
|
49
|
+
if (typeof value === 'boolean') return value ? 'Yes' : 'No';
|
|
50
|
+
return value == null ? '' : String(value);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether a result counts as "yes" for an element that shows or hides on it.
|
|
54
|
+
* The strings a function is likely to have built — `'false'`, `'0'`, `'no'` —
|
|
55
|
+
* read as no, because a text local is the only way a function can carry a
|
|
56
|
+
* flag it computed from text.
|
|
57
|
+
*/ export function isFunctionValueTruthy(value) {
|
|
58
|
+
if (typeof value === 'boolean') return value;
|
|
59
|
+
if (typeof value === 'number') return value !== 0 && !Number.isNaN(value);
|
|
60
|
+
const text = String(value != null ? value : '').trim().toLowerCase();
|
|
61
|
+
return text !== '' && text !== 'false' && text !== '0' && text !== 'no';
|
|
62
|
+
}
|
|
63
|
+
/** `control: auto` resolved against what the parameter is. */ export function resolveFunctionControl(control, parameter, hasChoices) {
|
|
64
|
+
var _parameter_options;
|
|
65
|
+
if (control && control !== 'auto') return control;
|
|
66
|
+
if (hasChoices || (parameter == null ? void 0 : (_parameter_options = parameter.options) == null ? void 0 : _parameter_options.length)) return 'select';
|
|
67
|
+
if ((parameter == null ? void 0 : parameter.type) === 'boolean') return 'switch';
|
|
68
|
+
if ((parameter == null ? void 0 : parameter.type) === 'number') return 'number';
|
|
69
|
+
return 'text';
|
|
70
|
+
}
|
|
71
|
+
/** Two values name the same choice: "25" and 25.0 are one quick pick. */ function sameChoice(left, right) {
|
|
72
|
+
if (left === right) return true;
|
|
73
|
+
if (left.trim() === '' || right.trim() === '') return false;
|
|
74
|
+
const a = Number(left);
|
|
75
|
+
const b = Number(right);
|
|
76
|
+
return Number.isFinite(a) && Number.isFinite(b) && a === b;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* One parameter, drawn as what it is.
|
|
80
|
+
*
|
|
81
|
+
* - **select** is NATIVE. A portal-mounted menu is one more thing a
|
|
82
|
+
* transformed or clipped ancestor can misplace, and on a phone the platform
|
|
83
|
+
* picker is the better control.
|
|
84
|
+
* - **chips** are quick picks: buttons that SET the value, pressed when the
|
|
85
|
+
* value matches. They are how a number box gets "10 · 25 · 50 · 100"
|
|
86
|
+
* beside it — two controls on one parameter, which is why this takes a
|
|
87
|
+
* value and an onChange and holds no state of its own.
|
|
88
|
+
*/ export function FunctionParameterControl(props) {
|
|
89
|
+
const { name, type, required, control, label, hideLabel, options = [], value, onChange, disabled, width } = props;
|
|
90
|
+
const groupLabelId = useId();
|
|
91
|
+
const text = (label == null ? void 0 : label.trim()) || name;
|
|
92
|
+
const kind = resolveFunctionControl(control, {
|
|
93
|
+
type,
|
|
94
|
+
options
|
|
95
|
+
}, options.length > 0);
|
|
96
|
+
if (kind === 'chips') {
|
|
97
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
98
|
+
spacing: 0.75,
|
|
99
|
+
role: "group",
|
|
100
|
+
"aria-labelledby": groupLabelId,
|
|
101
|
+
children: [
|
|
102
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
103
|
+
id: groupLabelId,
|
|
104
|
+
variant: "caption",
|
|
105
|
+
color: "text.secondary",
|
|
106
|
+
sx: hideLabel ? visuallyHidden : {
|
|
107
|
+
fontWeight: 500
|
|
108
|
+
},
|
|
109
|
+
children: text
|
|
110
|
+
}),
|
|
111
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
112
|
+
direction: "row",
|
|
113
|
+
spacing: 0.75,
|
|
114
|
+
sx: {
|
|
115
|
+
flexWrap: 'wrap',
|
|
116
|
+
rowGap: 0.75
|
|
117
|
+
},
|
|
118
|
+
children: options.map((option)=>{
|
|
119
|
+
var _option_label;
|
|
120
|
+
const pressed = sameChoice(value, option.value);
|
|
121
|
+
return /*#__PURE__*/ _jsx(Chip, {
|
|
122
|
+
label: ((_option_label = option.label) == null ? void 0 : _option_label.trim()) || option.value,
|
|
123
|
+
size: "small",
|
|
124
|
+
clickable: !disabled,
|
|
125
|
+
disabled: disabled,
|
|
126
|
+
color: pressed ? 'primary' : 'default',
|
|
127
|
+
variant: pressed ? 'filled' : 'outlined',
|
|
128
|
+
"aria-pressed": pressed,
|
|
129
|
+
onClick: ()=>onChange(option.value)
|
|
130
|
+
}, option.value);
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (kind === 'switch') {
|
|
137
|
+
return /*#__PURE__*/ _jsx(FormControlLabel, {
|
|
138
|
+
label: text,
|
|
139
|
+
disabled: disabled,
|
|
140
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
141
|
+
checked: value === 'true',
|
|
142
|
+
onChange: (event)=>onChange(event.target.checked ? 'true' : 'false')
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (kind === 'select') {
|
|
147
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
148
|
+
select: true,
|
|
149
|
+
label: hideLabel ? undefined : text,
|
|
150
|
+
required: Boolean(required),
|
|
151
|
+
value: value,
|
|
152
|
+
disabled: disabled,
|
|
153
|
+
onChange: (event)=>onChange(event.target.value),
|
|
154
|
+
size: "small",
|
|
155
|
+
slotProps: {
|
|
156
|
+
select: {
|
|
157
|
+
native: true
|
|
158
|
+
},
|
|
159
|
+
htmlInput: hideLabel ? {
|
|
160
|
+
'aria-label': text
|
|
161
|
+
} : undefined
|
|
162
|
+
},
|
|
163
|
+
sx: {
|
|
164
|
+
minWidth: width != null ? width : 200
|
|
165
|
+
},
|
|
166
|
+
children: options.map((option)=>{
|
|
167
|
+
var _option_label;
|
|
168
|
+
return /*#__PURE__*/ _jsx("option", {
|
|
169
|
+
value: option.value,
|
|
170
|
+
children: ((_option_label = option.label) == null ? void 0 : _option_label.trim()) || option.value
|
|
171
|
+
}, option.value);
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
176
|
+
label: hideLabel ? undefined : text,
|
|
177
|
+
required: Boolean(required),
|
|
178
|
+
value: value,
|
|
179
|
+
disabled: disabled,
|
|
180
|
+
onChange: (event)=>onChange(event.target.value),
|
|
181
|
+
size: "small",
|
|
182
|
+
type: kind === 'number' ? 'number' : undefined,
|
|
183
|
+
slotProps: {
|
|
184
|
+
htmlInput: _extends({}, kind === 'number' ? {
|
|
185
|
+
inputMode: 'decimal'
|
|
186
|
+
} : {}, hideLabel ? {
|
|
187
|
+
'aria-label': text
|
|
188
|
+
} : {})
|
|
189
|
+
},
|
|
190
|
+
sx: {
|
|
191
|
+
width: width != null ? width : label ? 200 : 140
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
const visuallyHidden = {
|
|
196
|
+
border: 0,
|
|
197
|
+
clip: 'rect(0 0 0 0)',
|
|
198
|
+
height: '1px',
|
|
199
|
+
margin: '-1px',
|
|
200
|
+
overflow: 'hidden',
|
|
201
|
+
padding: 0,
|
|
202
|
+
position: 'absolute',
|
|
203
|
+
whiteSpace: 'nowrap',
|
|
204
|
+
width: '1px'
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=function-controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/function-controls.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type * as Aglyn from '@aglyn/aglyn'\nimport Chip from '@mui/material/Chip'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport Stack from '@mui/material/Stack'\nimport Switch from '@mui/material/Switch'\nimport TextField from '@mui/material/TextField'\nimport Typography from '@mui/material/Typography'\nimport { useId } from 'react'\n\n/**\n * How one function parameter is ASKED (AGL-3202), shared by the Function\n * Widget, which asks every parameter in a row, and the Function Input\n * element, which asks one wherever the author put it.\n */\n\n/** The control a parameter is drawn as. `auto` follows the parameter. */\nexport type FunctionControlKind =\n | 'auto'\n | 'number'\n | 'text'\n | 'select'\n | 'chips'\n | 'switch'\n\nexport const FUNCTION_CONTROL_KINDS: readonly FunctionControlKind[] = [\n 'auto',\n 'number',\n 'text',\n 'select',\n 'chips',\n 'switch',\n]\n\n/** What each input starts with: the parameter's own default, or nothing. */\nexport function initialFunctionArguments(\n definition: Aglyn.HostFunction | undefined,\n): Record<string, string> {\n const args: Record<string, string> = {}\n for (const parameter of definition?.parameters ?? []) {\n if (parameter.defaultValue != null && parameter.defaultValue !== '') {\n args[parameter.name] = String(parameter.defaultValue)\n } else if (parameter.options?.length) {\n // A select always shows a choice, so the function has to receive the\n // one on screen — not an empty string the visitor never saw.\n args[parameter.name] = String(parameter.options[0].value)\n }\n }\n return args\n}\n\n/** A result as a visitor reads it. */\nexport function displayFunctionValue(\n value: number | string | boolean | undefined,\n): string {\n if (typeof value === 'boolean') return value ? 'Yes' : 'No'\n return value == null ? '' : String(value)\n}\n\n/**\n * Whether a result counts as \"yes\" for an element that shows or hides on it.\n * The strings a function is likely to have built — `'false'`, `'0'`, `'no'` —\n * read as no, because a text local is the only way a function can carry a\n * flag it computed from text.\n */\nexport function isFunctionValueTruthy(\n value: number | string | boolean | undefined,\n): boolean {\n if (typeof value === 'boolean') return value\n if (typeof value === 'number') return value !== 0 && !Number.isNaN(value)\n const text = String(value ?? '').trim().toLowerCase()\n return text !== '' && text !== 'false' && text !== '0' && text !== 'no'\n}\n\n/** `control: auto` resolved against what the parameter is. */\nexport function resolveFunctionControl(\n control: FunctionControlKind | undefined,\n parameter: Pick<Aglyn.HostFunctionParameter, 'type' | 'options'> | undefined,\n hasChoices: boolean,\n): Exclude<FunctionControlKind, 'auto'> {\n if (control && control !== 'auto') return control\n if (hasChoices || parameter?.options?.length) return 'select'\n if (parameter?.type === 'boolean') return 'switch'\n if (parameter?.type === 'number') return 'number'\n return 'text'\n}\n\n/** Two values name the same choice: \"25\" and 25.0 are one quick pick. */\nfunction sameChoice(left: string, right: string): boolean {\n if (left === right) return true\n if (left.trim() === '' || right.trim() === '') return false\n const a = Number(left)\n const b = Number(right)\n return Number.isFinite(a) && Number.isFinite(b) && a === b\n}\n\nexport interface FunctionParameterControlProps {\n /** The parameter's identifier; the label when nothing better is given. */\n name: string\n type?: Aglyn.FunctionValueType\n required?: boolean\n control?: FunctionControlKind\n label?: string\n hideLabel?: boolean\n /** The choices offered by a select or a row of chips. */\n options?: Aglyn.HostFunctionParameterOption[]\n value: string\n onChange: (value: string) => void\n /** The besigner draws the control so it can be designed around; it is inert. */\n disabled?: boolean\n width?: number | string\n}\n\n/**\n * One parameter, drawn as what it is.\n *\n * - **select** is NATIVE. A portal-mounted menu is one more thing a\n * transformed or clipped ancestor can misplace, and on a phone the platform\n * picker is the better control.\n * - **chips** are quick picks: buttons that SET the value, pressed when the\n * value matches. They are how a number box gets \"10 · 25 · 50 · 100\"\n * beside it — two controls on one parameter, which is why this takes a\n * value and an onChange and holds no state of its own.\n */\nexport function FunctionParameterControl(props: FunctionParameterControlProps) {\n const {\n name,\n type,\n required,\n control,\n label,\n hideLabel,\n options = [],\n value,\n onChange,\n disabled,\n width,\n } = props\n const groupLabelId = useId()\n const text = label?.trim() || name\n const kind = resolveFunctionControl(control, { type, options }, options.length > 0)\n if (kind === 'chips') {\n return (\n <Stack spacing={0.75} role=\"group\" aria-labelledby={groupLabelId}>\n <Typography\n id={groupLabelId}\n variant=\"caption\"\n color=\"text.secondary\"\n sx={hideLabel ? visuallyHidden : { fontWeight: 500 }}\n >\n {text}\n </Typography>\n <Stack direction=\"row\" spacing={0.75} sx={{ flexWrap: 'wrap', rowGap: 0.75 }}>\n {options.map((option) => {\n const pressed = sameChoice(value, option.value)\n return (\n <Chip\n key={option.value}\n label={option.label?.trim() || option.value}\n size=\"small\"\n clickable={!disabled}\n disabled={disabled}\n color={pressed ? 'primary' : 'default'}\n variant={pressed ? 'filled' : 'outlined'}\n aria-pressed={pressed}\n onClick={() => onChange(option.value)}\n />\n )\n })}\n </Stack>\n </Stack>\n )\n }\n if (kind === 'switch') {\n return (\n <FormControlLabel\n label={text}\n disabled={disabled}\n control={\n <Switch\n checked={value === 'true'}\n onChange={(event) => onChange(event.target.checked ? 'true' : 'false')}\n />\n }\n />\n )\n }\n if (kind === 'select') {\n return (\n <TextField\n select\n label={hideLabel ? undefined : text}\n required={Boolean(required)}\n value={value}\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n size=\"small\"\n slotProps={{\n select: { native: true },\n htmlInput: hideLabel ? { 'aria-label': text } : undefined,\n }}\n sx={{ minWidth: width ?? 200 }}\n >\n {options.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label?.trim() || option.value}\n </option>\n ))}\n </TextField>\n )\n }\n return (\n <TextField\n label={hideLabel ? undefined : text}\n required={Boolean(required)}\n value={value}\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n size=\"small\"\n type={kind === 'number' ? 'number' : undefined}\n slotProps={{\n htmlInput: {\n ...(kind === 'number' ? { inputMode: 'decimal' } : {}),\n ...(hideLabel ? { 'aria-label': text } : {}),\n },\n }}\n sx={{ width: width ?? (label ? 200 : 140) }}\n />\n )\n}\n\nconst visuallyHidden = {\n border: 0,\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n whiteSpace: 'nowrap',\n width: '1px',\n} as const\n"],"names":["Chip","FormControlLabel","Stack","Switch","TextField","Typography","useId","FUNCTION_CONTROL_KINDS","initialFunctionArguments","definition","args","parameter","parameters","defaultValue","name","String","options","length","value","displayFunctionValue","isFunctionValueTruthy","Number","isNaN","text","trim","toLowerCase","resolveFunctionControl","control","hasChoices","type","sameChoice","left","right","a","b","isFinite","FunctionParameterControl","props","required","label","hideLabel","onChange","disabled","width","groupLabelId","kind","spacing","role","aria-labelledby","id","variant","color","sx","visuallyHidden","fontWeight","direction","flexWrap","rowGap","map","option","pressed","size","clickable","aria-pressed","onClick","checked","event","target","select","undefined","Boolean","slotProps","native","htmlInput","minWidth","inputMode","border","clip","height","margin","overflow","padding","position","whiteSpace"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;;AAGD,OAAOA,UAAU,qBAAoB;AACrC,OAAOC,sBAAsB,iCAAgC;AAC7D,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,gBAAgB,2BAA0B;AACjD,SAASC,KAAK,QAAQ,QAAO;AAiB7B,OAAO,MAAMC,yBAAyD;IACpE;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED,0EAA0E,GAC1E,OAAO,SAASC,yBACdC,UAA0C;;IAE1C,MAAMC,OAA+B,CAAC;IACtC,KAAK,MAAMC,qBAAaF,8BAAAA,WAAYG,UAAU,mBAAI,EAAE,CAAE;YAGzCD;QAFX,IAAIA,UAAUE,YAAY,IAAI,QAAQF,UAAUE,YAAY,KAAK,IAAI;YACnEH,IAAI,CAACC,UAAUG,IAAI,CAAC,GAAGC,OAAOJ,UAAUE,YAAY;QACtD,OAAO,KAAIF,qBAAAA,UAAUK,OAAO,qBAAjBL,mBAAmBM,MAAM,EAAE;YACpC,qEAAqE;YACrE,6DAA6D;YAC7DP,IAAI,CAACC,UAAUG,IAAI,CAAC,GAAGC,OAAOJ,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1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
import { type FunctionControlKind } from './function-controls';
|
|
20
|
+
/**
|
|
21
|
+
* A CALCULATOR AN AUTHOR LAYS OUT (AGL-3202).
|
|
22
|
+
*
|
|
23
|
+
* The Function Widget draws a whole calculator itself: inputs in a row, a
|
|
24
|
+
* button, a result. That is the right block for "a quote in a sidebar" and
|
|
25
|
+
* the wrong one for the page that prompted this — a comparison with a number
|
|
26
|
+
* box AND quick picks on the same value, two questions asked as lists, a
|
|
27
|
+
* table of five rows where four can be filtered away, one row highlighted, a
|
|
28
|
+
* sentence under it and a footnote that changes with the choices. No amount
|
|
29
|
+
* of options on one block reaches that, and it should not have to: laying
|
|
30
|
+
* things out is what the canvas is for.
|
|
31
|
+
*
|
|
32
|
+
* So the pieces are separate elements, and one function binds them:
|
|
33
|
+
*
|
|
34
|
+
* - **Calculator** (`functionScope`) holds the function, the visitor's
|
|
35
|
+
* answers and the live result, and is an ordinary container.
|
|
36
|
+
* - **Calculator Input** (`functionInput`) asks ONE parameter, as a number
|
|
37
|
+
* box, a list, a switch or a row of quick-pick chips. Two inputs may ask
|
|
38
|
+
* the same parameter; they stay in step because the answer lives above
|
|
39
|
+
* them.
|
|
40
|
+
* - **Calculator Result** (`functionOutput`) shows one named value, styled
|
|
41
|
+
* like any text.
|
|
42
|
+
* - **Show When** (`functionShow`) is a container that appears only while a
|
|
43
|
+
* named value is truthy — a table row a filter can remove.
|
|
44
|
+
*
|
|
45
|
+
* Everything between them is whatever the author builds: stacks, grids,
|
|
46
|
+
* headings, borders. The design is theirs and the arithmetic is the site's
|
|
47
|
+
* function, reading the site's variables.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SCOPE_ID: Aglyn.ComponentId;
|
|
50
|
+
export declare const INPUT_ID: Aglyn.ComponentId;
|
|
51
|
+
export declare const OUTPUT_ID: Aglyn.ComponentId;
|
|
52
|
+
export declare const SHOW_ID: Aglyn.ComponentId;
|
|
53
|
+
export interface FunctionScopeProps {
|
|
54
|
+
/** Name of the site function every element inside is bound to. */
|
|
55
|
+
functionName?: string;
|
|
56
|
+
children?: ReactNode;
|
|
57
|
+
/** Injected at compose (attachFunctionDefinitions); never authored. */
|
|
58
|
+
definition?: Aglyn.HostFunction;
|
|
59
|
+
/** The site variables the function names; injected beside `definition`. */
|
|
60
|
+
globals?: Record<string, number | string | boolean>;
|
|
61
|
+
}
|
|
62
|
+
declare const FunctionScope: import("react").ForwardRefExoticComponent<FunctionScopeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
+
export interface FunctionInputProps {
|
|
64
|
+
/** The function parameter this control asks. */
|
|
65
|
+
parameter?: string;
|
|
66
|
+
control?: FunctionControlKind;
|
|
67
|
+
/** Overrides the parameter's own label. */
|
|
68
|
+
label?: string;
|
|
69
|
+
hideLabel?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Overrides the parameter's own choices, as `value: Label, value: Label`.
|
|
72
|
+
* This is how quick picks are given: `10, 25, 50, 100` beside a number box.
|
|
73
|
+
*/
|
|
74
|
+
choices?: string;
|
|
75
|
+
}
|
|
76
|
+
declare const FunctionInput: import("react").ForwardRefExoticComponent<FunctionInputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
77
|
+
export interface FunctionOutputProps {
|
|
78
|
+
/** A parameter or variable of the function; empty is its return value. */
|
|
79
|
+
name?: string;
|
|
80
|
+
/** What the besigner shows in the result's place, e.g. `$625`. */
|
|
81
|
+
placeholder?: string;
|
|
82
|
+
/** Read a change aloud. One result per calculator, usually the sentence. */
|
|
83
|
+
announce?: boolean;
|
|
84
|
+
element?: 'div' | 'p' | 'span';
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* `**like this**` becomes emphasis, and nothing else is markup. The value is
|
|
88
|
+
* text a function built — often from what a visitor typed — so it is split
|
|
89
|
+
* into React nodes and never parsed as HTML.
|
|
90
|
+
*/
|
|
91
|
+
export declare function renderFunctionEmphasis(text: string): ReactNode;
|
|
92
|
+
declare const FunctionOutput: import("react").ForwardRefExoticComponent<FunctionOutputProps & import("react").RefAttributes<HTMLElement>>;
|
|
93
|
+
export interface FunctionShowProps {
|
|
94
|
+
/** A parameter or variable of the function. */
|
|
95
|
+
when?: string;
|
|
96
|
+
/** Show while the value is NOT truthy instead. */
|
|
97
|
+
invert?: boolean;
|
|
98
|
+
children?: ReactNode;
|
|
99
|
+
}
|
|
100
|
+
declare const FunctionShow: import("react").ForwardRefExoticComponent<FunctionShowProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
101
|
+
export declare const schema: Aglyn.ComponentSchema<FunctionScopeProps>;
|
|
102
|
+
export declare const functionInputSchema: Aglyn.ComponentSchema<FunctionInputProps>;
|
|
103
|
+
export declare const functionOutputSchema: Aglyn.ComponentSchema<FunctionOutputProps>;
|
|
104
|
+
export declare const functionShowSchema: Aglyn.ComponentSchema<FunctionShowProps>;
|
|
105
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
106
|
+
export declare const functionInputPresets: Aglyn.PresetSchema[];
|
|
107
|
+
export declare const functionOutputPresets: Aglyn.PresetSchema[];
|
|
108
|
+
export declare const functionShowPresets: Aglyn.PresetSchema[];
|
|
109
|
+
export { FunctionInput, FunctionOutput, FunctionShow };
|
|
110
|
+
export default FunctionScope;
|