@aglyn/plugins-mui 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/src/lib/components/app-bar.js +7 -6
- package/src/lib/components/app-bar.js.map +1 -1
- package/src/lib/components/data-table.js +43 -11
- package/src/lib/components/data-table.js.map +1 -1
- package/src/lib/components/plugin-install-presets.d.ts +17 -0
- package/src/lib/components/plugin-install-presets.js +19 -1
- package/src/lib/components/plugin-install-presets.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-mui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
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.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
32
|
-
"@aglyn/shared-ui-theme": "1.
|
|
33
|
-
"@aglyn/shared-util-vendor": "1.
|
|
28
|
+
"@aglyn/aglyn": "1.16.0",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.16.0",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.16.0",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.16.0",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.16.0",
|
|
33
|
+
"@aglyn/shared-util-vendor": "1.16.0",
|
|
34
34
|
"@swc/helpers": "0.5.23",
|
|
35
35
|
"dayjs": "^1.11.23",
|
|
36
36
|
"mobx": "^7.0.5",
|
|
@@ -42,11 +42,12 @@ export const OVER_HERO_SOLID_ATTRIBUTE = 'data-over-hero-solid';
|
|
|
42
42
|
*/ export const overHeroSx = (theme)=>({
|
|
43
43
|
[`body:has([${UNDER_HEADER_ATTRIBUTE}]) &`]: {
|
|
44
44
|
position: 'absolute',
|
|
45
|
-
// Below the owner's admin bar
|
|
46
|
-
// are up (each publishes its
|
|
47
|
-
// otherwise. Absolute to the initial containing
|
|
48
|
-
// moves this header — the variables are what do
|
|
49
|
-
|
|
45
|
+
// Below the owner's admin bar, the team's preview bar and the site's
|
|
46
|
+
// announcement bar when they are up (each publishes its height on
|
|
47
|
+
// `<html>`), at the very top otherwise. Absolute to the initial containing
|
|
48
|
+
// block, nothing in flow moves this header — the variables are what do
|
|
49
|
+
// (AGL-3660, AGL-4176, AGL-4152).
|
|
50
|
+
top: 'calc(var(--aglyn-admin-bar-height, 0px) + var(--aglyn-preview-bar-height, 0px) + var(--aglyn-announcement-bar-height, 0px))',
|
|
50
51
|
left: 0,
|
|
51
52
|
right: 0,
|
|
52
53
|
transition: theme.transitions.create([
|
|
@@ -73,7 +74,7 @@ export const OVER_HERO_SOLID_ATTRIBUTE = 'data-over-hero-solid';
|
|
|
73
74
|
// nothing jumps.
|
|
74
75
|
[`body:has([${UNDER_HEADER_ATTRIBUTE}]) &[${OVER_HERO_PINNED_ATTRIBUTE}][${OVER_HERO_SOLID_ATTRIBUTE}]`]: {
|
|
75
76
|
position: 'fixed',
|
|
76
|
-
top: 'var(--aglyn-admin-bar-height, 0px)'
|
|
77
|
+
top: 'calc(var(--aglyn-admin-bar-height, 0px) + var(--aglyn-preview-bar-height, 0px))'
|
|
77
78
|
}
|
|
78
79
|
});
|
|
79
80
|
function withOverHeroSx(sx) {
|
|
@@ -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 { 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, useEffect, useState, 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 { UNDER_HEADER_ATTRIBUTE } from './section'\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 * Sits over a photo hero (AGL-3660): on a page whose first band runs under\n * the header (a Section with `underHeader`), the bar lies over that band\n * with no background of its own and its words in white. A Sticky or Fixed\n * bar stays pinned and turns back into its own solid self once the page\n * has scrolled (`OVER_HERO_SOLID_ATTRIBUTE`); any other bar scrolls away\n * with the band. On every other page it is the bar it always was.\n */\n overHero?: boolean\n}\n\n/**\n * Set on an over-hero bar that is pinned (Sticky or Fixed), and on one that\n * has scrolled past the top and turned solid. A logo that swaps to a white\n * version over the photo reads the second one to swap back:\n * `body:has([data-aglyn-under-header]) header:not([data-over-hero-solid]) &`.\n */\nexport const OVER_HERO_PINNED_ATTRIBUTE = 'data-over-hero-pinned'\nexport const OVER_HERO_SOLID_ATTRIBUTE = 'data-over-hero-solid'\n\n/**\n * Over a page that opens under the header, the bar lies on the photo. One\n * rule the browser applies by what the page holds, so the server render, the\n * published page and every page of a layout share one class, and a page\n * without such a band is untouched.\n */\nexport const overHeroSx = (theme: Theme) => ({\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &`]: {\n position: 'absolute',\n // Below the owner's admin bar and the site's announcement bar when they\n // are up (each publishes its live height on `<html>`), at the very top\n // otherwise. Absolute to the initial containing block, nothing in flow\n // moves this header — the variables are what do (AGL-3660, AGL-4176).\n top: 'calc(var(--aglyn-admin-bar-height, 0px) + var(--aglyn-announcement-bar-height, 0px))',\n left: 0,\n right: 0,\n transition: theme.transitions.create(\n ['background-color', 'color', 'box-shadow', 'border-color'],\n { duration: theme.transitions.duration.shorter },\n ),\n },\n // Clear over the photo until a pinned bar turns solid.\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &:not([${OVER_HERO_SOLID_ATTRIBUTE}])`]: {\n backgroundColor: 'transparent',\n backgroundImage: 'none',\n boxShadow: 'none',\n borderBottomColor: 'transparent',\n color: theme.palette.common.white,\n },\n // A Sticky or Fixed bar, once the announcement bar has scrolled away,\n // pins to the top as the bar it is on every other page: its own\n // background, colors and border, which the rule above no longer clears.\n // The switch happens exactly where the absolute bar reaches the top, so\n // nothing jumps.\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &[${OVER_HERO_PINNED_ATTRIBUTE}][${OVER_HERO_SOLID_ATTRIBUTE}]`]: {\n position: 'fixed',\n top: 'var(--aglyn-admin-bar-height, 0px)',\n },\n})\n\nfunction withOverHeroSx(sx: AppBarProps['sx']): AppBarProps['sx'] {\n return [overHeroSx, ...(Array.isArray(sx) ? sx : [sx])] as AppBarProps['sx']\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 */\n/**\n * Has the page scrolled past where a pinned over-hero bar should turn solid?\n * That is the announcement bar's height: until it has gone, the bar is still\n * lying on the photo below it. Listens only for a bar that asked to be pinned\n * over a hero; SSR and the first paint read \"not yet\".\n */\nexport function useOverHeroSolid(enabled: boolean): boolean {\n const [solid, setSolid] = useState(false)\n useEffect(() => {\n if (!enabled || typeof window === 'undefined') return undefined\n let frame = 0\n let pending = false\n const read = () => {\n pending = false\n const announcement =\n parseFloat(\n getComputedStyle(document.documentElement).getPropertyValue(\n '--aglyn-announcement-bar-height',\n ),\n ) || 0\n setSolid(window.scrollY > announcement)\n }\n const schedule = () => {\n if (pending) return\n pending = true\n frame = window.requestAnimationFrame(read)\n }\n read()\n window.addEventListener('scroll', schedule, { passive: true })\n window.addEventListener('resize', schedule)\n return () => {\n window.removeEventListener('scroll', schedule)\n window.removeEventListener('resize', schedule)\n if (pending) window.cancelAnimationFrame(frame)\n }\n }, [enabled])\n return enabled && solid\n}\n\nconst AppBar = forwardRef<HTMLElement, AglynAppBarProps>(\n ({ shrinkOnScroll, hideOnScroll, overHero, ...rest }, ref) => {\n // Over a hero, Sticky and Fixed used to be silently ignored: the bar was\n // made absolute and scrolled away with the photo (AGL-4200).\n const pinned =\n Boolean(overHero) &&\n (rest.position === 'sticky' || rest.position === 'fixed')\n const solid = useOverHeroSolid(pinned)\n const props = overHero\n ? ({\n ...rest,\n sx: withOverHeroSx(rest.sx),\n ...(pinned ? { [OVER_HERO_PINNED_ATTRIBUTE]: '' } : {}),\n ...(solid ? { [OVER_HERO_SOLID_ATTRIBUTE]: '' } : {}),\n } as AppBarProps)\n : rest\n return shrinkOnScroll || hideOnScroll\n ? createElement(ScrollAwareAppBar, {\n ...props,\n shrink: Boolean(shrinkOnScroll),\n hide: Boolean(hideOnScroll),\n ref,\n })\n : renderAppBar(props, 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<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 name: 'overHero',\n description:\n 'On a page whose first band is set to run under the header, the bar ' +\n 'sits over that photo with no background and white words. A Sticky ' +\n 'or Fixed bar stays at the top and turns solid once the page ' +\n 'scrolls. Other pages keep the bar as it is.',\n component: Aglyn.FieldComponentType.SWITCH,\n label: 'Sit over a photo hero?',\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","useEffect","useState","BUNDLE_ID","applySemanticElement","semanticElementAttribute","semanticElementLabelAttribute","FIELD_COLOR_ALT1","FIELD_POSITION","dropClearedProps","generatePresetId","UNDER_HEADER_ATTRIBUTE","ID","toolbarId","OVER_HERO_PINNED_ATTRIBUTE","OVER_HERO_SOLID_ATTRIBUTE","overHeroSx","theme","position","top","left","right","transition","transitions","create","duration","shorter","backgroundColor","backgroundImage","boxShadow","borderBottomColor","color","palette","common","white","withOverHeroSx","sx","Array","isArray","SHRINK_THRESHOLD","HIDE_THRESHOLD","scrollSx","minHeight","spacing","transform","withScrollSx","renderAppBar","props","ref","ScrollAwareAppBar","shrink","hide","threshold","withHysteresis","children","activeWithHysteresis","activeWithoutHysteresis","undefined","displayName","useOverHeroSolid","enabled","solid","setSolid","window","frame","pending","read","announcement","parseFloat","getComputedStyle","document","documentElement","getPropertyValue","scrollY","schedule","requestAnimationFrame","addEventListener","passive","removeEventListener","cancelAnimationFrame","AppBar","shrinkOnScroll","hideOnScroll","overHero","rest","pinned","Boolean","schema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","path","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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aAAa9F;oBACb4E,UAAUtF;oBACV4C,OAAO,CAAC;gBACV;aACD;QACH;IACF;CACD,CAAA;AAED,eAAeiC,OAAM"}
|
|
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 { 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, useEffect, useState, 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 { UNDER_HEADER_ATTRIBUTE } from './section'\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 * Sits over a photo hero (AGL-3660): on a page whose first band runs under\n * the header (a Section with `underHeader`), the bar lies over that band\n * with no background of its own and its words in white. A Sticky or Fixed\n * bar stays pinned and turns back into its own solid self once the page\n * has scrolled (`OVER_HERO_SOLID_ATTRIBUTE`); any other bar scrolls away\n * with the band. On every other page it is the bar it always was.\n */\n overHero?: boolean\n}\n\n/**\n * Set on an over-hero bar that is pinned (Sticky or Fixed), and on one that\n * has scrolled past the top and turned solid. A logo that swaps to a white\n * version over the photo reads the second one to swap back:\n * `body:has([data-aglyn-under-header]) header:not([data-over-hero-solid]) &`.\n */\nexport const OVER_HERO_PINNED_ATTRIBUTE = 'data-over-hero-pinned'\nexport const OVER_HERO_SOLID_ATTRIBUTE = 'data-over-hero-solid'\n\n/**\n * Over a page that opens under the header, the bar lies on the photo. One\n * rule the browser applies by what the page holds, so the server render, the\n * published page and every page of a layout share one class, and a page\n * without such a band is untouched.\n */\nexport const overHeroSx = (theme: Theme) => ({\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &`]: {\n position: 'absolute',\n // Below the owner's admin bar, the team's preview bar and the site's\n // announcement bar when they are up (each publishes its height on\n // `<html>`), at the very top otherwise. Absolute to the initial containing\n // block, nothing in flow moves this header — the variables are what do\n // (AGL-3660, AGL-4176, AGL-4152).\n top: 'calc(var(--aglyn-admin-bar-height, 0px) + var(--aglyn-preview-bar-height, 0px) + var(--aglyn-announcement-bar-height, 0px))',\n left: 0,\n right: 0,\n transition: theme.transitions.create(\n ['background-color', 'color', 'box-shadow', 'border-color'],\n { duration: theme.transitions.duration.shorter },\n ),\n },\n // Clear over the photo until a pinned bar turns solid.\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &:not([${OVER_HERO_SOLID_ATTRIBUTE}])`]: {\n backgroundColor: 'transparent',\n backgroundImage: 'none',\n boxShadow: 'none',\n borderBottomColor: 'transparent',\n color: theme.palette.common.white,\n },\n // A Sticky or Fixed bar, once the announcement bar has scrolled away,\n // pins to the top as the bar it is on every other page: its own\n // background, colors and border, which the rule above no longer clears.\n // The switch happens exactly where the absolute bar reaches the top, so\n // nothing jumps.\n [`body:has([${UNDER_HEADER_ATTRIBUTE}]) &[${OVER_HERO_PINNED_ATTRIBUTE}][${OVER_HERO_SOLID_ATTRIBUTE}]`]: {\n position: 'fixed',\n top: 'calc(var(--aglyn-admin-bar-height, 0px) + var(--aglyn-preview-bar-height, 0px))',\n },\n})\n\nfunction withOverHeroSx(sx: AppBarProps['sx']): AppBarProps['sx'] {\n return [overHeroSx, ...(Array.isArray(sx) ? sx : [sx])] as AppBarProps['sx']\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 */\n/**\n * Has the page scrolled past where a pinned over-hero bar should turn solid?\n * That is the announcement bar's height: until it has gone, the bar is still\n * lying on the photo below it. Listens only for a bar that asked to be pinned\n * over a hero; SSR and the first paint read \"not yet\".\n */\nexport function useOverHeroSolid(enabled: boolean): boolean {\n const [solid, setSolid] = useState(false)\n useEffect(() => {\n if (!enabled || typeof window === 'undefined') return undefined\n let frame = 0\n let pending = false\n const read = () => {\n pending = false\n const announcement =\n parseFloat(\n getComputedStyle(document.documentElement).getPropertyValue(\n '--aglyn-announcement-bar-height',\n ),\n ) || 0\n setSolid(window.scrollY > announcement)\n }\n const schedule = () => {\n if (pending) return\n pending = true\n frame = window.requestAnimationFrame(read)\n }\n read()\n window.addEventListener('scroll', schedule, { passive: true })\n window.addEventListener('resize', schedule)\n return () => {\n window.removeEventListener('scroll', schedule)\n window.removeEventListener('resize', schedule)\n if (pending) window.cancelAnimationFrame(frame)\n }\n }, [enabled])\n return enabled && solid\n}\n\nconst AppBar = forwardRef<HTMLElement, AglynAppBarProps>(\n ({ shrinkOnScroll, hideOnScroll, overHero, ...rest }, ref) => {\n // Over a hero, Sticky and Fixed used to be silently ignored: the bar was\n // made absolute and scrolled away with the photo (AGL-4200).\n const pinned =\n Boolean(overHero) &&\n (rest.position === 'sticky' || rest.position === 'fixed')\n const solid = useOverHeroSolid(pinned)\n const props = overHero\n ? ({\n ...rest,\n sx: withOverHeroSx(rest.sx),\n ...(pinned ? { [OVER_HERO_PINNED_ATTRIBUTE]: '' } : {}),\n ...(solid ? { [OVER_HERO_SOLID_ATTRIBUTE]: '' } : {}),\n } as AppBarProps)\n : rest\n return shrinkOnScroll || hideOnScroll\n ? createElement(ScrollAwareAppBar, {\n ...props,\n shrink: Boolean(shrinkOnScroll),\n hide: Boolean(hideOnScroll),\n ref,\n })\n : renderAppBar(props, 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<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 name: 'overHero',\n description:\n 'On a page whose first band is set to run under the header, the bar ' +\n 'sits over that photo with no background and white words. A Sticky ' +\n 'or Fixed bar stays at the top and turns solid once the page ' +\n 'scrolls. Other pages keep the bar as it is.',\n component: Aglyn.FieldComponentType.SWITCH,\n label: 'Sit over a photo hero?',\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","useEffect","useState","BUNDLE_ID","applySemanticElement","semanticElementAttribute","semanticElementLabelAttribute","FIELD_COLOR_ALT1","FIELD_POSITION","dropClearedProps","generatePresetId","UNDER_HEADER_ATTRIBUTE","ID","toolbarId","OVER_HERO_PINNED_ATTRIBUTE","OVER_HERO_SOLID_ATTRIBUTE","overHeroSx","theme","position","top","left","right","transition","transitions","create","duration","shorter","backgroundColor","backgroundImage","boxShadow","borderBottomColor","color","palette","common","white","withOverHeroSx","sx","Array","isArray","SHRINK_THRESHOLD","HIDE_THRESHOLD","scrollSx","minHeight","spacing","transform","withScrollSx","renderAppBar","props","ref","ScrollAwareAppBar","shrink","hide","threshold","withHysteresis","children","activeWithHysteresis","activeWithoutHysteresis","undefined","displayName","useOverHeroSolid","enabled","solid","setSolid","window","frame","pending","read","announcement","parseFloat","getComputedStyle","document","documentElement","getPropertyValue","scrollY","schedule","requestAnimationFrame","addEventListener","passive","removeEventListener","cancelAnimationFrame","AppBar","shrinkOnScroll","hideOnScroll","overHero","rest","pinned","Boolean","schema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","path","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,EAAEC,SAAS,EAAEC,QAAQ,QAAkB,QAAO;AAChF,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,sBAAsB,QAAQ,eAAW;AAClD,SAASC,MAAMC,SAAS,QAAQ,eAAW;AAyB3C;;;;;CAKC,GACD,OAAO,MAAMC,6BAA6B,wBAAuB;AACjE,OAAO,MAAMC,4BAA4B,uBAAsB;AAE/D;;;;;CAKC,GACD,OAAO,MAAMC,aAAa,CAACC,QAAkB,CAAA;QAC3C,CAAC,CAAC,UAAU,EAAEN,uBAAuB,IAAI,CAAC,CAAC,EAAE;YAC3CO,UAAU;YACV,qEAAqE;YACrE,kEAAkE;YAClE,2EAA2E;YAC3E,uEAAuE;YACvE,kCAAkC;YAClCC,KAAK;YACLC,MAAM;YACNC,OAAO;YACPC,YAAYL,MAAMM,WAAW,CAACC,MAAM,CAClC;gBAAC;gBAAoB;gBAAS;gBAAc;aAAe,EAC3D;gBAAEC,UAAUR,MAAMM,WAAW,CAACE,QAAQ,CAACC,OA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AkB,CAACC,MAAM;YAC1CC,OAAO;QACT;KACD;AACH,EAAC;AAED,OAAO,MAAMC,UAAgC;IAC3C;QACEd,KAAK9E,iBAAiBE;QACtB2F,MAAM5G,MAAM6G,QAAQ,CAACC,MAAM;QAC3B/C,aAAa;QACb+B,UAAUtF;QACVuF,aAAa;QACbC,UAAUhG,MAAMiG,iBAAiB,CAACC,UAAU;QAC5CC,MAAMP,OAAOO,IAAI;QACjBY,MAAM;YACJlB,KAAK;YACLmB,aAAa/F;YACb6E,UAAUtF;YACVyG,OAAO;gBACL;oBACEpB,KAAK;oBACLmB,aAAa9F;oBACb4E,UAAUtF;oBACV4C,OAAO,CAAC;gBACV;aACD;QACH;IACF;CACD,CAAA;AAED,eAAeiC,OAAM"}
|
|
@@ -17,7 +17,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
17
17
|
* See the License for the specific language governing permissions and
|
|
18
18
|
* limitations under the License.
|
|
19
19
|
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
20
|
-
import { normalizeEmphasisColumn, parseDataTableRows, readDataTableAlignments } from "@aglyn/shared-data-enums";
|
|
20
|
+
import { DATA_TABLE_EMPHASIS_PROP, isDataTableCellMarkup, normalizeEmphasisColumn, parseDataTableRows, readDataTableAlignments } from "@aglyn/shared-data-enums";
|
|
21
21
|
import { mdiTable } from "@aglyn/shared-data-mdi";
|
|
22
22
|
import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
|
|
23
23
|
import { scrollRegionProps, scrollableTableSx } from "@aglyn/shared-ui-jsx/utils/scroll-overflow";
|
|
@@ -39,6 +39,38 @@ const TABLE_ICON = {
|
|
|
39
39
|
color: '#0288d1'
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* What a formatted cell may draw (AGL-4203): the inline elements a label
|
|
44
|
+
* may, plus links — a table cell is not a control, so an anchor inside it is
|
|
45
|
+
* valid, and "see the docs" is a thing comparison tables say.
|
|
46
|
+
*
|
|
47
|
+
* Built on first use rather than at module load, so importing this file never
|
|
48
|
+
* depends on `@aglyn/aglyn` having finished evaluating.
|
|
49
|
+
*/ let cellElements;
|
|
50
|
+
function tableCellElements() {
|
|
51
|
+
cellElements != null ? cellElements : cellElements = new Set([
|
|
52
|
+
...Aglyn.INLINE_AUTHOR_HTML_ELEMENTS,
|
|
53
|
+
'a'
|
|
54
|
+
]);
|
|
55
|
+
return cellElements;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A cell's content as TableCell props: its text, or — for a cell formatted
|
|
59
|
+
* on the canvas — its markup, re-sanitized on every render by the same pure
|
|
60
|
+
* sanitizer Typography uses, so the server and the browser draw the same
|
|
61
|
+
* bytes and a value written straight to the document cannot plant script.
|
|
62
|
+
*/ function cellContent(cell) {
|
|
63
|
+
if (!isDataTableCellMarkup(cell)) return {
|
|
64
|
+
children: cell
|
|
65
|
+
};
|
|
66
|
+
return {
|
|
67
|
+
dangerouslySetInnerHTML: {
|
|
68
|
+
__html: Aglyn.sanitizeAuthorHtml(cell, undefined, {
|
|
69
|
+
allowedElements: tableCellElements()
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
42
74
|
/**
|
|
43
75
|
* A comparison table (AGL-2543).
|
|
44
76
|
*
|
|
@@ -99,7 +131,7 @@ const TABLE_ICON = {
|
|
|
99
131
|
},
|
|
100
132
|
...nodeSx
|
|
101
133
|
],
|
|
102
|
-
children: 'Table —
|
|
134
|
+
children: 'Table — right-click it to start a table'
|
|
103
135
|
}));
|
|
104
136
|
}
|
|
105
137
|
const [first, ...body] = grid;
|
|
@@ -128,22 +160,20 @@ const TABLE_ICON = {
|
|
|
128
160
|
children: [
|
|
129
161
|
headerRow ? /*#__PURE__*/ _jsx(TableHead, {
|
|
130
162
|
children: /*#__PURE__*/ _jsx(TableRow, {
|
|
131
|
-
children: first.map((cell, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
163
|
+
children: first.map((cell, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, _extends({
|
|
132
164
|
align: alignments[columnIndex],
|
|
133
165
|
sx: _extends({
|
|
134
166
|
fontWeight: 700
|
|
135
|
-
}, cellSx(columnIndex))
|
|
136
|
-
|
|
137
|
-
}, columnIndex))
|
|
167
|
+
}, cellSx(columnIndex))
|
|
168
|
+
}, cellContent(cell)), columnIndex))
|
|
138
169
|
})
|
|
139
170
|
}) : null,
|
|
140
171
|
/*#__PURE__*/ _jsx(TableBody, {
|
|
141
172
|
children: dataRows.map((row, rowIndex)=>/*#__PURE__*/ _jsx(TableRow, {
|
|
142
|
-
children: row.map((cell, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
173
|
+
children: row.map((cell, columnIndex)=>/*#__PURE__*/ _jsx(TableCell, _extends({
|
|
143
174
|
align: alignments[columnIndex],
|
|
144
|
-
sx: cellSx(columnIndex)
|
|
145
|
-
|
|
146
|
-
}, columnIndex))
|
|
175
|
+
sx: cellSx(columnIndex)
|
|
176
|
+
}, cellContent(cell)), columnIndex))
|
|
147
177
|
}, rowIndex))
|
|
148
178
|
})
|
|
149
179
|
]
|
|
@@ -175,7 +205,9 @@ export const dataTableSchema = {
|
|
|
175
205
|
label: 'First row is a header'
|
|
176
206
|
},
|
|
177
207
|
{
|
|
178
|
-
|
|
208
|
+
// `DATA_TABLE_EMPHASIS_PROP`: a canvas column edit moves it with its
|
|
209
|
+
// column (AGL-4203), so the name is shared rather than repeated.
|
|
210
|
+
name: DATA_TABLE_EMPHASIS_PROP,
|
|
179
211
|
description: 'Highlight one column — on a comparison table, usually your own. 0 for none.',
|
|
180
212
|
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
181
213
|
label: 'Emphasize column'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/data-table.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 {\n normalizeEmphasisColumn,\n parseDataTableRows,\n readDataTableAlignments,\n} from '@aglyn/shared-data-enums'\nimport { mdiTable } from '@aglyn/shared-data-mdi'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport {\n scrollRegionProps,\n scrollableTableSx,\n} from '@aglyn/shared-ui-jsx/utils/scroll-overflow'\nimport Box from '@mui/material/Box'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\nimport { forwardRef, useContext } 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 DATA_TABLE_ID: Aglyn.ComponentId = 'dataTable'\n\n/** What a screen reader announces on reaching the grid's scroll box. */\nconst TABLE_REGION_LABEL = 'Table'\n\n// The component and its preset show the same drawer glyph.\nconst TABLE_ICON = { path: mdiTable.path, sx: { color: '#0288d1' } }\n\nexport interface DataTableProps {\n /**\n * The grid, pipe-delimited, one row per line — and its column alignment,\n * as a markdown divider row. See `@aglyn/shared-data-enums`'s `data-table` utilities.\n */\n rows?: string\n /** Render the first row as a header. */\n headerRow?: boolean\n /** 1-based column to emphasise, or 0/absent for none. */\n emphasizeColumn?: number | string\n}\n\n/**\n * A comparison table (AGL-2543).\n *\n * The feature matrix is the load-bearing block on a competitor comparison\n * page, and the palette had no way to build one: searching `table` returned\n * **Table of Contents** and **Pricing Table**, neither of which is a general\n * grid. The only route was to author markdown pipe syntax inside a Markdown\n * element — which renders correctly and is exactly the audience the besigner\n * exists to spare.\n *\n * Three things the Markdown route could not give, and the reason this is an\n * element rather than a docs note:\n *\n * - **Header emphasis**, without asking an author to remember that the first\n * row is special.\n * - **A highlighted column** — the \"ours\" column on a comparison page is the\n * entire point of the block, and markdown has no way to say it.\n * - **A grid to edit**, rather than pipe syntax in a text box — see the\n * `DATA_TABLE` field this element's `rows` attribute asks for.\n *\n * Narrow-screen behaviour is NOT one of them (AGL-2568). Both routes draw the\n * same block, so both take the same treatment from `scroll-overflow`: the\n * grid scrolls inside its own box once it is too wide to read, and says so.\n */\nconst DataTable = forwardRef<HTMLDivElement, DataTableProps>((props, ref) => {\n const { rows, headerRow = true, emphasizeColumn, ...rest } = props\n // Node styles ride the renderer-merged sx; recompose (stack.ts pattern).\n const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [props['sx']]\n const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext)\n const grid = parseDataTableRows(rows)\n const width = grid[0]?.length ?? 0\n const alignments = readDataTableAlignments(rows, width)\n const emphasis = normalizeEmphasisColumn(emphasizeColumn, width)\n\n if (grid.length === 0) {\n // The hint is for the author, so only editing surfaces draw it; a\n // published page renders the bare element.\n if (!suppressNavigation) return <Box ref={ref} {...rest} />\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n padding: 2,\n border: '1px dashed',\n borderColor: 'divider',\n color: 'text.secondary',\n fontSize: 12,\n fontFamily: 'system-ui, sans-serif',\n },\n ...nodeSx,\n ]}\n >\n {'Table — add rows in Attributes'}\n </Box>\n )\n }\n\n const [first, ...body] = grid\n const dataRows = headerRow ? body : grid\n // An emphasised column reads as emphasised in BOTH halves of the table: a\n // header cell that is bold anyway would otherwise show no highlight at all,\n // which is the one row an author looks at first.\n const cellSx = (columnIndex: number) =>\n emphasis === columnIndex + 1\n ? { backgroundColor: 'action.hover', fontWeight: 600 }\n : undefined\n\n return (\n <ScrollTable\n ref={ref}\n size=\"small\"\n // The box scrolls the grid, and the grid is sized so that it can\n // (AGL-2568). The box's `overflow-x` is half of it: it does nothing at\n // all while the table inside is `width: 100%`, because a table of prose\n // cells that cannot exceed its box never overflows it — it crushes its\n // columns instead. `max-content` is the other half, and the box's fade\n // is what makes an overlay-scrollbar platform admit that it scrolled.\n sx={scrollableTableSx}\n ContainerProps={{\n ...rest,\n ...scrollRegionProps(TABLE_REGION_LABEL),\n // The node's styles merge after the box's own, never instead of them.\n sx: nodeSx,\n }}\n >\n {headerRow ? (\n <TableHead>\n <TableRow>\n {first.map((cell, columnIndex) => (\n <TableCell\n key={columnIndex}\n align={alignments[columnIndex]}\n sx={{ fontWeight: 700, ...cellSx(columnIndex) }}\n >\n {cell}\n </TableCell>\n ))}\n </TableRow>\n </TableHead>\n ) : null}\n <TableBody>\n {dataRows.map((row, rowIndex) => (\n <TableRow key={rowIndex}>\n {row.map((cell, columnIndex) => (\n <TableCell\n key={columnIndex}\n align={alignments[columnIndex]}\n sx={cellSx(columnIndex)}\n >\n {cell}\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableBody>\n </ScrollTable>\n )\n})\nDataTable.displayName = 'AglynDataTable'\n\nexport default DataTable\n\nexport const dataTableSchema: Aglyn.ComponentSchema<DataTableProps> = {\n $id: DATA_TABLE_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Table',\n description:\n 'A grid of rows and columns — a feature matrix, a spec sheet, a comparison.',\n category: Aglyn.ComponentCategory.BLOCKS,\n icon: TABLE_ICON,\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'rows',\n description:\n 'The table contents. Paste a markdown table to import one you already have.',\n component: Aglyn.FieldComponentType.DATA_TABLE,\n label: 'Rows',\n },\n {\n name: 'headerRow',\n description: 'Render the first row as a header.',\n component: Aglyn.FieldComponentType.CHECKBOX,\n label: 'First row is a header',\n },\n {\n name: 'emphasizeColumn',\n description:\n 'Highlight one column — on a comparison table, usually your own. 0 for none.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n label: 'Emphasize column',\n },\n ],\n}\n\nexport const dataTablePresets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(DATA_TABLE_ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Table',\n pluginId: BUNDLE_ID,\n description: 'Comparison grid with a header row',\n category: Aglyn.ComponentCategory.BLOCKS,\n icon: TABLE_ICON,\n data: {\n $id: null,\n componentId: DATA_TABLE_ID,\n pluginId: BUNDLE_ID,\n props: {\n headerRow: true,\n emphasizeColumn: 2,\n rows: [\n 'Feature | Us | Them',\n '--- | :---: | :---:',\n 'Open source | Yes | No',\n 'Self-hostable | Yes | No',\n 'One platform | Yes | No',\n ].join('\\n'),\n },\n },\n },\n]\n"],"names":["Aglyn","normalizeEmphasisColumn","parseDataTableRows","readDataTableAlignments","mdiTable","ScrollTable","scrollRegionProps","scrollableTableSx","Box","TableBody","TableCell","TableHead","TableRow","forwardRef","useContext","BUNDLE_ID","generatePresetId","DATA_TABLE_ID","TABLE_REGION_LABEL","TABLE_ICON","path","sx","color","DataTable","props","ref","grid","rows","headerRow","emphasizeColumn","rest","nodeSx","Array","isArray","suppressNavigation","ScreenLinkContext","width","length","alignments","emphasis","padding","border","borderColor","fontSize","fontFamily","first","body","dataRows","cellSx","columnIndex","backgroundColor","fontWeight","undefined","size","ContainerProps","map","cell","align","row","rowIndex","displayName","dataTableSchema","$id","pluginId","description","category","ComponentCategory","BLOCKS","icon","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","component","FieldComponentType","DATA_TABLE","label","CHECKBOX","TEXT_FIELD","dataTablePresets","type","NodeType","PRESET","data","componentId","join"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,uBAAuB,EACvBC,kBAAkB,EAClBC,uBAAuB,QAClB,2BAA0B;AACjC,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,WAAW,QAAQ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,aAAatE,MAAMuE,YAAY,CAACC,OAAO;IAAC;IACjDC,YAAY;QACV;YACEC,MAAM;YACNV,aACE;YACFW,WAAW3E,MAAM4E,kBAAkB,CAACC,UAAU;YAC9CC,OAAO;QACT;QACA;YACEJ,MAAM;YACNV,aAAa;YACbW,WAAW3E,MAAM4E,kBAAkB,CAACG,QAAQ;YAC5CD,OAAO;QACT;QACA;YACEJ,MAAM;YACNV,aACE;YACFW,WAAW3E,MAAM4E,kBAAkB,CAACI,UAAU;YAC9CF,OAAO;QACT;KACD;AACH,EAAC;AAED,OAAO,MAAMG,mBAAyC;IACpD;QACEnB,KAAK9C,iBAAiBC;QACtBiE,MAAMlF,MAAMmF,QAAQ,CAACC,MAAM;QAC3BxB,aAAa;QACbG,UAAUhD;QACViD,aAAa;QACbC,UAAUjE,MAAMkE,iBAAiB,CAACC,MAAM;QACxCC,MAAMjD;QACNkE,MAAM;YACJvB,KAAK;YACLwB,aAAarE;YACb8C,UAAUhD;YACVS,OAAO;gBACLI,WAAW;gBACXC,iBAAiB;gBACjBF,MAAM;oBACJ;oBACA;oBACA;oBACA;oBACA;iBACD,CAAC4D,IAAI,CAAC;YACT;QACF;IACF;CACD,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/data-table.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 {\n DATA_TABLE_EMPHASIS_PROP,\n isDataTableCellMarkup,\n normalizeEmphasisColumn,\n parseDataTableRows,\n readDataTableAlignments,\n} from '@aglyn/shared-data-enums'\nimport { mdiTable } from '@aglyn/shared-data-mdi'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport {\n scrollRegionProps,\n scrollableTableSx,\n} from '@aglyn/shared-ui-jsx/utils/scroll-overflow'\nimport Box from '@mui/material/Box'\nimport TableBody from '@mui/material/TableBody'\nimport TableCell from '@mui/material/TableCell'\nimport TableHead from '@mui/material/TableHead'\nimport TableRow from '@mui/material/TableRow'\nimport { forwardRef, useContext } 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 DATA_TABLE_ID: Aglyn.ComponentId = 'dataTable'\n\n/** What a screen reader announces on reaching the grid's scroll box. */\nconst TABLE_REGION_LABEL = 'Table'\n\n// The component and its preset show the same drawer glyph.\nconst TABLE_ICON = { path: mdiTable.path, sx: { color: '#0288d1' } }\n\n/**\n * What a formatted cell may draw (AGL-4203): the inline elements a label\n * may, plus links — a table cell is not a control, so an anchor inside it is\n * valid, and \"see the docs\" is a thing comparison tables say.\n *\n * Built on first use rather than at module load, so importing this file never\n * depends on `@aglyn/aglyn` having finished evaluating.\n */\nlet cellElements: ReadonlySet<string> | undefined\nfunction tableCellElements(): ReadonlySet<string> {\n cellElements ??= new Set([...Aglyn.INLINE_AUTHOR_HTML_ELEMENTS, 'a'])\n return cellElements\n}\n\n/**\n * A cell's content as TableCell props: its text, or — for a cell formatted\n * on the canvas — its markup, re-sanitized on every render by the same pure\n * sanitizer Typography uses, so the server and the browser draw the same\n * bytes and a value written straight to the document cannot plant script.\n */\nfunction cellContent(cell: string): {\n children?: string\n dangerouslySetInnerHTML?: { __html: string }\n} {\n if (!isDataTableCellMarkup(cell)) return { children: cell }\n return {\n dangerouslySetInnerHTML: {\n __html: Aglyn.sanitizeAuthorHtml(cell, undefined, {\n allowedElements: tableCellElements(),\n }),\n },\n }\n}\n\nexport interface DataTableProps {\n /**\n * The grid, pipe-delimited, one row per line — and its column alignment,\n * as a markdown divider row. See `@aglyn/shared-data-enums`'s `data-table` utilities.\n */\n rows?: string\n /** Render the first row as a header. */\n headerRow?: boolean\n /** 1-based column to emphasise, or 0/absent for none. */\n emphasizeColumn?: number | string\n}\n\n/**\n * A comparison table (AGL-2543).\n *\n * The feature matrix is the load-bearing block on a competitor comparison\n * page, and the palette had no way to build one: searching `table` returned\n * **Table of Contents** and **Pricing Table**, neither of which is a general\n * grid. The only route was to author markdown pipe syntax inside a Markdown\n * element — which renders correctly and is exactly the audience the besigner\n * exists to spare.\n *\n * Three things the Markdown route could not give, and the reason this is an\n * element rather than a docs note:\n *\n * - **Header emphasis**, without asking an author to remember that the first\n * row is special.\n * - **A highlighted column** — the \"ours\" column on a comparison page is the\n * entire point of the block, and markdown has no way to say it.\n * - **A grid to edit**, rather than pipe syntax in a text box — see the\n * `DATA_TABLE` field this element's `rows` attribute asks for.\n *\n * Narrow-screen behaviour is NOT one of them (AGL-2568). Both routes draw the\n * same block, so both take the same treatment from `scroll-overflow`: the\n * grid scrolls inside its own box once it is too wide to read, and says so.\n */\nconst DataTable = forwardRef<HTMLDivElement, DataTableProps>((props, ref) => {\n const { rows, headerRow = true, emphasizeColumn, ...rest } = props\n // Node styles ride the renderer-merged sx; recompose (stack.ts pattern).\n const nodeSx = Array.isArray(props['sx']) ? props['sx'] : [props['sx']]\n const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext)\n const grid = parseDataTableRows(rows)\n const width = grid[0]?.length ?? 0\n const alignments = readDataTableAlignments(rows, width)\n const emphasis = normalizeEmphasisColumn(emphasizeColumn, width)\n\n if (grid.length === 0) {\n // The hint is for the author, so only editing surfaces draw it; a\n // published page renders the bare element.\n if (!suppressNavigation) return <Box ref={ref} {...rest} />\n return (\n <Box\n ref={ref}\n {...rest}\n sx={[\n {\n padding: 2,\n border: '1px dashed',\n borderColor: 'divider',\n color: 'text.secondary',\n fontSize: 12,\n fontFamily: 'system-ui, sans-serif',\n },\n ...nodeSx,\n ]}\n >\n {'Table — right-click it to start a table'}\n </Box>\n )\n }\n\n const [first, ...body] = grid\n const dataRows = headerRow ? body : grid\n // An emphasised column reads as emphasised in BOTH halves of the table: a\n // header cell that is bold anyway would otherwise show no highlight at all,\n // which is the one row an author looks at first.\n const cellSx = (columnIndex: number) =>\n emphasis === columnIndex + 1\n ? { backgroundColor: 'action.hover', fontWeight: 600 }\n : undefined\n\n return (\n <ScrollTable\n ref={ref}\n size=\"small\"\n // The box scrolls the grid, and the grid is sized so that it can\n // (AGL-2568). The box's `overflow-x` is half of it: it does nothing at\n // all while the table inside is `width: 100%`, because a table of prose\n // cells that cannot exceed its box never overflows it — it crushes its\n // columns instead. `max-content` is the other half, and the box's fade\n // is what makes an overlay-scrollbar platform admit that it scrolled.\n sx={scrollableTableSx}\n ContainerProps={{\n ...rest,\n ...scrollRegionProps(TABLE_REGION_LABEL),\n // The node's styles merge after the box's own, never instead of them.\n sx: nodeSx,\n }}\n >\n {headerRow ? (\n <TableHead>\n <TableRow>\n {first.map((cell, columnIndex) => (\n <TableCell\n key={columnIndex}\n align={alignments[columnIndex]}\n sx={{ fontWeight: 700, ...cellSx(columnIndex) }}\n {...cellContent(cell)}\n />\n ))}\n </TableRow>\n </TableHead>\n ) : null}\n <TableBody>\n {dataRows.map((row, rowIndex) => (\n <TableRow key={rowIndex}>\n {row.map((cell, columnIndex) => (\n <TableCell\n key={columnIndex}\n align={alignments[columnIndex]}\n sx={cellSx(columnIndex)}\n {...cellContent(cell)}\n />\n ))}\n </TableRow>\n ))}\n </TableBody>\n </ScrollTable>\n )\n})\nDataTable.displayName = 'AglynDataTable'\n\nexport default DataTable\n\nexport const dataTableSchema: Aglyn.ComponentSchema<DataTableProps> = {\n $id: DATA_TABLE_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Table',\n description:\n 'A grid of rows and columns — a feature matrix, a spec sheet, a comparison.',\n category: Aglyn.ComponentCategory.BLOCKS,\n icon: TABLE_ICON,\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'rows',\n description:\n 'The table contents. Paste a markdown table to import one you already have.',\n component: Aglyn.FieldComponentType.DATA_TABLE,\n label: 'Rows',\n },\n {\n name: 'headerRow',\n description: 'Render the first row as a header.',\n component: Aglyn.FieldComponentType.CHECKBOX,\n label: 'First row is a header',\n },\n {\n // `DATA_TABLE_EMPHASIS_PROP`: a canvas column edit moves it with its\n // column (AGL-4203), so the name is shared rather than repeated.\n name: DATA_TABLE_EMPHASIS_PROP,\n description:\n 'Highlight one column — on a comparison table, usually your own. 0 for none.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n label: 'Emphasize column',\n },\n ],\n}\n\nexport const dataTablePresets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(DATA_TABLE_ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Table',\n pluginId: BUNDLE_ID,\n description: 'Comparison grid with a header row',\n category: Aglyn.ComponentCategory.BLOCKS,\n icon: TABLE_ICON,\n data: {\n $id: null,\n componentId: DATA_TABLE_ID,\n pluginId: BUNDLE_ID,\n props: {\n headerRow: true,\n emphasizeColumn: 2,\n rows: [\n 'Feature | Us | Them',\n '--- | :---: | :---:',\n 'Open source | Yes | No',\n 'Self-hostable | Yes | No',\n 'One platform | Yes | No',\n ].join('\\n'),\n },\n },\n },\n]\n"],"names":["Aglyn","DATA_TABLE_EMPHASIS_PROP","isDataTableCellMarkup","normalizeEmphasisColumn","parseDataTableRows","readDataTableAlignments","mdiTable","ScrollTable","scrollRegionProps","scrollableTableSx","Box","TableBody","TableCell","TableHead","TableRow","forwardRef","useContext","BUNDLE_ID","generatePresetId","DATA_TABLE_ID","TABLE_REGION_LABEL","TABLE_ICON","path","sx","color","cellElements","tableCellElements","Set","INLINE_AUTHOR_HTML_ELEMENTS","cellContent","cell","children","dangerouslySetInnerHTML","__html","sanitizeAuthorHtml","undefined","allowedElements","DataTable","props","ref","grid","rows","headerRow","emphasizeColumn","rest","nodeSx","Array","isArray","suppressNavigation","ScreenLinkContext","width","length","alignments","emphasis","padding","border","borderColor","fontSize","fontFamily","first","body","dataRows","cellSx","columnIndex","backgroundColor","fontWeight","size","ContainerProps","map","align","row","rowIndex","displayName","dataTableSchema","$id","pluginId","description","category","ComponentCategory","BLOCKS","icon","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","component","FieldComponentType","DATA_TABLE","label","CHECKBOX","TEXT_FIELD","dataTablePresets","type","NodeType","PRESET","data","componentId","join"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,wBAAwB,EACxBC,qBAAqB,EACrBC,uBAAuB,EACvBC,kBAAkB,EAClBC,uBAAuB,QAClB,2BAA0B;AACjC,SAASC,QAAQ,QAAQ,yBAAwB;AACjD,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SACEC,iBAAiB,EACjBC,iBAAiB,QACZ,6CAA4C;AACnD,OAAOC,SAAS,oBAAmB;AACnC,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,eAAe,0BAAyB;AAC/C,OAAOC,cAAc,yBAAwB;AAC7C,SAASC,UAAU,EAAEC,UAAU,QAAQ,QAAO;AAC9C,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,gBAAmC,YAAW;AAE3D,sEAAsE,GACtE,MAAMC,qBAAqB;AAE3B,2DAA2D;AAC3D,MAAMC,aAAa;IAAEC,MAAMhB,SAASgB,IAAI;IAAEC,IAAI;QAAEC,OAAO;IAAU;AAAE;AAEnE;;;;;;;CAOC,GACD,IAAIC;AACJ,SAASC;IACPD,uBAAAA,eAAAA,eAAiB,IAAIE,IAAI;WAAI3B,MAAM4B,2BAA2B;QAAE;KAAI;IACpE,OAAOH;AACT;AAEA;;;;;CAKC,GACD,SAASI,YA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YACN2E,aACE;YACFW,WAAWvF,MAAMwF,kBAAkB,CAACI,UAAU;YAC9CF,OAAO;QACT;KACD;AACH,EAAC;AAED,OAAO,MAAMG,mBAAyC;IACpD;QACEnB,KAAKxD,iBAAiBC;QACtB2E,MAAM9F,MAAM+F,QAAQ,CAACC,MAAM;QAC3BxB,aAAa;QACbG,UAAU1D;QACV2D,aAAa;QACbC,UAAU7E,MAAM8E,iBAAiB,CAACC,MAAM;QACxCC,MAAM3D;QACN4E,MAAM;YACJvB,KAAK;YACLwB,aAAa/E;YACbwD,UAAU1D;YACVqB,OAAO;gBACLI,WAAW;gBACXC,iBAAiB;gBACjBF,MAAM;oBACJ;oBACA;oBACA;oBACA;oBACA;iBACD,CAAC0D,IAAI,CAAC;YACT;QACF;IACF;CACD,CAAA"}
|
|
@@ -21,6 +21,12 @@ export interface PluginInstallLike {
|
|
|
21
21
|
name?: string;
|
|
22
22
|
restrictParent?: string[];
|
|
23
23
|
restrictChildren?: string[];
|
|
24
|
+
/** The site elements the version registers itself, when it is signed (AGL-4196). */
|
|
25
|
+
contributes?: {
|
|
26
|
+
site?: {
|
|
27
|
+
components?: unknown;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
24
30
|
};
|
|
25
31
|
}
|
|
26
32
|
/**
|
|
@@ -32,6 +38,17 @@ export interface PluginInstallLike {
|
|
|
32
38
|
* Returns null for an install without a resolvable listing id.
|
|
33
39
|
*/
|
|
34
40
|
export declare function muiPluginInstallToPreset(install: PluginInstallLike): Aglyn.PresetSchema | null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the pinned version's own site elements are registered in this
|
|
43
|
+
* editor (AGL-4196): its manifest declares `contributes.site.components` and
|
|
44
|
+
* every one of them has a schema. Only a signed (realm-trusted) bundle can
|
|
45
|
+
* register a component in the app realm, so this is true exactly when the
|
|
46
|
+
* plugin loaded trusted and offers its elements itself. A sandboxed plugin,
|
|
47
|
+
* one whose signature did not verify, or one still loading keeps the generic
|
|
48
|
+
* entry. Read through the observable registry, so a caller tracking it sees
|
|
49
|
+
* the answer change when the bundle finishes loading.
|
|
50
|
+
*/
|
|
51
|
+
export declare function realmRegistersItsSiteElements(install: PluginInstallLike): boolean;
|
|
35
52
|
/**
|
|
36
53
|
* Every drawer preset an installed plugin contributes (AGL-1031).
|
|
37
54
|
*
|
|
@@ -73,6 +73,21 @@ import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
|
73
73
|
} : {})
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether the pinned version's own site elements are registered in this
|
|
78
|
+
* editor (AGL-4196): its manifest declares `contributes.site.components` and
|
|
79
|
+
* every one of them has a schema. Only a signed (realm-trusted) bundle can
|
|
80
|
+
* register a component in the app realm, so this is true exactly when the
|
|
81
|
+
* plugin loaded trusted and offers its elements itself. A sandboxed plugin,
|
|
82
|
+
* one whose signature did not verify, or one still loading keeps the generic
|
|
83
|
+
* entry. Read through the observable registry, so a caller tracking it sees
|
|
84
|
+
* the answer change when the bundle finishes loading.
|
|
85
|
+
*/ export function realmRegistersItsSiteElements(install) {
|
|
86
|
+
var _install_manifest_contributes_site, _install_manifest_contributes, _install_manifest;
|
|
87
|
+
const declared = (_install_manifest = install.manifest) == null ? void 0 : (_install_manifest_contributes = _install_manifest.contributes) == null ? void 0 : (_install_manifest_contributes_site = _install_manifest_contributes.site) == null ? void 0 : _install_manifest_contributes_site.components;
|
|
88
|
+
if (!Array.isArray(declared) || !declared.length) return false;
|
|
89
|
+
return declared.every((id)=>typeof id === 'string' && Boolean(Aglyn.components.getSchema(id)));
|
|
90
|
+
}
|
|
76
91
|
/**
|
|
77
92
|
* Every drawer preset an installed plugin contributes (AGL-1031).
|
|
78
93
|
*
|
|
@@ -87,7 +102,10 @@ import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
|
87
102
|
*/ export function muiPluginInstallToPresets(install) {
|
|
88
103
|
var _install_listingId;
|
|
89
104
|
var _install_manifest;
|
|
90
|
-
|
|
105
|
+
// A signed (realm) version that registered its own site elements offers
|
|
106
|
+
// those, under their own categories; the generic sandboxed entry beside
|
|
107
|
+
// them would place a frame that draws nothing for such a plugin (AGL-4196).
|
|
108
|
+
const generic = realmRegistersItsSiteElements(install) ? null : muiPluginInstallToPreset(install);
|
|
91
109
|
const presets = generic ? [
|
|
92
110
|
generic
|
|
93
111
|
] : [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/plugin-install-presets.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'use client'\n\n/**\n * The drawer presets an installed marketplace plugin contributes (AGL-190,\n * AGL-1031), apart from the element that renders them.\n *\n * `plugin.ts` registers these mappers on every surface, published pages\n * included, and the Plugin element itself loads only where it is placed. In\n * the element's module the mappers pinned the whole module — its component\n * and the sandboxed frame — to every published page, because a module a\n * surface imports statically and also lazily is one module, with every export\n * kept (AGL-3401).\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { MdiIcons, mdiPuzzle } from '@aglyn/shared-data-mdi'\n// The narrow module, not the barrel: these through the barrel load the\n// manifest validators on every published page (AGL-4201).\nimport {\n PLUGIN_COMPONENT_ID,\n resolvePluginElements,\n} from '@aglyn/aglyn/app-utils/plugin-elements'\nimport { BUNDLE_ID } from '../constants/bundle-common'\n\n/** The Plugin element's component id, as the presets name it. */\nconst ID: Aglyn.ComponentId = PLUGIN_COMPONENT_ID\n\n/** The besigner drawer category installed plugins register under (AGL-190). */\nexport const PLUGIN_DRAWER_CATEGORY = 'Marketplace'\n\nexport interface PluginInstallLike {\n listingId?: string\n $id?: string\n displayName?: string\n pluginId?: string\n manifest?: {\n name?: string\n restrictParent?: string[]\n restrictChildren?: string[]\n }\n}\n\n/**\n * Builds a besigner preset for an installed plugin (AGL-190): a named,\n * draggable drawer entry that drops a `marketplacePlugin` node with the\n * listing id pre-pinned, so editors never hand-type ids. Reuses the single\n * `marketplacePlugin` renderer — no per-plugin component registration. The\n * manifest's lineal rules ride on the node data for later enforcement.\n * Returns null for an install without a resolvable listing id.\n */\nexport function muiPluginInstallToPreset(\n install: PluginInstallLike,\n): Aglyn.PresetSchema | null {\n const listingId = install.listingId ?? install.$id\n if (!listingId) return null\n const name =\n install.displayName || install.manifest?.name || 'Marketplace plugin'\n return {\n $id: `plugin__${listingId}`,\n type: Aglyn.NodeType.PRESET,\n displayName: name,\n pluginId: BUNDLE_ID,\n description: 'Installed marketplace plugin',\n category: PLUGIN_DRAWER_CATEGORY,\n icon: { path: mdiPuzzle.path, sx: { color: '#5e35b1' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { listingId },\n ...(install.manifest?.restrictParent\n ? { restrictParent: install.manifest.restrictParent }\n : {}),\n ...(install.manifest?.restrictChildren\n ? { restrictChildren: install.manifest.restrictChildren }\n : {}),\n } as any,\n }\n}\n\n/**\n * Every drawer preset an installed plugin contributes (AGL-1031).\n *\n * The generic Plugin element, plus one per element the PINNED version\n * declares. Declared elements save as the same node with an `elementId`\n * alongside the listing id — the issue's preferred answer, and the one that\n * keeps a single compose path and a single sandbox. What changes is the\n * palette entry and the label, not what executes.\n *\n * Resolved from the pin, so an element appears only where the plugin is\n * installed and disappears with a revoked or downgraded version.\n */\nexport function muiPluginInstallToPresets(\n install: PluginInstallLike,\n): Aglyn.PresetSchema[] {\n const generic = muiPluginInstallToPreset(install)\n const presets = generic ? [generic] : []\n const listingId = install.listingId ?? install.$id\n if (!listingId) return presets\n\n for (const element of resolvePluginElements({\n listingId,\n capabilities: (install as any).manifest?.capabilities,\n manifest: (install as any).manifest,\n })) {\n // The declared icon is an mdi NAME; look it up in the set the host already\n // ships. An unresolved name falls back to the puzzle mark rather than\n // rendering nothing — the entry is still placeable, which matters more\n // than the glyph.\n const declared = element.icon ? MdiIcons.get(element.icon as never) : undefined\n presets.push({\n $id: `plugin__${listingId}__${element.elementId}`,\n type: Aglyn.NodeType.PRESET,\n displayName: element.displayName,\n pluginId: BUNDLE_ID,\n description: element.description ?? 'Installed marketplace plugin',\n category: element.category,\n icon: {\n path: (declared as { path?: string } | undefined)?.path ?? mdiPuzzle.path,\n sx: { color: '#5e35b1' },\n },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { listingId, elementId: element.elementId },\n ...(install.manifest?.restrictParent\n ? { restrictParent: install.manifest.restrictParent }\n : {}),\n ...(install.manifest?.restrictChildren\n ? { restrictChildren: install.manifest.restrictChildren }\n : {}),\n } as any,\n })\n }\n return presets\n}\n"],"names":["Aglyn","MdiIcons","mdiPuzzle","PLUGIN_COMPONENT_ID","resolvePluginElements","BUNDLE_ID","ID","PLUGIN_DRAWER_CATEGORY","muiPluginInstallToPreset","install","listingId","$id","name","displayName","manifest","type","NodeType","PRESET","pluginId","description","category","icon","path","sx","color","data","componentId","props","restrictParent","restrictChildren","muiPluginInstallToPresets","generic","presets","element","capabilities","declared","get","undefined","push","elementId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA;;;;;;;;;;CAUC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,yBAAwB;AAC5D,uEAAuE;AACvE,0DAA0D;AAC1D,SACEC,mBAAmB,EACnBC,qBAAqB,QAChB,yCAAwC;AAC/C,SAASC,SAAS,QAAQ,gCAA4B;AAEtD,+DAA+D,GAC/D,MAAMC,KAAwBH;AAE9B,6EAA6E,GAC7E,OAAO,MAAMI,yBAAyB,cAAa;AAcnD;;;;;;;CAOC,GACD,OAAO,SAAS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AAACL,QAAgBK,QAAQ;IACrC,GAAI;YAWamB;YAWPxB,oBAGAA;QAxBR,2EAA2E;QAC3E,sEAAsE;QACtE,uEAAuE;QACvE,kBAAkB;QAClB,MAAM0B,WAAWF,QAAQZ,IAAI,GAAGpB,SAASmC,GAAG,CAACH,QAAQZ,IAAI,IAAagB;QACtEL,QAAQM,IAAI,CAAC;YACX3B,KAAK,CAAC,QAAQ,EAAED,UAAU,EAAE,EAAEuB,QAAQM,SAAS,EAAE;YACjDxB,MAAMf,MAAMgB,QAAQ,CAACC,MAAM;YAC3BJ,aAAaoB,QAAQpB,WAAW;YAChCK,UAAUb;YACVc,WAAW,GAAEc,uBAAAA,QAAQd,WAAW,YAAnBc,uBAAuB;YACpCb,UAAUa,QAAQb,QAAQ;YAC1BC,MAAM;gBACJC,IAAI,UAAGa,4BAAD,AAACA,SAA4Cb,IAAI,mBAAIpB,UAAUoB,IAAI;gBACzEC,IAAI;oBAAEC,OAAO;gBAAU;YACzB;YACAC,MAAM;gBACJd,KAAK;gBACLe,aAAapB;gBACbY,UAAUb;gBACVsB,OAAO;oBAAEjB;oBAAW6B,WAAWN,QAAQM,SAAS;gBAAC;eAC7C9B,EAAAA,qBAAAA,QAAQK,QAAQ,qBAAhBL,mBAAkBmB,cAAc,IAChC;gBAAEA,gBAAgBnB,QAAQK,QAAQ,CAACc,cAAc;YAAC,IAClD,CAAC,GACDnB,EAAAA,qBAAAA,QAAQK,QAAQ,qBAAhBL,mBAAkBoB,gBAAgB,IAClC;gBAAEA,kBAAkBpB,QAAQK,QAAQ,CAACe,gBAAgB;YAAC,IACtD,CAAC;QAET;IACF;IACA,OAAOG;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/plugin-install-presets.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'use client'\n\n/**\n * The drawer presets an installed marketplace plugin contributes (AGL-190,\n * AGL-1031), apart from the element that renders them.\n *\n * `plugin.ts` registers these mappers on every surface, published pages\n * included, and the Plugin element itself loads only where it is placed. In\n * the element's module the mappers pinned the whole module — its component\n * and the sandboxed frame — to every published page, because a module a\n * surface imports statically and also lazily is one module, with every export\n * kept (AGL-3401).\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { MdiIcons, mdiPuzzle } from '@aglyn/shared-data-mdi'\n// The narrow module, not the barrel: these through the barrel load the\n// manifest validators on every published page (AGL-4201).\nimport {\n PLUGIN_COMPONENT_ID,\n resolvePluginElements,\n} from '@aglyn/aglyn/app-utils/plugin-elements'\nimport { BUNDLE_ID } from '../constants/bundle-common'\n\n/** The Plugin element's component id, as the presets name it. */\nconst ID: Aglyn.ComponentId = PLUGIN_COMPONENT_ID\n\n/** The besigner drawer category installed plugins register under (AGL-190). */\nexport const PLUGIN_DRAWER_CATEGORY = 'Marketplace'\n\nexport interface PluginInstallLike {\n listingId?: string\n $id?: string\n displayName?: string\n pluginId?: string\n manifest?: {\n name?: string\n restrictParent?: string[]\n restrictChildren?: string[]\n /** The site elements the version registers itself, when it is signed (AGL-4196). */\n contributes?: { site?: { components?: unknown } }\n }\n}\n\n/**\n * Builds a besigner preset for an installed plugin (AGL-190): a named,\n * draggable drawer entry that drops a `marketplacePlugin` node with the\n * listing id pre-pinned, so editors never hand-type ids. Reuses the single\n * `marketplacePlugin` renderer — no per-plugin component registration. The\n * manifest's lineal rules ride on the node data for later enforcement.\n * Returns null for an install without a resolvable listing id.\n */\nexport function muiPluginInstallToPreset(\n install: PluginInstallLike,\n): Aglyn.PresetSchema | null {\n const listingId = install.listingId ?? install.$id\n if (!listingId) return null\n const name =\n install.displayName || install.manifest?.name || 'Marketplace plugin'\n return {\n $id: `plugin__${listingId}`,\n type: Aglyn.NodeType.PRESET,\n displayName: name,\n pluginId: BUNDLE_ID,\n description: 'Installed marketplace plugin',\n category: PLUGIN_DRAWER_CATEGORY,\n icon: { path: mdiPuzzle.path, sx: { color: '#5e35b1' } },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { listingId },\n ...(install.manifest?.restrictParent\n ? { restrictParent: install.manifest.restrictParent }\n : {}),\n ...(install.manifest?.restrictChildren\n ? { restrictChildren: install.manifest.restrictChildren }\n : {}),\n } as any,\n }\n}\n\n/**\n * Whether the pinned version's own site elements are registered in this\n * editor (AGL-4196): its manifest declares `contributes.site.components` and\n * every one of them has a schema. Only a signed (realm-trusted) bundle can\n * register a component in the app realm, so this is true exactly when the\n * plugin loaded trusted and offers its elements itself. A sandboxed plugin,\n * one whose signature did not verify, or one still loading keeps the generic\n * entry. Read through the observable registry, so a caller tracking it sees\n * the answer change when the bundle finishes loading.\n */\nexport function realmRegistersItsSiteElements(install: PluginInstallLike): boolean {\n const declared = install.manifest?.contributes?.site?.components\n if (!Array.isArray(declared) || !declared.length) return false\n return declared.every((id) => typeof id === 'string' && Boolean(Aglyn.components.getSchema(id as Aglyn.ComponentId)))\n}\n\n/**\n * Every drawer preset an installed plugin contributes (AGL-1031).\n *\n * The generic Plugin element, plus one per element the PINNED version\n * declares. Declared elements save as the same node with an `elementId`\n * alongside the listing id — the issue's preferred answer, and the one that\n * keeps a single compose path and a single sandbox. What changes is the\n * palette entry and the label, not what executes.\n *\n * Resolved from the pin, so an element appears only where the plugin is\n * installed and disappears with a revoked or downgraded version.\n */\nexport function muiPluginInstallToPresets(\n install: PluginInstallLike,\n): Aglyn.PresetSchema[] {\n // A signed (realm) version that registered its own site elements offers\n // those, under their own categories; the generic sandboxed entry beside\n // them would place a frame that draws nothing for such a plugin (AGL-4196).\n const generic = realmRegistersItsSiteElements(install) ? null : muiPluginInstallToPreset(install)\n const presets = generic ? [generic] : []\n const listingId = install.listingId ?? install.$id\n if (!listingId) return presets\n\n for (const element of resolvePluginElements({\n listingId,\n capabilities: (install as any).manifest?.capabilities,\n manifest: (install as any).manifest,\n })) {\n // The declared icon is an mdi NAME; look it up in the set the host already\n // ships. An unresolved name falls back to the puzzle mark rather than\n // rendering nothing — the entry is still placeable, which matters more\n // than the glyph.\n const declared = element.icon ? MdiIcons.get(element.icon as never) : undefined\n presets.push({\n $id: `plugin__${listingId}__${element.elementId}`,\n type: Aglyn.NodeType.PRESET,\n displayName: element.displayName,\n pluginId: BUNDLE_ID,\n description: element.description ?? 'Installed marketplace plugin',\n category: element.category,\n icon: {\n path: (declared as { path?: string } | undefined)?.path ?? mdiPuzzle.path,\n sx: { color: '#5e35b1' },\n },\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { listingId, elementId: element.elementId },\n ...(install.manifest?.restrictParent\n ? { restrictParent: install.manifest.restrictParent }\n : {}),\n ...(install.manifest?.restrictChildren\n ? { restrictChildren: install.manifest.restrictChildren }\n : {}),\n } as any,\n })\n }\n return presets\n}\n"],"names":["Aglyn","MdiIcons","mdiPuzzle","PLUGIN_COMPONENT_ID","resolvePluginElements","BUNDLE_ID","ID","PLUGIN_DRAWER_CATEGORY","muiPluginInstallToPreset","install","listingId","$id","name","displayName","manifest","type","NodeType","PRESET","pluginId","description","category","icon","path","sx","color","data","componentId","props","restrictParent","restrictChildren","realmRegistersItsSiteElements","declared","contributes","site","components","Array","isArray","length","every","id","Boolean","getSchema","muiPluginInstallToPresets","generic","presets","element","capabilities","get","undefined","push","elementId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA;;;;;;;;;;CAUC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,QAAQ,EAAEC,SAAS,QAAQ,yBAAwB;AAC5D,uEAAuE;AACvE,0DAA0D;AAC1D,SACEC,mBAAmB,EACnBC,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