@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,132 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
20
|
+
import { mdiPageLayoutBody } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import Box from "@mui/material/Box";
|
|
22
|
+
import { forwardRef } from "react";
|
|
23
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
24
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
25
|
+
// Component ids are persisted in screen documents; never rename.
|
|
26
|
+
export const ID = 'section';
|
|
27
|
+
/**
|
|
28
|
+
* W3C sectioning/grouping elements the component may render as (AGL-336).
|
|
29
|
+
*
|
|
30
|
+
* ⛔ `main` IS NOT ONE OF THEM (AGL-2486). A published page carries exactly
|
|
31
|
+
* one `main` landmark, placed by composition on the page's content region —
|
|
32
|
+
* the layout's slot, or the screen root when there is no layout, each of which
|
|
33
|
+
* offers its own element picker. An author-selectable `main` on a grouping
|
|
34
|
+
* container that may appear any number of times per page could only ever
|
|
35
|
+
* produce a SECOND one — and two `main` elements is a worse
|
|
36
|
+
* accessibility outcome than none, because the landmark stops naming anything
|
|
37
|
+
* in particular. It was offered in this select, with field help recommending
|
|
38
|
+
* it, which made the duplicate the documented choice rather than a mistake.
|
|
39
|
+
*
|
|
40
|
+
* Removing it degrades rather than breaks: the resolver below falls back to
|
|
41
|
+
* `section` for any value not in this list, so a stored `element: 'main'` on a
|
|
42
|
+
* published screen renders as `<section>` — still a grouping element, still
|
|
43
|
+
* where the author put it, and no longer competing with the layout's landmark.
|
|
44
|
+
*/ export const SECTION_ELEMENTS = [
|
|
45
|
+
'section',
|
|
46
|
+
'div',
|
|
47
|
+
'article',
|
|
48
|
+
'aside',
|
|
49
|
+
'nav',
|
|
50
|
+
'header',
|
|
51
|
+
'footer'
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Semantic grouping container (AGL-336): renders children inside the
|
|
55
|
+
* chosen W3C element so pages keep meaningful document structure
|
|
56
|
+
* (landmarks for assistive tech, better SEO outlines) instead of
|
|
57
|
+
* div-soup. Behaves like any container: droppable, stylable via sx,
|
|
58
|
+
* classes, and interactions.
|
|
59
|
+
*/ const Section = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
60
|
+
const { element, ariaLabel, children } = props, rest = _object_without_properties_loose(props, [
|
|
61
|
+
"element",
|
|
62
|
+
"ariaLabel",
|
|
63
|
+
"children"
|
|
64
|
+
]);
|
|
65
|
+
const component = SECTION_ELEMENTS.includes(element) ? element : 'section';
|
|
66
|
+
return /*#__PURE__*/ _jsx(Box, _extends({
|
|
67
|
+
ref: ref,
|
|
68
|
+
component: component,
|
|
69
|
+
"aria-label": ariaLabel || undefined
|
|
70
|
+
}, rest, {
|
|
71
|
+
children: children
|
|
72
|
+
}));
|
|
73
|
+
});
|
|
74
|
+
Section.displayName = 'AglynSection';
|
|
75
|
+
export const schema = {
|
|
76
|
+
$id: ID,
|
|
77
|
+
pluginId: BUNDLE_ID,
|
|
78
|
+
displayName: 'Section',
|
|
79
|
+
description: 'Groups components inside a semantic HTML element (section, article, nav, …).',
|
|
80
|
+
category: Aglyn.ComponentCategory.LAYOUT,
|
|
81
|
+
icon: {
|
|
82
|
+
path: mdiPageLayoutBody.path,
|
|
83
|
+
sx: {
|
|
84
|
+
color: '#2196f3'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
attributes: [
|
|
88
|
+
{
|
|
89
|
+
name: 'element',
|
|
90
|
+
label: 'Component',
|
|
91
|
+
description: 'The DOM element this section renders as, per W3C semantics. ' + 'Use section/article/aside/nav/header/footer for meaningful ' + 'structure; div for purely visual grouping.',
|
|
92
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
93
|
+
options: SECTION_ELEMENTS.map((value)=>({
|
|
94
|
+
value,
|
|
95
|
+
label: value
|
|
96
|
+
}))
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'ariaLabel',
|
|
100
|
+
label: 'Accessible label',
|
|
101
|
+
description: 'Names the landmark for screen readers (recommended when a page ' + 'has several of the same element).',
|
|
102
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
};
|
|
106
|
+
export const presets = [
|
|
107
|
+
{
|
|
108
|
+
$id: generatePresetId(ID),
|
|
109
|
+
type: Aglyn.NodeType.PRESET,
|
|
110
|
+
displayName: 'Section',
|
|
111
|
+
pluginId: BUNDLE_ID,
|
|
112
|
+
description: 'Semantic grouping container (section/div/article/…)',
|
|
113
|
+
category: Aglyn.ComponentCategory.LAYOUT,
|
|
114
|
+
icon: {
|
|
115
|
+
path: mdiPageLayoutBody.path,
|
|
116
|
+
sx: {
|
|
117
|
+
color: '#2196f3'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
data: {
|
|
121
|
+
$id: null,
|
|
122
|
+
componentId: ID,
|
|
123
|
+
pluginId: BUNDLE_ID,
|
|
124
|
+
props: {
|
|
125
|
+
element: 'section'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
export default Section;
|
|
131
|
+
|
|
132
|
+
//# sourceMappingURL=section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/section.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 * as Aglyn from '@aglyn/aglyn'\nimport { mdiPageLayoutBody } from '@aglyn/shared-data-mdi'\nimport Box from '@mui/material/Box'\nimport { forwardRef } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n// Component ids are persisted in screen documents; never rename.\nexport const ID: Aglyn.ComponentId = 'section'\n\n/**\n * W3C sectioning/grouping elements the component may render as (AGL-336).\n *\n * ⛔ `main` IS NOT ONE OF THEM (AGL-2486). A published page carries exactly\n * one `main` landmark, placed by composition on the page's content region —\n * the layout's slot, or the screen root when there is no layout, each of which\n * offers its own element picker. An author-selectable `main` on a grouping\n * container that may appear any number of times per page could only ever\n * produce a SECOND one — and two `main` elements is a worse\n * accessibility outcome than none, because the landmark stops naming anything\n * in particular. It was offered in this select, with field help recommending\n * it, which made the duplicate the documented choice rather than a mistake.\n *\n * Removing it degrades rather than breaks: the resolver below falls back to\n * `section` for any value not in this list, so a stored `element: 'main'` on a\n * published screen renders as `<section>` — still a grouping element, still\n * where the author put it, and no longer competing with the layout's landmark.\n */\nexport const SECTION_ELEMENTS = [\n 'section',\n 'div',\n 'article',\n 'aside',\n 'nav',\n 'header',\n 'footer',\n] as const\nexport type SectionElement = (typeof SECTION_ELEMENTS)[number]\n\nexport interface SectionProps {\n /** The DOM element rendered; defaults to `section`. */\n element?: SectionElement\n /** Accessible name announced for landmark elements. */\n ariaLabel?: string\n children?: JSX.Children\n}\n\n/**\n * Semantic grouping container (AGL-336): renders children inside the\n * chosen W3C element so pages keep meaningful document structure\n * (landmarks for assistive tech, better SEO outlines) instead of\n * div-soup. Behaves like any container: droppable, stylable via sx,\n * classes, and interactions.\n */\nconst Section = forwardRef<HTMLElement, SectionProps>((props, ref) => {\n const { element, ariaLabel, children, ...rest } = props\n const component = SECTION_ELEMENTS.includes(element as SectionElement)\n ? (element as SectionElement)\n : 'section'\n return (\n <Box\n ref={ref}\n component={component}\n aria-label={ariaLabel || undefined}\n {...rest}\n >\n {children}\n </Box>\n )\n})\nSection.displayName = 'AglynSection'\n\nexport const schema: Aglyn.ComponentSchema<SectionProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Section',\n description:\n 'Groups components inside a semantic HTML element (section, article, nav, …).',\n category: Aglyn.ComponentCategory.LAYOUT,\n icon: { path: mdiPageLayoutBody.path, sx: { color: '#2196f3' } },\n attributes: [\n {\n name: 'element',\n label: 'Component',\n description:\n 'The DOM element this section renders as, per W3C semantics. ' +\n 'Use section/article/aside/nav/header/footer for meaningful ' +\n 'structure; div for purely visual grouping.',\n component: Aglyn.FieldComponentType.SELECT,\n options: SECTION_ELEMENTS.map((value) => ({ value, label: value })),\n },\n {\n name: 'ariaLabel',\n label: 'Accessible label',\n description:\n 'Names the landmark for screen readers (recommended when a page ' +\n 'has several of the same element).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Section',\n pluginId: BUNDLE_ID,\n description: 'Semantic grouping container (section/div/article/…)',\n category: Aglyn.ComponentCategory.LAYOUT,\n icon: { path: mdiPageLayoutBody.path, sx: { color: '#2196f3' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { element: 'section' },\n },\n },\n]\n\nexport default Section\n"],"names":["Aglyn","mdiPageLayoutBody","Box","forwardRef","BUNDLE_ID","generatePresetId","ID","SECTION_ELEMENTS","Section","props","ref","element","ariaLabel","children","rest","component","includes","aria-label","undefined","displayName","schema","$id","pluginId","description","category","ComponentCategory","LAYOUT","icon","path","sx","color","attributes","name","label","FieldComponentType","SELECT","options","map","value","TEXT_FIELD","presets","type","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,OAAOC,SAAS,oBAAmB;AACnC,SAASC,UAAU,QAAQ,QAAO;AAClC,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,UAAS;AAE9C;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,MAAMC,mBAAmB;IAC9B;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAS;AAWV;;;;;;CAMC,GACD,MAAMC,wBAAUL,WAAsC,CAACM,OAAOC;IAC5D,MAAM,EAAEC,OAAO,EAAEC,SAAS,EAAEC,QAAQ,EAAW,GAAGJ,OAATK,wCAASL;;;;;IAClD,MAAMM,YAAYR,iBAAiBS,QAAQ,CAACL,WACvCA,UACD;IACJ,qBACE,KAACT;QACCQ,KAAKA;QACLK,WAAWA;QACXE,cAAYL,aAAaM;OACrBJ;kBAEHD;;AAGP;AACAL,QAAQW,WAAW,GAAG;AAEtB,OAAO,MAAMC,SAA8C;IACzDC,KAAKf;IACLgB,UAAUlB;IACVe,aAAa;IACbI,aACE;IACFC,UAAUxB,MAAMyB,iBAAiB,CAACC,MAAM;IACxCC,MAAM;QAAEC,MAAM3B,kBAAkB2B,IAAI;QAAEC,IAAI;YAAEC,OAAO;QAAU;IAAE;IAC/DC,YAAY;QACV;YACEC,MAAM;YACNC,OAAO;YACPV,aACE,iEACA,gEACA;YACFR,WAAWf,MAAMkC,kBAAkB,CAACC,MAAM;YAC1CC,SAAS7B,iBAAiB8B,GAAG,CAAC,CAACC,QAAW,CAAA;oBAAEA;oBAAOL,OAAOK;gBAAM,CAAA;QAClE;QACA;YACEN,MAAM;YACNC,OAAO;YACPV,aACE,oEACA;YACFR,WAAWf,MAAMkC,kBAAkB,CAACK,UAAU;QAChD;KACD;AACH,EAAC;AAED,OAAO,MAAMC,UAAgC;IAC3C;QACEnB,KAAKhB,iBAAiBC;QACtBmC,MAAMzC,MAAM0C,QAAQ,CAACC,MAAM;QAC3BxB,aAAa;QACbG,UAAUlB;QACVmB,aAAa;QACbC,UAAUxB,MAAMyB,iBAAiB,CAACC,MAAM;QACxCC,MAAM;YAAEC,MAAM3B,kBAAkB2B,IAAI;YAAEC,IAAI;gBAAEC,OAAO;YAAU;QAAE;QAC/Dc,MAAM;YACJvB,KAAK;YACLwB,aAAavC;YACbgB,UAAUlB;YACVK,OAAO;gBAAEE,SAAS;YAAU;QAC9B;IACF;CACD,CAAA;AAED,eAAeH,QAAO"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 StackProps } from '@mui/material/Stack';
|
|
19
|
+
import type { CSSProperties } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* The dividers the `divider` attribute can name (AGL-2486).
|
|
22
|
+
*
|
|
23
|
+
* MUI's own `divider` prop takes a NODE, which an attributes panel cannot
|
|
24
|
+
* author — so the persisted value is a style name and this file builds the
|
|
25
|
+
* element. Anything else (an author's stray string, a paste) renders no
|
|
26
|
+
* divider rather than the literal text between every pair of children.
|
|
27
|
+
*/
|
|
28
|
+
declare const DIVIDER_STYLES: {
|
|
29
|
+
readonly line: {};
|
|
30
|
+
readonly dashed: {
|
|
31
|
+
readonly borderStyle: "dashed";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export type StackDivider = keyof typeof DIVIDER_STYLES;
|
|
35
|
+
type StackWithFlexProps = Omit<StackProps, 'divider'> & {
|
|
36
|
+
justifyContent?: CSSProperties['justifyContent'];
|
|
37
|
+
alignItems?: CSSProperties['alignItems'];
|
|
38
|
+
flexWrap?: CSSProperties['flexWrap'];
|
|
39
|
+
/** Divider STYLE name, not a node — see {@link DIVIDER_STYLES}. */
|
|
40
|
+
divider?: StackDivider | string;
|
|
41
|
+
/**
|
|
42
|
+
* A repeat's directives (AGL-103, AGL-181). The published page's
|
|
43
|
+
* composition consumes them before anything renders; a surface that renders
|
|
44
|
+
* the stored node as written, like a component editor, still hands them over.
|
|
45
|
+
*/
|
|
46
|
+
repeatDataset?: string;
|
|
47
|
+
repeatLimit?: number | string;
|
|
48
|
+
repeatFilter?: string;
|
|
49
|
+
repeatSort?: string;
|
|
50
|
+
};
|
|
51
|
+
declare const Stack: import("react").ForwardRefExoticComponent<Omit<StackWithFlexProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export declare const ID: Aglyn.ComponentId;
|
|
53
|
+
export declare const schema: Aglyn.ComponentSchema;
|
|
54
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
55
|
+
export default Stack;
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2026 Aglyn LLC
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
19
|
+
import { mdiViewColumn, mdiViewSequential } from "@aglyn/shared-data-mdi";
|
|
20
|
+
import MuiDivider from "@mui/material/Divider";
|
|
21
|
+
import MuiStack from "@mui/material/Stack";
|
|
22
|
+
import { createElement, forwardRef } from "react";
|
|
23
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
24
|
+
import { applySemanticElement, semanticElementAttribute, semanticElementLabelAttribute } from "../utils/element-picker.js";
|
|
25
|
+
import { dropClearedProps } from "../utils/drop-cleared-props.js";
|
|
26
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
27
|
+
/**
|
|
28
|
+
* The dividers the `divider` attribute can name (AGL-2486).
|
|
29
|
+
*
|
|
30
|
+
* MUI's own `divider` prop takes a NODE, which an attributes panel cannot
|
|
31
|
+
* author — so the persisted value is a style name and this file builds the
|
|
32
|
+
* element. Anything else (an author's stray string, a paste) renders no
|
|
33
|
+
* divider rather than the literal text between every pair of children.
|
|
34
|
+
*/ const DIVIDER_STYLES = {
|
|
35
|
+
line: {},
|
|
36
|
+
dashed: {
|
|
37
|
+
borderStyle: 'dashed'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A Stack's divider runs ACROSS the flow, so its orientation is the
|
|
42
|
+
* opposite of the stack's own axis. A responsive `direction` (an array or
|
|
43
|
+
* object) is not authorable here, so only the string form is inspected;
|
|
44
|
+
* anything else falls back to MUI's default horizontal rule.
|
|
45
|
+
*/ function buildDivider(divider, direction) {
|
|
46
|
+
if (typeof divider !== 'string') return undefined;
|
|
47
|
+
// `hasOwnProperty`, not a truthiness test on the lookup: `"constructor"`
|
|
48
|
+
// and friends resolve through Object.prototype and would sail past one.
|
|
49
|
+
if (!Object.prototype.hasOwnProperty.call(DIVIDER_STYLES, divider)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const style = DIVIDER_STYLES[divider];
|
|
53
|
+
const horizontal = typeof direction === 'string' && direction.startsWith('row');
|
|
54
|
+
return createElement(MuiDivider, {
|
|
55
|
+
orientation: horizontal ? 'vertical' : 'horizontal',
|
|
56
|
+
// Without it a vertical divider collapses to zero height in a flex row.
|
|
57
|
+
flexItem: horizontal,
|
|
58
|
+
sx: style
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const Stack = forwardRef(// repeatDataset/repeatLimit are compose-time attributes (AGL-103): the
|
|
62
|
+
// tenant expands them before render; strip so they never hit the DOM.
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
64
|
+
(_0, _1)=>{
|
|
65
|
+
let _ref = [
|
|
66
|
+
_0,
|
|
67
|
+
_1
|
|
68
|
+
], [_ref1, ..._rest] = _ref, { justifyContent, alignItems, flexWrap, divider, repeatDataset, repeatLimit, repeatFilter, repeatSort, sx } = _ref1, props = _object_without_properties_loose(_ref1, [
|
|
69
|
+
"justifyContent",
|
|
70
|
+
"alignItems",
|
|
71
|
+
"flexWrap",
|
|
72
|
+
"divider",
|
|
73
|
+
"repeatDataset",
|
|
74
|
+
"repeatLimit",
|
|
75
|
+
"repeatFilter",
|
|
76
|
+
"repeatSort",
|
|
77
|
+
"sx"
|
|
78
|
+
]), [ref] = _rest;
|
|
79
|
+
return createElement(MuiStack, _extends({
|
|
80
|
+
ref,
|
|
81
|
+
sx: [
|
|
82
|
+
{
|
|
83
|
+
justifyContent,
|
|
84
|
+
alignItems,
|
|
85
|
+
flexWrap
|
|
86
|
+
},
|
|
87
|
+
...Array.isArray(sx) ? sx : sx ? [
|
|
88
|
+
sx
|
|
89
|
+
] : []
|
|
90
|
+
],
|
|
91
|
+
// The stored value is a style NAME; MUI wants a node (AGL-2486).
|
|
92
|
+
divider: buildDivider(divider, props.direction)
|
|
93
|
+
}, applySemanticElement(dropClearedProps(props))));
|
|
94
|
+
});
|
|
95
|
+
// Component ids are persisted in screen documents; keep the legacy ids.
|
|
96
|
+
export const ID = 'muiStack';
|
|
97
|
+
export const schema = {
|
|
98
|
+
$id: ID,
|
|
99
|
+
pluginId: BUNDLE_ID,
|
|
100
|
+
displayName: 'Stack',
|
|
101
|
+
description: 'Lays children out in a row or column with even spacing — the workhorse for most layouts.',
|
|
102
|
+
category: Aglyn.ComponentCategory.LAYOUT,
|
|
103
|
+
icon: {
|
|
104
|
+
path: mdiViewColumn.path,
|
|
105
|
+
sx: {
|
|
106
|
+
color: '#2196f3'
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
attributes: [
|
|
110
|
+
semanticElementAttribute('this stack'),
|
|
111
|
+
semanticElementLabelAttribute(),
|
|
112
|
+
{
|
|
113
|
+
name: 'direction',
|
|
114
|
+
label: 'Direction',
|
|
115
|
+
description: 'Defines the directional flow using the `flex-direction` style property. It is applied for all screen sizes.',
|
|
116
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
117
|
+
// "Default" deleted (AGL-1453): unpersistable, and a second name for
|
|
118
|
+
// `column`, MUI Stack's own default, already on the list.
|
|
119
|
+
options: [
|
|
120
|
+
{
|
|
121
|
+
value: 'column',
|
|
122
|
+
label: 'Column'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
value: 'column-reverse',
|
|
126
|
+
label: 'Column Reversed'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
value: 'row',
|
|
130
|
+
label: 'Row'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: 'row-reverse',
|
|
134
|
+
label: 'Row Reversed'
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'justifyContent',
|
|
140
|
+
label: 'Justify Content',
|
|
141
|
+
description: 'Defines how the browser distributes space between and around content items along the main-axis of the container.',
|
|
142
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
143
|
+
// "Default" deleted (AGL-1453). Unpersistable, and a second name for
|
|
144
|
+
// `flex-start`: CSS's initial `justify-content` is `normal`, which on a
|
|
145
|
+
// flex container — which a Stack always is — behaves as `flex-start`.
|
|
146
|
+
//
|
|
147
|
+
// Deleted rather than sentinelled for a second reason specific to this
|
|
148
|
+
// prop: `justifyContent` is destructured out ABOVE and pushed into
|
|
149
|
+
// `sx`, so it never passes through `dropClearedProps`. It is the one
|
|
150
|
+
// attribute on this component the guard does not cover, so the right
|
|
151
|
+
// move is to stop minting values it would have to catch.
|
|
152
|
+
options: [
|
|
153
|
+
{
|
|
154
|
+
value: 'flex-start',
|
|
155
|
+
label: 'Flex Start'
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
value: 'center',
|
|
159
|
+
label: 'Center'
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
value: 'flex-end',
|
|
163
|
+
label: 'Flex End'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
value: 'space-between',
|
|
167
|
+
label: 'Space Between'
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
value: 'space-around',
|
|
171
|
+
label: 'Space Around'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
value: 'space-evenly',
|
|
175
|
+
label: 'Space Evenly'
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'alignItems',
|
|
181
|
+
label: 'Align Items',
|
|
182
|
+
description: 'Defines how the browser distributes space between and around ' + 'content items along the cross-axis of the container — the axis ' + 'across the Direction.',
|
|
183
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
184
|
+
// No "Default" sentinel (AGL-1453): `stretch` is CSS's own initial
|
|
185
|
+
// `align-items` and is already on the list, and like `justifyContent`
|
|
186
|
+
// this prop is pushed into `sx` rather than through
|
|
187
|
+
// `dropClearedProps`, so an unpersistable `''` would not be caught.
|
|
188
|
+
options: [
|
|
189
|
+
{
|
|
190
|
+
value: 'stretch',
|
|
191
|
+
label: 'Stretch'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
value: 'flex-start',
|
|
195
|
+
label: 'Flex Start'
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
value: 'center',
|
|
199
|
+
label: 'Center'
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
value: 'flex-end',
|
|
203
|
+
label: 'Flex End'
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
value: 'baseline',
|
|
207
|
+
label: 'Baseline'
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'spacing',
|
|
213
|
+
label: 'Spacing',
|
|
214
|
+
description: 'Defines the space/gap between its immediate children.',
|
|
215
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
216
|
+
type: 'number'
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'useFlexGap',
|
|
220
|
+
label: 'Use flex gap',
|
|
221
|
+
description: 'Space children with the CSS `gap` property instead of margins. ' + 'Required for Spacing to survive wrapping, and it leaves child ' + 'margins alone — but `gap` is unsupported in some older browsers.',
|
|
222
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'flexWrap',
|
|
226
|
+
label: 'Wrap',
|
|
227
|
+
description: 'Whether children that do not fit move onto a new line. Turn on ' + 'Use flex gap as well, or Spacing is applied as margins and the ' + 'wrapped rows get an uneven gap.',
|
|
228
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
229
|
+
options: [
|
|
230
|
+
{
|
|
231
|
+
value: 'nowrap',
|
|
232
|
+
label: 'No Wrap'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
value: 'wrap',
|
|
236
|
+
label: 'Wrap'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
value: 'wrap-reverse',
|
|
240
|
+
label: 'Wrap Reversed'
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
name: 'divider',
|
|
246
|
+
label: 'Divider',
|
|
247
|
+
description: 'Draws a rule between each pair of children, across the ' + 'Direction. Clear the field for no divider.',
|
|
248
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
249
|
+
// MUI's own prop takes a node; the persisted value is a style name and
|
|
250
|
+
// the component builds the element. No `''` option (AGL-1453) — "no
|
|
251
|
+
// divider" is the field's ✕, which persists as cleared.
|
|
252
|
+
options: [
|
|
253
|
+
{
|
|
254
|
+
value: 'line',
|
|
255
|
+
label: 'Line'
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
value: 'dashed',
|
|
259
|
+
label: 'Dashed'
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
};
|
|
265
|
+
export const presets = [
|
|
266
|
+
{
|
|
267
|
+
$id: generatePresetId(ID),
|
|
268
|
+
type: Aglyn.NodeType.PRESET,
|
|
269
|
+
displayName: 'Stack Horizontal',
|
|
270
|
+
icon: {
|
|
271
|
+
path: mdiViewColumn.path,
|
|
272
|
+
sx: {
|
|
273
|
+
color: '#2196f3'
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
category: Aglyn.ComponentCategory.LAYOUT,
|
|
277
|
+
data: {
|
|
278
|
+
$id: null,
|
|
279
|
+
componentId: ID,
|
|
280
|
+
pluginId: BUNDLE_ID,
|
|
281
|
+
props: {
|
|
282
|
+
direction: 'row'
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
$id: generatePresetId(ID, 'vertical'),
|
|
288
|
+
type: Aglyn.NodeType.PRESET,
|
|
289
|
+
displayName: 'Stack Vertical',
|
|
290
|
+
icon: {
|
|
291
|
+
path: mdiViewSequential.path,
|
|
292
|
+
sx: {
|
|
293
|
+
color: '#2196f3'
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
category: Aglyn.ComponentCategory.LAYOUT,
|
|
297
|
+
data: {
|
|
298
|
+
$id: null,
|
|
299
|
+
componentId: ID,
|
|
300
|
+
pluginId: BUNDLE_ID,
|
|
301
|
+
props: {
|
|
302
|
+
direction: 'column'
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
];
|
|
307
|
+
export default Stack;
|
|
308
|
+
|
|
309
|
+
//# sourceMappingURL=stack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/stack.ts"],"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 * as Aglyn from '@aglyn/aglyn'\nimport {\n mdiViewColumn,\n mdiViewSequential,\n} from '@aglyn/shared-data-mdi'\nimport MuiDivider from '@mui/material/Divider'\nimport MuiStack, { type StackProps } from '@mui/material/Stack'\nimport type { CSSProperties, ReactElement } from 'react'\nimport { createElement, forwardRef } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport {\n applySemanticElement,\n semanticElementAttribute,\n semanticElementLabelAttribute,\n} from '../utils/element-picker'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n/**\n * The dividers the `divider` attribute can name (AGL-2486).\n *\n * MUI's own `divider` prop takes a NODE, which an attributes panel cannot\n * author — so the persisted value is a style name and this file builds the\n * element. Anything else (an author's stray string, a paste) renders no\n * divider rather than the literal text between every pair of children.\n */\nconst DIVIDER_STYLES = {\n line: {},\n dashed: { borderStyle: 'dashed' },\n} as const\n\nexport type StackDivider = keyof typeof DIVIDER_STYLES\n\n// justifyContent/alignItems/flexWrap are not direct StackProps in MUI v6+;\n// pass them through sx.\ntype StackWithFlexProps = Omit<StackProps, 'divider'> & {\n justifyContent?: CSSProperties['justifyContent']\n alignItems?: CSSProperties['alignItems']\n flexWrap?: CSSProperties['flexWrap']\n /** Divider STYLE name, not a node — see {@link DIVIDER_STYLES}. */\n divider?: StackDivider | string\n /**\n * A repeat's directives (AGL-103, AGL-181). The published page's\n * composition consumes them before anything renders; a surface that renders\n * the stored node as written, like a component editor, still hands them over.\n */\n repeatDataset?: string\n repeatLimit?: number | string\n repeatFilter?: string\n repeatSort?: string\n}\n\n/**\n * A Stack's divider runs ACROSS the flow, so its orientation is the\n * opposite of the stack's own axis. A responsive `direction` (an array or\n * object) is not authorable here, so only the string form is inspected;\n * anything else falls back to MUI's default horizontal rule.\n */\nfunction buildDivider(\n divider: unknown,\n direction: unknown,\n): ReactElement | undefined {\n if (typeof divider !== 'string') return undefined\n // `hasOwnProperty`, not a truthiness test on the lookup: `\"constructor\"`\n // and friends resolve through Object.prototype and would sail past one.\n if (!Object.prototype.hasOwnProperty.call(DIVIDER_STYLES, divider)) {\n return undefined\n }\n const style = DIVIDER_STYLES[divider as StackDivider]\n const horizontal =\n typeof direction === 'string' && direction.startsWith('row')\n return createElement(MuiDivider, {\n orientation: horizontal ? 'vertical' : 'horizontal',\n // Without it a vertical divider collapses to zero height in a flex row.\n flexItem: horizontal,\n sx: style,\n })\n}\n\nconst Stack = forwardRef<HTMLDivElement, StackWithFlexProps>(\n // repeatDataset/repeatLimit are compose-time attributes (AGL-103): the\n // tenant expands them before render; strip so they never hit the DOM.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ({ justifyContent, alignItems, flexWrap, divider, repeatDataset, repeatLimit, repeatFilter, repeatSort, sx, ...props }, ref) =>\n createElement(MuiStack, {\n ref,\n sx: [\n { justifyContent, alignItems, flexWrap },\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ],\n // The stored value is a style NAME; MUI wants a node (AGL-2486).\n divider: buildDivider(divider, props.direction),\n // A cleared `direction` persists as null, and MUI resolves it as a\n // responsive value — `null.xs` throws during SSR and 500s the page.\n // Same class as the AGL-1226 button colour, different sharp edge.\n // Last, so an author's element wins over anything `props` carried\n // (AGL-2525). A stack IS the nav row on most sites; before this it\n // could only be wrapped in one.\n ...applySemanticElement(dropClearedProps(props) as Record<string, unknown>),\n }),\n)\n\n// Component ids are persisted in screen documents; keep the legacy ids.\nexport const ID: Aglyn.ComponentId = 'muiStack'\n\nexport const schema: Aglyn.ComponentSchema = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Stack',\n description:\n 'Lays children out in a row or column with even spacing — the workhorse for most layouts.',\n category: Aglyn.ComponentCategory.LAYOUT,\n icon: {\n path: mdiViewColumn.path,\n sx: { color: '#2196f3' },\n },\n attributes: [\n semanticElementAttribute('this stack'),\n semanticElementLabelAttribute(),\n {\n name: 'direction',\n label: 'Direction',\n description:\n 'Defines the directional flow using the `flex-direction` style property. It is applied for all screen sizes.',\n component: Aglyn.FieldComponentType.SELECT,\n // \"Default\" deleted (AGL-1453): unpersistable, and a second name for\n // `column`, MUI Stack's own default, already on the list.\n options: [\n { value: 'column', label: 'Column' },\n { value: 'column-reverse', label: 'Column Reversed' },\n { value: 'row', label: 'Row' },\n { value: 'row-reverse', label: 'Row Reversed' },\n ],\n },\n {\n name: 'justifyContent',\n label: 'Justify Content',\n description:\n 'Defines how the browser distributes space between and around content items along the main-axis of the container.',\n component: Aglyn.FieldComponentType.SELECT,\n // \"Default\" deleted (AGL-1453). Unpersistable, and a second name for\n // `flex-start`: CSS's initial `justify-content` is `normal`, which on a\n // flex container — which a Stack always is — behaves as `flex-start`.\n //\n // Deleted rather than sentinelled for a second reason specific to this\n // prop: `justifyContent` is destructured out ABOVE and pushed into\n // `sx`, so it never passes through `dropClearedProps`. It is the one\n // attribute on this component the guard does not cover, so the right\n // move is to stop minting values it would have to catch.\n options: [\n { value: 'flex-start', label: 'Flex Start' },\n { value: 'center', label: 'Center' },\n { value: 'flex-end', label: 'Flex End' },\n { value: 'space-between', label: 'Space Between' },\n { value: 'space-around', label: 'Space Around' },\n { value: 'space-evenly', label: 'Space Evenly' },\n ],\n },\n {\n name: 'alignItems',\n label: 'Align Items',\n description:\n 'Defines how the browser distributes space between and around ' +\n 'content items along the cross-axis of the container — the axis ' +\n 'across the Direction.',\n component: Aglyn.FieldComponentType.SELECT,\n // No \"Default\" sentinel (AGL-1453): `stretch` is CSS's own initial\n // `align-items` and is already on the list, and like `justifyContent`\n // this prop is pushed into `sx` rather than through\n // `dropClearedProps`, so an unpersistable `''` would not be caught.\n options: [\n { value: 'stretch', label: 'Stretch' },\n { value: 'flex-start', label: 'Flex Start' },\n { value: 'center', label: 'Center' },\n { value: 'flex-end', label: 'Flex End' },\n { value: 'baseline', label: 'Baseline' },\n ],\n },\n {\n name: 'spacing',\n label: 'Spacing',\n description: 'Defines the space/gap between its immediate children.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'useFlexGap',\n label: 'Use flex gap',\n description:\n 'Space children with the CSS `gap` property instead of margins. ' +\n 'Required for Spacing to survive wrapping, and it leaves child ' +\n 'margins alone — but `gap` is unsupported in some older browsers.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'flexWrap',\n label: 'Wrap',\n description:\n 'Whether children that do not fit move onto a new line. Turn on ' +\n 'Use flex gap as well, or Spacing is applied as margins and the ' +\n 'wrapped rows get an uneven gap.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'nowrap', label: 'No Wrap' },\n { value: 'wrap', label: 'Wrap' },\n { value: 'wrap-reverse', label: 'Wrap Reversed' },\n ],\n },\n {\n name: 'divider',\n label: 'Divider',\n description:\n 'Draws a rule between each pair of children, across the ' +\n 'Direction. Clear the field for no divider.',\n component: Aglyn.FieldComponentType.SELECT,\n // MUI's own prop takes a node; the persisted value is a style name and\n // the component builds the element. No `''` option (AGL-1453) — \"no\n // divider\" is the field's ✕, which persists as cleared.\n options: [\n { value: 'line', label: 'Line' },\n { value: 'dashed', label: 'Dashed' },\n ],\n },\n // No Repeat fields: every element's Attributes panel draws the same Repeat\n // section (AGL-3111), writing the props a Stack has always stored.\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Stack Horizontal',\n icon: {\n path: mdiViewColumn.path,\n sx: { color: '#2196f3' },\n },\n category: Aglyn.ComponentCategory.LAYOUT,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { direction: 'row' },\n },\n },\n {\n $id: generatePresetId(ID, 'vertical'),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Stack Vertical',\n icon: {\n path: mdiViewSequential.path,\n sx: { color: '#2196f3' },\n },\n category: Aglyn.ComponentCategory.LAYOUT,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { direction: 'column' },\n },\n },\n]\n\nexport default Stack\n"],"names":["Aglyn","mdiViewColumn","mdiViewSequential","MuiDivider","MuiStack","createElement","forwardRef","BUNDLE_ID","applySemanticElement","semanticElementAttribute","semanticElementLabelAttribute","dropClearedProps","generatePresetId","DIVIDER_STYLES","line","dashed","borderStyle","buildDivider","divider","direction","undefined","Object","prototype","hasOwnProperty","call","style","horizontal","startsWith","orientation","flexItem","sx","Stack","justifyContent","alignItems","flexWrap","repeatDataset","repeatLimit","repeatFilter","repeatSort","props","ref","Array","isArray","ID","schema","$id","pluginId","displayName","description","category","ComponentCategory","LAYOUT","icon","path","color","attributes","name","label","component","FieldComponentType","SELECT","options","value","TEXT_FIELD","type","SWITCH","presets","NodeType","PRESET","data","componentId"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,aAAa,EACbC,iBAAiB,QACZ,yBAAwB;AAC/B,OAAOC,gBAAgB,wBAAuB;AAC9C,OAAOC,cAAmC,sBAAqB;AAE/D,SAASC,aAAa,EAAEC,UAAU,QAAQ,QAAO;AACjD,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,6BAA6B,QACxB,6BAAyB;AAChC,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D;;;;;;;CAOC,GACD,MAAMC,iBAAiB;IACrBC,MAAM,CAAC;IACPC,QAAQ;QAAEC,aAAa;IAAS;AAClC;AAuBA;;;;;CAKC,GACD,SAASC,aACPC,OAAgB,EAChBC,SAAkB;IAElB,IAAI,OAAOD,YAAY,UAAU,OAAOE;IACxC,yEAAyE;IACzE,wEAAwE;IACxE,IAAI,CAACC,OAAOC,SAAS,CAACC,cAAc,CA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