@aglyn/plugins-mui 1.0.0-beta.225 → 1.0.0-beta.227
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-mui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.227",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.227",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.227",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.227",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.227",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.227",
|
|
33
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.227",
|
|
34
34
|
"@swc/helpers": "0.5.23",
|
|
35
35
|
"mobx": "^7.0.5",
|
|
36
36
|
"mobx-react-lite": "^5.1.0"
|
|
@@ -16,6 +16,19 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import * as Aglyn from '@aglyn/aglyn';
|
|
18
18
|
import { type AppBarProps } from '@mui/material/AppBar';
|
|
19
|
+
export interface AglynAppBarProps extends AppBarProps {
|
|
20
|
+
/**
|
|
21
|
+
* Compacts the bar's Toolbar Content to the dense height once the page
|
|
22
|
+
* has scrolled, and back at the top. Meant for a pinned (sticky/fixed)
|
|
23
|
+
* bar, where the full height costs the reader a band of every screen.
|
|
24
|
+
*/
|
|
25
|
+
shrinkOnScroll?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Slides the bar up out of view while the visitor scrolls down, and back
|
|
28
|
+
* the moment they scroll up. Meant for a pinned (sticky/fixed) bar.
|
|
29
|
+
*/
|
|
30
|
+
hideOnScroll?: boolean;
|
|
31
|
+
}
|
|
19
32
|
/**
|
|
20
33
|
* MUI's AppBar behind the cleared-prop guard (AGL-1226).
|
|
21
34
|
*
|
|
@@ -25,8 +38,8 @@ import { type AppBarProps } from '@mui/material/AppBar';
|
|
|
25
38
|
* wrapper is the only place to intercept it, since the schema's props reach
|
|
26
39
|
* MUI directly. `createElement` rather than JSX keeps this a `.ts` file.
|
|
27
40
|
*/
|
|
28
|
-
declare const AppBar: import("react").ForwardRefExoticComponent<Omit<
|
|
41
|
+
declare const AppBar: import("react").ForwardRefExoticComponent<Omit<AglynAppBarProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
29
42
|
export declare const ID: Aglyn.ComponentId;
|
|
30
|
-
export declare const schema: Aglyn.ComponentSchema<
|
|
43
|
+
export declare const schema: Aglyn.ComponentSchema<AglynAppBarProps>;
|
|
31
44
|
export declare const presets: Aglyn.PresetSchema[];
|
|
32
45
|
export default AppBar;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
2
3
|
/**
|
|
3
4
|
* @license
|
|
4
5
|
* Copyright 2026 Aglyn LLC
|
|
@@ -16,6 +17,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
16
17
|
* limitations under the License.
|
|
17
18
|
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
18
19
|
import { mdiPageLayoutHeader } from "@aglyn/shared-data-mdi";
|
|
20
|
+
import { ScrollReaction } from "@aglyn/shared-ui-jsx/components/scroll-reaction";
|
|
19
21
|
import MuiAppBar from "@mui/material/AppBar";
|
|
20
22
|
import { createElement, forwardRef } from "react";
|
|
21
23
|
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
@@ -24,6 +26,72 @@ import { FIELD_COLOR_ALT1, FIELD_POSITION } from "../constants/field-presets.js"
|
|
|
24
26
|
import { dropClearedProps } from "../utils/drop-cleared-props.js";
|
|
25
27
|
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
26
28
|
import { ID as toolbarId } from "./toolbar.js";
|
|
29
|
+
/** Scroll distance before a shrinking bar compacts. */ const SHRINK_THRESHOLD = 16;
|
|
30
|
+
/** Scroll distance before a hiding bar may slide away — past its own height. */ const HIDE_THRESHOLD = 120;
|
|
31
|
+
/**
|
|
32
|
+
* Both scroll states ride data attributes, not a re-styled sx, so the
|
|
33
|
+
* server render and every scroll position share one emotion class.
|
|
34
|
+
*/ const scrollSx = (theme)=>({
|
|
35
|
+
transition: theme.transitions.create([
|
|
36
|
+
'transform',
|
|
37
|
+
'box-shadow'
|
|
38
|
+
], {
|
|
39
|
+
duration: theme.transitions.duration.shorter
|
|
40
|
+
}),
|
|
41
|
+
'& .MuiToolbar-root': {
|
|
42
|
+
transition: theme.transitions.create('min-height', {
|
|
43
|
+
duration: theme.transitions.duration.shorter
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
'&[data-scrolled] .MuiToolbar-root': {
|
|
47
|
+
// MUI's dense toolbar height.
|
|
48
|
+
minHeight: theme.spacing(6)
|
|
49
|
+
},
|
|
50
|
+
'&[data-scroll-hidden]': {
|
|
51
|
+
transform: 'translateY(-100%)'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
function withScrollSx(sx) {
|
|
55
|
+
return [
|
|
56
|
+
scrollSx,
|
|
57
|
+
...Array.isArray(sx) ? sx : [
|
|
58
|
+
sx
|
|
59
|
+
]
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function renderAppBar(props, ref) {
|
|
63
|
+
return createElement(MuiAppBar, _extends({}, applySemanticElement(dropClearedProps(props)), {
|
|
64
|
+
ref
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Its own component so the scroll listeners exist only on a bar that asked
|
|
69
|
+
* to react — a hook behind a prop check would break the rules of hooks.
|
|
70
|
+
* `ScrollReaction` answers both questions: past the threshold (shrink),
|
|
71
|
+
* and scrolling down rather than up (hide), which is what MUI's scroll
|
|
72
|
+
* trigger means by hysteresis.
|
|
73
|
+
*/ const ScrollAwareAppBar = forwardRef((_0, _1)=>{
|
|
74
|
+
let _ref = [
|
|
75
|
+
_0,
|
|
76
|
+
_1
|
|
77
|
+
], [_ref1, ..._rest] = _ref, { shrink, hide } = _ref1, props = _object_without_properties_loose(_ref1, [
|
|
78
|
+
"shrink",
|
|
79
|
+
"hide"
|
|
80
|
+
]), [ref] = _rest;
|
|
81
|
+
return createElement(ScrollReaction, {
|
|
82
|
+
threshold: SHRINK_THRESHOLD,
|
|
83
|
+
withHysteresis: {
|
|
84
|
+
threshold: HIDE_THRESHOLD
|
|
85
|
+
},
|
|
86
|
+
children: ({ activeWithHysteresis, activeWithoutHysteresis })=>renderAppBar(_extends({}, props, {
|
|
87
|
+
sx: withScrollSx(props.sx)
|
|
88
|
+
}, {
|
|
89
|
+
'data-scrolled': shrink && activeWithoutHysteresis ? '' : undefined,
|
|
90
|
+
'data-scroll-hidden': hide && activeWithHysteresis ? '' : undefined
|
|
91
|
+
}), ref)
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
ScrollAwareAppBar.displayName = 'AglynScrollAwareAppBar';
|
|
27
95
|
/**
|
|
28
96
|
* MUI's AppBar behind the cleared-prop guard (AGL-1226).
|
|
29
97
|
*
|
|
@@ -32,9 +100,20 @@ import { ID as toolbarId } from "./toolbar.js";
|
|
|
32
100
|
* either one persists a null that throws during SSR and 500s the page. A
|
|
33
101
|
* wrapper is the only place to intercept it, since the schema's props reach
|
|
34
102
|
* MUI directly. `createElement` rather than JSX keeps this a `.ts` file.
|
|
35
|
-
*/ const AppBar = forwardRef((
|
|
103
|
+
*/ const AppBar = forwardRef((_0, _1)=>{
|
|
104
|
+
let _ref = [
|
|
105
|
+
_0,
|
|
106
|
+
_1
|
|
107
|
+
], [_ref1, ..._rest] = _ref, { shrinkOnScroll, hideOnScroll } = _ref1, props = _object_without_properties_loose(_ref1, [
|
|
108
|
+
"shrinkOnScroll",
|
|
109
|
+
"hideOnScroll"
|
|
110
|
+
]), [ref] = _rest;
|
|
111
|
+
return shrinkOnScroll || hideOnScroll ? createElement(ScrollAwareAppBar, _extends({}, props, {
|
|
112
|
+
shrink: Boolean(shrinkOnScroll),
|
|
113
|
+
hide: Boolean(hideOnScroll),
|
|
36
114
|
ref
|
|
37
|
-
})));
|
|
115
|
+
})) : renderAppBar(props, ref);
|
|
116
|
+
});
|
|
38
117
|
AppBar.displayName = 'AglynAppBar';
|
|
39
118
|
// Component ids are persisted in screen documents; keep the legacy ids.
|
|
40
119
|
export const ID = 'muiAppBar';
|
|
@@ -54,7 +133,19 @@ export const schema = {
|
|
|
54
133
|
semanticElementAttribute('this bar'),
|
|
55
134
|
semanticElementLabelAttribute(),
|
|
56
135
|
FIELD_COLOR_ALT1,
|
|
57
|
-
FIELD_POSITION
|
|
136
|
+
FIELD_POSITION,
|
|
137
|
+
{
|
|
138
|
+
name: 'shrinkOnScroll',
|
|
139
|
+
description: 'Compacts the bar to the dense height once the page scrolls, and ' + 'restores it at the top. Pair with a Sticky or Fixed position.',
|
|
140
|
+
component: Aglyn.FieldComponentType.SWITCH,
|
|
141
|
+
label: 'Shrink when scrolled?'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'hideOnScroll',
|
|
145
|
+
description: 'Slides the bar up out of view while the visitor scrolls down, and ' + 'back as soon as they scroll up. Pair with a Sticky or Fixed position.',
|
|
146
|
+
component: Aglyn.FieldComponentType.SWITCH,
|
|
147
|
+
label: 'Hide while scrolling down?'
|
|
148
|
+
}
|
|
58
149
|
]
|
|
59
150
|
};
|
|
60
151
|
export const presets = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/app-bar.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 { mdiPageLayoutHeader } from '@aglyn/shared-data-mdi'\nimport MuiAppBar, { type AppBarProps } from '@mui/material/AppBar'\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 { FIELD_COLOR_ALT1, FIELD_POSITION } from '../constants/field-presets'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\nimport { ID as toolbarId } from './toolbar'\n\n/**\n * MUI's AppBar behind the cleared-prop guard (AGL-1226).\n *\n * It was exported raw, which left BOTH of its authorable attributes exposed:\n * `color` and `position` are each run through MUI's `capitalize`, so clearing\n * either one persists a null that throws during SSR and 500s the page. A\n * wrapper is the only place to intercept it, since the schema's props reach\n * MUI directly. `createElement` rather than JSX keeps this a `.ts` file.\n */\nconst AppBar = forwardRef<HTMLElement, AppBarProps>((props, ref) =>\n createElement(MuiAppBar, {\n // Unset leaves MUI's own default, which is `header` — the banner\n // landmark every site's chrome depends on (AGL-2525). A resolver that\n // answered `div` for \"unset\" would have stripped it the moment the\n // picker appeared.\n ...applySemanticElement(dropClearedProps(props) as Record<string, unknown>),\n ref,\n }),\n)\nAppBar.displayName = 'AglynAppBar'\n\n// Component ids are persisted in screen documents; keep the legacy ids.\nexport const ID: Aglyn.ComponentId = 'muiAppBar'\n\nexport const schema: Aglyn.ComponentSchema<AppBarProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'App Bar',\n description:\n 'The bar across the top of the site — put a Toolbar Content inside it.',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: {\n path: mdiPageLayoutHeader.path,\n sx: { color: '#2196f3' },\n },\n attributes: [\n semanticElementAttribute('this bar'),\n semanticElementLabelAttribute(),\n FIELD_COLOR_ALT1,\n FIELD_POSITION,\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'App Bar',\n pluginId: BUNDLE_ID,\n description: 'An app bar preset with the app bar and toolbar content nodes',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: schema.icon,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n nodes: [\n {\n $id: null,\n componentId: toolbarId,\n pluginId: BUNDLE_ID,\n props: {},\n },\n ],\n },\n },\n]\n\nexport default AppBar\n"],"names":["Aglyn","mdiPageLayoutHeader","MuiAppBar","createElement","forwardRef","BUNDLE_ID","applySemanticElement","semanticElementAttribute","semanticElementLabelAttribute","FIELD_COLOR_ALT1","FIELD_POSITION","dropClearedProps","generatePresetId","ID","toolbarId","AppBar","props","ref","displayName","schema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","path","sx","color","attributes","presets","type","NodeType","PRESET","data","componentId","nodes"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,mBAAmB,QAAQ,yBAAw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ources":["../../../../../../../libs/plugins/mui/src/lib/components/app-bar.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 { mdiPageLayoutHeader } from '@aglyn/shared-data-mdi'\nimport { ScrollReaction } from '@aglyn/shared-ui-jsx/components/scroll-reaction'\nimport MuiAppBar, { type AppBarProps } from '@mui/material/AppBar'\nimport { type SxProps, type Theme } from '@mui/material/styles'\nimport { createElement, forwardRef, type Ref } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport {\n applySemanticElement,\n semanticElementAttribute,\n semanticElementLabelAttribute,\n} from '../utils/element-picker'\nimport { FIELD_COLOR_ALT1, FIELD_POSITION } from '../constants/field-presets'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\nimport { ID as toolbarId } from './toolbar'\n\nexport interface AglynAppBarProps extends AppBarProps {\n /**\n * Compacts the bar's Toolbar Content to the dense height once the page\n * has scrolled, and back at the top. Meant for a pinned (sticky/fixed)\n * bar, where the full height costs the reader a band of every screen.\n */\n shrinkOnScroll?: boolean\n /**\n * Slides the bar up out of view while the visitor scrolls down, and back\n * the moment they scroll up. Meant for a pinned (sticky/fixed) bar.\n */\n hideOnScroll?: boolean\n}\n\n/** Scroll distance before a shrinking bar compacts. */\nconst SHRINK_THRESHOLD = 16\n/** Scroll distance before a hiding bar may slide away — past its own height. */\nconst HIDE_THRESHOLD = 120\n\n/**\n * Both scroll states ride data attributes, not a re-styled sx, so the\n * server render and every scroll position share one emotion class.\n */\nconst scrollSx: SxProps<Theme> = (theme) => ({\n transition: theme.transitions.create(['transform', 'box-shadow'], {\n duration: theme.transitions.duration.shorter,\n }),\n '& .MuiToolbar-root': {\n transition: theme.transitions.create('min-height', {\n duration: theme.transitions.duration.shorter,\n }),\n },\n '&[data-scrolled] .MuiToolbar-root': {\n // MUI's dense toolbar height.\n minHeight: theme.spacing(6),\n },\n '&[data-scroll-hidden]': {\n transform: 'translateY(-100%)',\n },\n})\n\nfunction withScrollSx(sx: AppBarProps['sx']): AppBarProps['sx'] {\n return [scrollSx, ...(Array.isArray(sx) ? sx : [sx])] as AppBarProps['sx']\n}\n\nfunction renderAppBar(props: AppBarProps, ref: Ref<HTMLElement>) {\n return createElement(MuiAppBar, {\n // Unset leaves MUI's own default, which is `header` — the banner\n // landmark every site's chrome depends on (AGL-2525). A resolver that\n // answered `div` for \"unset\" would have stripped it the moment the\n // picker appeared.\n ...applySemanticElement(dropClearedProps(props) as Record<string, unknown>),\n ref,\n })\n}\n\ninterface ScrollAwareAppBarProps extends AppBarProps {\n shrink: boolean\n hide: boolean\n}\n\n/**\n * Its own component so the scroll listeners exist only on a bar that asked\n * to react — a hook behind a prop check would break the rules of hooks.\n * `ScrollReaction` answers both questions: past the threshold (shrink),\n * and scrolling down rather than up (hide), which is what MUI's scroll\n * trigger means by hysteresis.\n */\nconst ScrollAwareAppBar = forwardRef<HTMLElement, ScrollAwareAppBarProps>(\n ({ shrink, hide, ...props }, ref) =>\n createElement(ScrollReaction, {\n threshold: SHRINK_THRESHOLD,\n withHysteresis: { threshold: HIDE_THRESHOLD },\n children: ({ activeWithHysteresis, activeWithoutHysteresis }) =>\n renderAppBar(\n {\n ...props,\n sx: withScrollSx(props.sx),\n ...({\n 'data-scrolled':\n shrink && activeWithoutHysteresis ? '' : undefined,\n 'data-scroll-hidden':\n hide && activeWithHysteresis ? '' : undefined,\n } as AppBarProps),\n },\n ref,\n ),\n }),\n)\nScrollAwareAppBar.displayName = 'AglynScrollAwareAppBar'\n\n/**\n * MUI's AppBar behind the cleared-prop guard (AGL-1226).\n *\n * It was exported raw, which left BOTH of its authorable attributes exposed:\n * `color` and `position` are each run through MUI's `capitalize`, so clearing\n * either one persists a null that throws during SSR and 500s the page. A\n * wrapper is the only place to intercept it, since the schema's props reach\n * MUI directly. `createElement` rather than JSX keeps this a `.ts` file.\n */\nconst AppBar = forwardRef<HTMLElement, AglynAppBarProps>(\n ({ shrinkOnScroll, hideOnScroll, ...props }, ref) =>\n shrinkOnScroll || hideOnScroll\n ? createElement(ScrollAwareAppBar, {\n ...props,\n shrink: Boolean(shrinkOnScroll),\n hide: Boolean(hideOnScroll),\n ref,\n })\n : renderAppBar(props, ref),\n)\nAppBar.displayName = 'AglynAppBar'\n\n// Component ids are persisted in screen documents; keep the legacy ids.\nexport const ID: Aglyn.ComponentId = 'muiAppBar'\n\nexport const schema: Aglyn.ComponentSchema<AglynAppBarProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'App Bar',\n description:\n 'The bar across the top of the site — put a Toolbar Content inside it.',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: {\n path: mdiPageLayoutHeader.path,\n sx: { color: '#2196f3' },\n },\n attributes: [\n semanticElementAttribute('this bar'),\n semanticElementLabelAttribute(),\n FIELD_COLOR_ALT1,\n FIELD_POSITION,\n {\n name: 'shrinkOnScroll',\n description:\n 'Compacts the bar to the dense height once the page scrolls, and ' +\n 'restores it at the top. Pair with a Sticky or Fixed position.',\n component: Aglyn.FieldComponentType.SWITCH,\n label: 'Shrink when scrolled?',\n },\n {\n name: 'hideOnScroll',\n description:\n 'Slides the bar up out of view while the visitor scrolls down, and ' +\n 'back as soon as they scroll up. Pair with a Sticky or Fixed position.',\n component: Aglyn.FieldComponentType.SWITCH,\n label: 'Hide while scrolling down?',\n },\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'App Bar',\n pluginId: BUNDLE_ID,\n description: 'An app bar preset with the app bar and toolbar content nodes',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: schema.icon,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n nodes: [\n {\n $id: null,\n componentId: toolbarId,\n pluginId: BUNDLE_ID,\n props: {},\n },\n ],\n },\n },\n]\n\nexport default AppBar\n"],"names":["Aglyn","mdiPageLayoutHeader","ScrollReaction","MuiAppBar","createElement","forwardRef","BUNDLE_ID","applySemanticElement","semanticElementAttribute","semanticElementLabelAttribute","FIELD_COLOR_ALT1","FIELD_POSITION","dropClearedProps","generatePresetId","ID","toolbarId","SHRINK_THRESHOLD","HIDE_THRESHOLD","scrollSx","theme","transition","transitions","create","duration","shorter","minHeight","spacing","transform","withScrollSx","sx","Array","isArray","renderAppBar","props","ref","ScrollAwareAppBar","shrink","hide","threshold","withHysteresis","children","activeWithHysteresis","activeWithoutHysteresis","undefined","displayName","AppBar","shrinkOnScroll","hideOnScroll","Boolean","schema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","path","color","attributes","name","component","FieldComponentType","SWITCH","label","presets","type","NodeType","PRESET","data","componentId","nodes"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,mBAAmB,QAAQ,yBAAwB;AAC5D,SAASC,cAAc,QAAQ,kDAAiD;AAChF,OAAOC,eAAqC,uBAAsB;AAElE,SAASC,aAAa,EAAEC,UAAU,QAAkB,QAAO;AAC3D,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SACEC,oBAAoB,EACpBC,wBAAwB,EACxBC,6BAA6B,QACxB,6BAAyB;AAChC,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,gCAA4B;AAC7E,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SAASC,MAAMC,SAAS,QAAQ,eAAW;AAgB3C,qDAAqD,GACrD,MAAMC,mB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