@aglyn/plugins-mui 1.0.0-beta.221 → 1.0.0-beta.222
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/accordion.js +21 -1
- package/src/lib/components/accordion.js.map +1 -1
- package/src/lib/components/collection-entries-search.d.ts +29 -0
- package/src/lib/components/collection-entries-search.js +228 -0
- package/src/lib/components/collection-entries-search.js.map +1 -0
- package/src/lib/components/collection-entries.d.ts +45 -10
- package/src/lib/components/collection-entries.js +67 -183
- package/src/lib/components/collection-entries.js.map +1 -1
- package/src/lib/components/collection-entry-body.d.ts +1 -0
- package/src/lib/components/collection-entry-body.js.map +1 -1
- package/src/lib/components/collection-search-box.js +9 -0
- package/src/lib/components/collection-search-box.js.map +1 -1
- package/src/lib/components/image.d.ts +24 -5
- package/src/lib/components/image.js +145 -25
- package/src/lib/components/image.js.map +1 -1
- package/src/lib/components/markdown.d.ts +1 -0
- package/src/lib/components/markdown.js.map +1 -1
- package/src/lib/components/search-box.d.ts +3 -1
- package/src/lib/components/search-box.js +8 -3
- package/src/lib/components/search-box.js.map +1 -1
- package/src/lib/plugin.d.ts +11 -0
- package/src/lib/plugin.js +16 -1
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/utils/image-sizes.d.ts +146 -0
- package/src/lib/utils/image-sizes.js +423 -0
- package/src/lib/utils/image-sizes.js.map +1 -0
package/src/lib/plugin.d.ts
CHANGED
|
@@ -37,6 +37,17 @@ export interface MuiComponentSource {
|
|
|
37
37
|
schema: string;
|
|
38
38
|
/** The export carrying its presets, for the element that ships them. */
|
|
39
39
|
presets?: string;
|
|
40
|
+
/**
|
|
41
|
+
* An export that loads what SOME instances of the element render, before
|
|
42
|
+
* any of them does (AGL-3438) — `(everything: boolean) => Promise | void`.
|
|
43
|
+
*
|
|
44
|
+
* For a module the element fetches only when an instance's props ask for
|
|
45
|
+
* it, the way Collection Entries fetches its search box. The element alone
|
|
46
|
+
* knows when a render must not wait for that fetch; `everything` tells it
|
|
47
|
+
* the whole library is loading, which is what the console and the besigner
|
|
48
|
+
* ask for. The bundle is handed over once the load it returns has settled.
|
|
49
|
+
*/
|
|
50
|
+
prepare?: string;
|
|
40
51
|
}
|
|
41
52
|
/**
|
|
42
53
|
* Every component this bundle can register (AGL-140, AGL-3141).
|
package/src/lib/plugin.js
CHANGED
|
@@ -180,7 +180,8 @@ const themeModeSwitcher = viaTier('themeModeSwitcher');
|
|
|
180
180
|
module: collectionEntries,
|
|
181
181
|
component: 'CollectionEntries',
|
|
182
182
|
schema: 'collectionEntriesSchema',
|
|
183
|
-
presets: 'collectionPresets'
|
|
183
|
+
presets: 'collectionPresets',
|
|
184
|
+
prepare: 'prepareEntriesSearch'
|
|
184
185
|
},
|
|
185
186
|
collectionEntryBody: {
|
|
186
187
|
module: collectionEntryBody,
|
|
@@ -477,6 +478,20 @@ const themeModeSwitcher = viaTier('themeModeSwitcher');
|
|
|
477
478
|
}
|
|
478
479
|
return load;
|
|
479
480
|
}));
|
|
481
|
+
// Each module's on-demand parts, once per module, before anything renders.
|
|
482
|
+
const everything = componentIds === undefined;
|
|
483
|
+
const prepared = new Set();
|
|
484
|
+
await Promise.all(ids.map((id, index)=>{
|
|
485
|
+
const source = MUI_COMPONENT_SOURCES[id];
|
|
486
|
+
const mod = modules[index];
|
|
487
|
+
if (!source.prepare || prepared.has(mod)) return undefined;
|
|
488
|
+
prepared.add(mod);
|
|
489
|
+
const prepare = mod[source.prepare];
|
|
490
|
+
// A failed fetch is the render's to report, not the registration's:
|
|
491
|
+
// the element asks again when it renders, and a block that still
|
|
492
|
+
// cannot have it fails alone instead of taking the page with it.
|
|
493
|
+
return Promise.resolve(prepare == null ? void 0 : prepare(everything)).catch(()=>undefined);
|
|
494
|
+
}));
|
|
480
495
|
return ids.map((id, index)=>{
|
|
481
496
|
const source = MUI_COMPONENT_SOURCES[id];
|
|
482
497
|
const mod = modules[index];
|
package/src/lib/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/mui/src/lib/plugin.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 {\n registerPluginInstallPresetMapper,\n registerPluginInstallPresetsMapper,\n} from '@aglyn/aglyn'\nimport {\n muiPluginInstallToPreset,\n muiPluginInstallToPresets,\n} from './components/plugin-install-presets'\nimport * as Aglyn from '@aglyn/aglyn'\nimport { runInAction } from 'mobx'\nimport { BUNDLE_ID } from './constants/bundle-common'\n\n/**\n * One thunk per component module, named here because several ids share one:\n * `card.tsx` and `accordion.tsx` each export several elements, and a module is\n * imported once however many of its components a surface asks for.\n *\n * Every thunk goes through the element tier (AGL-3401). The common elements\n * are part of it; the rest are `import()`s written inside it, so they can\n * rely on what it loaded instead of each carrying a copy. `element-tier.ts`\n * has the reasoning, and which elements are which.\n */\ntype ElementTier = typeof import('./element-tier')\ntype TierElement = keyof ElementTier['CORE_ELEMENTS']\ntype LazyElement = Exclude<keyof ElementTier, 'CORE_ELEMENTS'>\n\ntype ElementModule = Promise<Record<string, unknown>>\n\n/**\n * One load of the tier, however many thunks ask at once. The bundler shares\n * a module across concurrent imports anyway; a loader that hands out a\n * module while it is still evaluating does not — jiti, which the AI palette\n * and page-axe generators load this bundle through, resolved the second of\n * sixty concurrent imports to the tier's exports before `CORE_ELEMENTS` was\n * assigned.\n */\nlet tierLoad: Promise<ElementTier> | undefined\nconst elementTier = (): Promise<ElementTier> =>\n (tierLoad ??= import('./element-tier'))\nconst inTier =\n (name: TierElement): MuiComponentSource['module'] =>\n () =>\n elementTier().then(\n (tier): Record<string, unknown> => tier.CORE_ELEMENTS[name],\n )\nconst viaTier =\n (name: LazyElement): MuiComponentSource['module'] =>\n () =>\n elementTier().then((tier): ElementModule => tier[name]())\n\nconst appBar = inTier('appBar')\nconst toolbar = inTier('toolbar')\nconst layoutSlot = inTier('layoutSlot')\nconst documentRoot = inTier('documentRoot')\nconst section = inTier('section')\nconst container = inTier('container')\nconst box = inTier('box')\nconst stack = inTier('stack')\nconst grid = inTier('grid')\nconst paper = inTier('paper')\nconst typography = inTier('typography')\nconst inlineText = inTier('inlineText')\nconst button = inTier('button')\nconst screenLink = inTier('screenLink')\nconst linkBox = inTier('linkBox')\nconst image = inTier('image')\nconst icon = inTier('icon')\n\nconst list = viaTier('list')\nconst listItem = viaTier('listItem')\nconst listItemText = viaTier('listItemText')\nconst blocks = viaTier('blocks')\nconst dataTable = viaTier('dataTable')\nconst collectionEntries = viaTier('collectionEntries')\nconst collectionEntryBody = viaTier('collectionEntryBody')\nconst collectionRelated = viaTier('collectionRelated')\nconst collectionShare = viaTier('collectionShare')\nconst collectionEntryMeta = viaTier('collectionEntryMeta')\nconst collectionEntryAuthor = viaTier('collectionEntryAuthor')\nconst collectionAuthorProfile = viaTier('collectionAuthorProfile')\nconst collectionCategories = viaTier('collectionCategories')\nconst collectionSearch = viaTier('collectionSearch')\nconst video = viaTier('video')\nconst languageSwitcher = viaTier('languageSwitcher')\nconst reusableInstance = viaTier('reusableInstance')\nconst navMenu = viaTier('navMenu')\nconst drawer = viaTier('drawer')\nconst product = viaTier('product')\nconst plugin = viaTier('plugin')\nconst customHtml = viaTier('customHtml')\nconst searchBox = viaTier('searchBox')\nconst markdown = viaTier('markdown')\nconst card = viaTier('card')\nconst accordion = viaTier('accordion')\nconst tabs = viaTier('tabs')\nconst imageList = viaTier('imageList')\nconst pagination = viaTier('pagination')\nconst breadcrumbs = viaTier('breadcrumbs')\nconst themeModeSwitcher = viaTier('themeModeSwitcher')\n\n/** One entry of the bundle: what the registry is handed for a component. */\nexport interface MuiBundleEntry {\n component: any\n schema: Aglyn.ComponentSchema<any>\n presets?: Aglyn.PresetSchema[]\n}\n\n/**\n * Where a component id's code lives, and what it is called there (AGL-3141).\n *\n * An id names a module AND an export on it, never a module alone: several\n * modules export more than one element, and the registry needs the component,\n * its schema and — for the element that carries them — its presets by name.\n */\nexport interface MuiComponentSource {\n /** The module, as a thunk, so the bundler gives it a chunk of its own. */\n module: () => Promise<Record<string, unknown>>\n /** The component's export name on that module. */\n component: string\n /** Its schema's export name. */\n schema: string\n /** The export carrying its presets, for the element that ships them. */\n presets?: string\n}\n\n/**\n * Every component this bundle can register (AGL-140, AGL-3141).\n *\n * One entry per component keeps register/unregister symmetric — the old\n * hand-maintained lists had drifted, and several components were never\n * unregistered on destroy. It replaces a single array built from sixty static\n * imports, which put every element on every published page while the page\n * rendered about nineteen of them.\n *\n * Exported so the bundle is assertable (AGL-1201): duplicate component or\n * preset ids collapse silently inside the registry's keyed records, so they\n * can only be caught before registration.\n */\nexport const MUI_COMPONENT_SOURCES: Readonly<\n Record<string, MuiComponentSource>\n> = {\n muiAppBar: {\n module: appBar,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiToolbar: {\n module: toolbar,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiTypography: {\n module: typography,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The inline text run (AGL-1235): Typography is `textEditable` and so a\n // leaf, which left no way to emphasize a phrase inside a sentence — every\n // statement rendered as one flat color.\n muiInlineText: {\n module: inlineText,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiButton: {\n module: button,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiContainer: {\n module: container,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n layoutSlot: {\n module: layoutSlot,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiList: {\n module: list,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiListItem: {\n module: listItem,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiListItemText: {\n module: listItemText,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // form, formField moved to @aglyn/plugins-forms (AGL-395).\n videoEmbed: {\n module: blocks,\n component: 'VideoEmbed',\n schema: 'videoEmbedSchema',\n presets: 'blockPresets',\n },\n socialLinks: {\n module: blocks,\n component: 'SocialLinks',\n schema: 'socialLinksSchema',\n },\n // A real data grid (AGL-2543): the feature matrix a comparison page is\n // built around, which the palette had no element for at all.\n dataTable: {\n module: dataTable,\n component: 'default',\n schema: 'dataTableSchema',\n presets: 'dataTablePresets',\n },\n // Content collections (AGL-551/582): entries repeater, markdown entry\n // body, related posts, share bar, entry meta.\n collectionEntries: {\n module: collectionEntries,\n component: 'CollectionEntries',\n schema: 'collectionEntriesSchema',\n presets: 'collectionPresets',\n },\n collectionEntryBody: {\n module: collectionEntryBody,\n component: 'CollectionEntryBody',\n schema: 'collectionEntryBodySchema',\n },\n collectionRelated: {\n module: collectionRelated,\n component: 'CollectionRelated',\n schema: 'collectionRelatedSchema',\n },\n collectionShare: {\n module: collectionShare,\n component: 'CollectionShare',\n schema: 'collectionShareSchema',\n },\n collectionEntryMeta: {\n module: collectionEntryMeta,\n component: 'CollectionEntryMeta',\n schema: 'collectionEntryMetaSchema',\n },\n // The author card that closes an article (AGL-2486): the byline block\n // prints a name, and the record behind it also has a portrait and a bio.\n collectionEntryAuthor: {\n module: collectionEntryAuthor,\n component: 'CollectionEntryAuthor',\n schema: 'collectionEntryAuthorSchema',\n },\n // The subject of an author's own page (AGL-2518): the same person the\n // card above draws as a footnote, with the role fields it has no room for.\n contentAuthorProfile: {\n module: collectionAuthorProfile,\n component: 'ContentAuthorProfile',\n schema: 'contentAuthorProfileSchema',\n },\n // Category pills (AGL-1321): real anchors to /{collection}/category/{slug}.\n collectionCategories: {\n module: collectionCategories,\n component: 'CollectionCategories',\n schema: 'collectionCategoriesSchema',\n },\n // The toolbar search box (AGL-1516): the entries block's own field cannot\n // leave it, so the frame's pills-left / search-right row needs a block.\n collectionSearch: {\n module: collectionSearch,\n component: 'CollectionSearch',\n schema: 'collectionSearchSchema',\n },\n image: {\n module: image,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n video: {\n module: video,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n icon: {\n module: icon,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // booking moved to @aglyn/plugins-bookings (AGL-395).\n // eventList moved to @aglyn/plugins-events-calendar (AGL-313).\n languageSwitcher: {\n module: languageSwitcher,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n reusableInstance: {\n module: reusableInstance,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiScreenLink: {\n module: screenLink,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The linking container (AGL-1231): every other link element is a leaf,\n // so a tile whose icon and description also belong to the target had no\n // way to be authored.\n muiLinkBox: {\n module: linkBox,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Nav menu system (AGL-562): dropdown, mega menu, drawer + menu button.\n muiNavMenu: {\n module: navMenu,\n component: 'default',\n schema: 'navMenuSchema',\n presets: 'navMenuPresets',\n },\n muiMegaMenu: {\n module: navMenu,\n component: 'MegaMenu',\n schema: 'megaMenuSchema',\n },\n muiDrawer: {\n module: drawer,\n component: 'default',\n schema: 'drawerSchema',\n presets: 'drawerPresets',\n },\n muiDrawerToggle: {\n module: drawer,\n component: 'DrawerToggle',\n schema: 'drawerToggleSchema',\n },\n product: {\n module: product,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n marketplacePlugin: {\n module: plugin,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n 'custom-html': {\n module: customHtml,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n searchBox: {\n module: searchBox,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Long-form documents (AGL-1162): one markdown element carrying the whole\n // page, and an \"On this page\" aside derived from its headings.\n markdown: {\n module: markdown,\n component: 'Markdown',\n schema: 'markdownSchema',\n presets: 'markdownPresets',\n },\n tableOfContents: {\n module: markdown,\n component: 'TableOfContents',\n schema: 'tableOfContentsSchema',\n },\n section: {\n module: section,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiStack: {\n module: stack,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Layout & surface primitives (AGL-1201).\n muiBox: {\n module: box,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The canvas ROOT (AGL-2486): registered so the Document layer has a\n // schema — an element picker — instead of falling through to the\n // renderer's unstyled div. No preset: it is not an element anybody drops.\n div: {\n module: documentRoot,\n component: 'default',\n schema: 'schema',\n },\n muiGrid: {\n module: grid,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiPaper: {\n module: paper,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiCard: {\n module: card,\n component: 'default',\n schema: 'cardSchema',\n presets: 'cardPresets',\n },\n muiCardHeader: {\n module: card,\n component: 'CardHeaderElement',\n schema: 'cardHeaderSchema',\n },\n muiCardContent: {\n module: card,\n component: 'CardContentElement',\n schema: 'cardContentSchema',\n },\n muiCardActions: {\n module: card,\n component: 'CardActionsElement',\n schema: 'cardActionsSchema',\n },\n muiAccordion: {\n module: accordion,\n component: 'default',\n schema: 'accordionSchema',\n presets: 'accordionPresets',\n },\n muiAccordionSummary: {\n module: accordion,\n component: 'AccordionSummaryElement',\n schema: 'accordionSummarySchema',\n },\n muiAccordionDetails: {\n module: accordion,\n component: 'AccordionDetailsElement',\n schema: 'accordionDetailsSchema',\n },\n muiTabs: {\n module: tabs,\n component: 'default',\n schema: 'tabsSchema',\n presets: 'tabsPresets',\n },\n muiTabPanel: {\n module: tabs,\n component: 'TabPanelElement',\n schema: 'tabPanelSchema',\n },\n muiImageList: {\n module: imageList,\n component: 'default',\n schema: 'imageListSchema',\n presets: 'imageListPresets',\n },\n muiImageListItem: {\n module: imageList,\n component: 'ImageListItemElement',\n schema: 'imageListItemSchema',\n },\n muiPagination: {\n module: pagination,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiBreadcrumbs: {\n module: breadcrumbs,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n themeModeSwitcher: {\n module: themeModeSwitcher,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n}\n\n/**\n * The bundle entries for `componentIds` — every component when none are\n * named, which is what the console and the besigner ask for because their\n * palette shows every element.\n *\n * Both paths go through the same map, so there is one statement of where a\n * component comes from. An id the map does not know is dropped rather than\n * resolved to an undefined component: a page whose document carries an\n * element this bundle does not own is a document for another plugin's\n * element, not a reason to register a blank.\n */\nexport async function loadMuiBundle(\n componentIds?: readonly string[],\n): Promise<MuiBundleEntry[]> {\n const ids = (componentIds ?? Object.keys(MUI_COMPONENT_SOURCES)).filter(\n (id) => id in MUI_COMPONENT_SOURCES,\n )\n // Keyed on the THUNK, so a module that exports several elements is\n // imported once for all the ids that name it rather than once per id.\n const pending = new Map<\n MuiComponentSource['module'],\n Promise<Record<string, unknown>>\n >()\n const modules = await Promise.all(\n ids.map((id) => {\n const source = MUI_COMPONENT_SOURCES[id] as MuiComponentSource\n let load = pending.get(source.module)\n if (!load) {\n load = source.module()\n pending.set(source.module, load)\n }\n return load\n }),\n )\n return ids.map((id, index) => {\n const source = MUI_COMPONENT_SOURCES[id] as MuiComponentSource\n const mod = modules[index] as Record<string, unknown>\n return {\n component: mod[source.component],\n schema: mod[source.schema] as Aglyn.ComponentSchema<any>,\n ...(source.presets\n ? { presets: mod[source.presets] as Aglyn.PresetSchema[] }\n : {}),\n }\n })\n}\n\n/**\n * Every component registered so far, by id.\n *\n * A second page places elements the first did not, and reaches this bundle\n * again with them; the map is what tells the two apart, and what `load` and\n * `destroy` read so a reload registers everything asked for so far and\n * unregistration stays symmetric with registration.\n */\nconst registeredById = new Map<string, MuiBundleEntry>()\n\nfunction registerEntries(entries: readonly MuiBundleEntry[]): void {\n // One mobx transaction (AGL-371): a single observer notification\n // for the whole batch instead of one per component/preset.\n runInAction(() => {\n for (const entry of entries) {\n Aglyn.components.registerComponent(entry.component, entry.schema)\n }\n for (const entry of entries) {\n if (entry.presets?.length) {\n Aglyn.components.registerPreset(entry.presets)\n }\n }\n })\n}\n\n/**\n * Registers the core MUI component library with the `@aglyn/aglyn` global\n * plugin registry (`AglynNodeRenderer`, `Aglyn.canvas`, ...). This is the\n * platform's core component bundle; feature bundles (commerce,\n * events-calendar, email) declare a dependency on it.\n *\n * `use.componentIds` narrows it to the elements the surface places\n * (AGL-3116/AGL-3141), so a published page fetches those modules and no\n * others. A caller that names nothing gets the whole library, which is what\n * the console and the besigner need and what any surface that cannot say\n * what it places must be given: an element whose component never registered\n * renders NOTHING, silently (AGL-52).\n */\nexport async function registerMuiPlugin(use?: Aglyn.PluginUse): Promise<void> {\n // Install→preset mapper (AGL-419): the console's drawer registration\n // consumes it through core, never importing this plugin.\n registerPluginInstallPresetMapper(muiPluginInstallToPreset)\n // Declared canvas elements become their own palette entries (AGL-1031).\n registerPluginInstallPresetsMapper(muiPluginInstallToPresets)\n\n const wanted = (use?.componentIds ?? Object.keys(MUI_COMPONENT_SOURCES))\n .filter((id) => id in MUI_COMPONENT_SOURCES)\n .filter((id) => !registeredById.has(id))\n const existing = Aglyn.plugins.getDependency(BUNDLE_ID)\n if (existing && !wanted.length) return\n\n const entries = wanted.length ? await loadMuiBundle(wanted) : []\n for (const entry of entries) {\n registeredById.set(entry.schema.$id as string, entry)\n }\n\n // The dependency is added even when this page places nothing of it: a\n // feature bundle declares mui as a dependency and stays WAITING — its own\n // components never registering — until mui is in the manager.\n //\n // Re-read after the imports rather than trusting the check above: the\n // manager runs `load()` from `addDependency` synchronously, so the first\n // caller to get here creates the dependency and every later one takes the\n // branch that registers what it added into a bundle already LOADED.\n if (Aglyn.plugins.getDependency(BUNDLE_ID)) {\n if (entries.length) registerEntries(entries)\n return\n }\n\n Aglyn.plugins.addDependency({\n $id: BUNDLE_ID,\n displayName: 'Material UI',\n description: 'Material UI elements',\n title: 'Material UI',\n dependencies: {},\n load(): void {\n registerEntries([...registeredById.values()])\n },\n destroy(): void {\n const entries = [...registeredById.values()]\n runInAction(() => {\n for (const entry of entries) {\n if (entry.presets?.length) {\n Aglyn.components.unregisterPreset(\n entry.presets.map((preset) => preset.$id),\n )\n }\n }\n for (const entry of entries) {\n Aglyn.components.unregisterComponent(entry.schema.$id)\n }\n })\n },\n })\n}\n"],"names":["registerPluginInstallPresetMapper","registerPluginInstallPresetsMapper","muiPluginInstallToPreset","muiPluginInstallToPresets","Aglyn","runInAction","BUNDLE_ID","tierLoad","elementTier","inTier","name","then","tier","CORE_ELEMENTS","viaTier","appBar","toolbar","layoutSlot","documentRoot","section","container","box","stack","grid","paper","typography","inlineText","button","screenLink","linkBox","image","icon","list","listItem","listItemText","blocks","dataTable","collectionEntries","collectionEntryBody","collectionRelated","collectionShare","collectionEntryMeta","collectionEntryAuthor","collectionAuthorProfile","collectionCategories","collectionSearch","video","languageSwitcher","reusableInstance","navMenu","drawer","product","plugin","customHtml","searchBox","markdown","card","accordion","tabs","imageList","pagination","breadcrumbs","themeModeSwitcher","MUI_COMPONENT_SOURCES","muiAppBar","module","component","schema","presets","muiToolbar","muiTypography","muiInlineText","muiButton","muiContainer","muiList","muiListItem","muiListItemText","videoEmbed","socialLinks","contentAuthorProfile","muiScreenLink","muiLinkBox","muiNavMenu","muiMegaMenu","muiDrawer","muiDrawerToggle","marketplacePlugin","tableOfContents","muiStack","muiBox","div","muiGrid","muiPaper","muiCard","muiCardHeader","muiCardContent","muiCardActions","muiAccordion","muiAccordionSummary","muiAccordionDetails","muiTabs","muiTabPanel","muiImageList","muiImageListItem","muiPagination","muiBreadcrumbs","loadMuiBundle","componentIds","ids","Object","keys","filter","id","pending","Map","modules","Promise","all","map","source","load","get","set","index","mod","registeredById","registerEntries","entries","entry","components","registerComponent","length","registerPreset","registerMuiPlugin","use","wanted","has","existing","plugins","getDependency","$id","addDependency","displayName","description","title","dependencies","values","destroy","unregisterPreset","preset","unregisterComponent"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iCAAiC,EACjCC,kCAAkC,QAC7B,eAAc;AACrB,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,yCAAqC;AAC5C,YAAYC,WAAW,eAAc;AACrC,SAASC,WAAW,QAAQ,OAAM;AAClC,SAASC,SAAS,QAAQ,+BAA2B;AAkBrD;;;;;;;CAOC,GACD,IAAIC;AACJ,MAAMC,cAAc,IACjBD,mBAAAA,WAAAA,WAAa,MAAM,CAAC;AACvB,MAAME,SACJ,CAACC,OACD,IACEF,cAAcG,IAAI,CAChB,CAACC,OAAkCA,KAAKC,aAAa,CAACH,KAAK;AAEjE,MAAMI,UACJ,CAACJ,OACD,IACEF,cAAcG,IAAI,CAAC,CAACC,OAAwBA,IAAI,CAACF,KAAK;AAE1D,MAAMK,SAASN,OAAO;AACtB,MAAMO,UAAUP,OAAO;AACvB,MAAMQ,aAAaR,OAAO;AAC1B,MAAMS,eAAeT,OAAO;AAC5B,MAAMU,UAAUV,OAAO;AACvB,MAAMW,YAAYX,OAAO;AACzB,MAAMY,MAAMZ,OAAO;AACnB,MAAMa,QAAQb,OAAO;AACrB,MAAMc,OAAOd,OAAO;AACpB,MAAMe,QAAQf,OAAO;AACrB,MAAMgB,aAAahB,OAAO;AAC1B,MAAMiB,aAAajB,OAAO;AAC1B,MAAMkB,SAASlB,OAAO;AACtB,MAAMmB,aAAanB,OAAO;AAC1B,MAAMoB,UAAUpB,OAAO;AACvB,MAAMqB,QAAQrB,OAAO;AACrB,MAAMsB,OAAOtB,OAAO;AAEpB,MAAMuB,OAAOlB,QAAQ;AACrB,MAAMmB,WAAWnB,QAAQ;AACzB,MAAMoB,eAAepB,QAAQ;AAC7B,MAAMqB,SAASrB,QAAQ;AACvB,MAAMsB,YAA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QI,MAAM,EAAEL,gBAAgBC;QACpC;IACF;IAEA3H,MAAMsI,OAAO,CAACG,aAAa,CAAC;QAC1BD,KAAKtI;QACLwI,aAAa;QACbC,aAAa;QACbC,OAAO;QACPC,cAAc,CAAC;QACfzB;YACEM,gBAAgB;mBAAID,eAAeqB,MAAM;aAAG;QAC9C;QACAC;YACE,MAAMpB,UAAU;mBAAIF,eAAeqB,MAAM;aAAG;YAC5C7I,YAAY;gBACV,KAAK,MAAM2H,SAASD,QAAS;wBACvBC;oBAAJ,KAAIA,iBAAAA,MAAM5D,OAAO,qBAAb4D,eAAeG,MAAM,EAAE;wBACzB/H,MAAM6H,UAAU,CAACmB,gBAAgB,CAC/BpB,MAAM5D,OAAO,CAACkD,GAAG,CAAC,CAAC+B,SAAWA,OAAOT,GAAG;oBAE5C;gBACF;gBACA,KAAK,MAAMZ,SAASD,QAAS;oBAC3B3H,MAAM6H,UAAU,CAACqB,mBAAmB,CAACtB,MAAM7D,MAAM,CAACyE,GAAG;gBACvD;YACF;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/mui/src/lib/plugin.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 {\n registerPluginInstallPresetMapper,\n registerPluginInstallPresetsMapper,\n} from '@aglyn/aglyn'\nimport {\n muiPluginInstallToPreset,\n muiPluginInstallToPresets,\n} from './components/plugin-install-presets'\nimport * as Aglyn from '@aglyn/aglyn'\nimport { runInAction } from 'mobx'\nimport { BUNDLE_ID } from './constants/bundle-common'\n\n/**\n * One thunk per component module, named here because several ids share one:\n * `card.tsx` and `accordion.tsx` each export several elements, and a module is\n * imported once however many of its components a surface asks for.\n *\n * Every thunk goes through the element tier (AGL-3401). The common elements\n * are part of it; the rest are `import()`s written inside it, so they can\n * rely on what it loaded instead of each carrying a copy. `element-tier.ts`\n * has the reasoning, and which elements are which.\n */\ntype ElementTier = typeof import('./element-tier')\ntype TierElement = keyof ElementTier['CORE_ELEMENTS']\ntype LazyElement = Exclude<keyof ElementTier, 'CORE_ELEMENTS'>\n\ntype ElementModule = Promise<Record<string, unknown>>\n\n/**\n * One load of the tier, however many thunks ask at once. The bundler shares\n * a module across concurrent imports anyway; a loader that hands out a\n * module while it is still evaluating does not — jiti, which the AI palette\n * and page-axe generators load this bundle through, resolved the second of\n * sixty concurrent imports to the tier's exports before `CORE_ELEMENTS` was\n * assigned.\n */\nlet tierLoad: Promise<ElementTier> | undefined\nconst elementTier = (): Promise<ElementTier> =>\n (tierLoad ??= import('./element-tier'))\nconst inTier =\n (name: TierElement): MuiComponentSource['module'] =>\n () =>\n elementTier().then(\n (tier): Record<string, unknown> => tier.CORE_ELEMENTS[name],\n )\nconst viaTier =\n (name: LazyElement): MuiComponentSource['module'] =>\n () =>\n elementTier().then((tier): ElementModule => tier[name]())\n\nconst appBar = inTier('appBar')\nconst toolbar = inTier('toolbar')\nconst layoutSlot = inTier('layoutSlot')\nconst documentRoot = inTier('documentRoot')\nconst section = inTier('section')\nconst container = inTier('container')\nconst box = inTier('box')\nconst stack = inTier('stack')\nconst grid = inTier('grid')\nconst paper = inTier('paper')\nconst typography = inTier('typography')\nconst inlineText = inTier('inlineText')\nconst button = inTier('button')\nconst screenLink = inTier('screenLink')\nconst linkBox = inTier('linkBox')\nconst image = inTier('image')\nconst icon = inTier('icon')\n\nconst list = viaTier('list')\nconst listItem = viaTier('listItem')\nconst listItemText = viaTier('listItemText')\nconst blocks = viaTier('blocks')\nconst dataTable = viaTier('dataTable')\nconst collectionEntries = viaTier('collectionEntries')\nconst collectionEntryBody = viaTier('collectionEntryBody')\nconst collectionRelated = viaTier('collectionRelated')\nconst collectionShare = viaTier('collectionShare')\nconst collectionEntryMeta = viaTier('collectionEntryMeta')\nconst collectionEntryAuthor = viaTier('collectionEntryAuthor')\nconst collectionAuthorProfile = viaTier('collectionAuthorProfile')\nconst collectionCategories = viaTier('collectionCategories')\nconst collectionSearch = viaTier('collectionSearch')\nconst video = viaTier('video')\nconst languageSwitcher = viaTier('languageSwitcher')\nconst reusableInstance = viaTier('reusableInstance')\nconst navMenu = viaTier('navMenu')\nconst drawer = viaTier('drawer')\nconst product = viaTier('product')\nconst plugin = viaTier('plugin')\nconst customHtml = viaTier('customHtml')\nconst searchBox = viaTier('searchBox')\nconst markdown = viaTier('markdown')\nconst card = viaTier('card')\nconst accordion = viaTier('accordion')\nconst tabs = viaTier('tabs')\nconst imageList = viaTier('imageList')\nconst pagination = viaTier('pagination')\nconst breadcrumbs = viaTier('breadcrumbs')\nconst themeModeSwitcher = viaTier('themeModeSwitcher')\n\n/** One entry of the bundle: what the registry is handed for a component. */\nexport interface MuiBundleEntry {\n component: any\n schema: Aglyn.ComponentSchema<any>\n presets?: Aglyn.PresetSchema[]\n}\n\n/**\n * Where a component id's code lives, and what it is called there (AGL-3141).\n *\n * An id names a module AND an export on it, never a module alone: several\n * modules export more than one element, and the registry needs the component,\n * its schema and — for the element that carries them — its presets by name.\n */\nexport interface MuiComponentSource {\n /** The module, as a thunk, so the bundler gives it a chunk of its own. */\n module: () => Promise<Record<string, unknown>>\n /** The component's export name on that module. */\n component: string\n /** Its schema's export name. */\n schema: string\n /** The export carrying its presets, for the element that ships them. */\n presets?: string\n /**\n * An export that loads what SOME instances of the element render, before\n * any of them does (AGL-3438) — `(everything: boolean) => Promise | void`.\n *\n * For a module the element fetches only when an instance's props ask for\n * it, the way Collection Entries fetches its search box. The element alone\n * knows when a render must not wait for that fetch; `everything` tells it\n * the whole library is loading, which is what the console and the besigner\n * ask for. The bundle is handed over once the load it returns has settled.\n */\n prepare?: string\n}\n\n/**\n * Every component this bundle can register (AGL-140, AGL-3141).\n *\n * One entry per component keeps register/unregister symmetric — the old\n * hand-maintained lists had drifted, and several components were never\n * unregistered on destroy. It replaces a single array built from sixty static\n * imports, which put every element on every published page while the page\n * rendered about nineteen of them.\n *\n * Exported so the bundle is assertable (AGL-1201): duplicate component or\n * preset ids collapse silently inside the registry's keyed records, so they\n * can only be caught before registration.\n */\nexport const MUI_COMPONENT_SOURCES: Readonly<\n Record<string, MuiComponentSource>\n> = {\n muiAppBar: {\n module: appBar,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiToolbar: {\n module: toolbar,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiTypography: {\n module: typography,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The inline text run (AGL-1235): Typography is `textEditable` and so a\n // leaf, which left no way to emphasize a phrase inside a sentence — every\n // statement rendered as one flat color.\n muiInlineText: {\n module: inlineText,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiButton: {\n module: button,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiContainer: {\n module: container,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n layoutSlot: {\n module: layoutSlot,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiList: {\n module: list,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiListItem: {\n module: listItem,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiListItemText: {\n module: listItemText,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // form, formField moved to @aglyn/plugins-forms (AGL-395).\n videoEmbed: {\n module: blocks,\n component: 'VideoEmbed',\n schema: 'videoEmbedSchema',\n presets: 'blockPresets',\n },\n socialLinks: {\n module: blocks,\n component: 'SocialLinks',\n schema: 'socialLinksSchema',\n },\n // A real data grid (AGL-2543): the feature matrix a comparison page is\n // built around, which the palette had no element for at all.\n dataTable: {\n module: dataTable,\n component: 'default',\n schema: 'dataTableSchema',\n presets: 'dataTablePresets',\n },\n // Content collections (AGL-551/582): entries repeater, markdown entry\n // body, related posts, share bar, entry meta.\n collectionEntries: {\n module: collectionEntries,\n component: 'CollectionEntries',\n schema: 'collectionEntriesSchema',\n presets: 'collectionPresets',\n prepare: 'prepareEntriesSearch',\n },\n collectionEntryBody: {\n module: collectionEntryBody,\n component: 'CollectionEntryBody',\n schema: 'collectionEntryBodySchema',\n },\n collectionRelated: {\n module: collectionRelated,\n component: 'CollectionRelated',\n schema: 'collectionRelatedSchema',\n },\n collectionShare: {\n module: collectionShare,\n component: 'CollectionShare',\n schema: 'collectionShareSchema',\n },\n collectionEntryMeta: {\n module: collectionEntryMeta,\n component: 'CollectionEntryMeta',\n schema: 'collectionEntryMetaSchema',\n },\n // The author card that closes an article (AGL-2486): the byline block\n // prints a name, and the record behind it also has a portrait and a bio.\n collectionEntryAuthor: {\n module: collectionEntryAuthor,\n component: 'CollectionEntryAuthor',\n schema: 'collectionEntryAuthorSchema',\n },\n // The subject of an author's own page (AGL-2518): the same person the\n // card above draws as a footnote, with the role fields it has no room for.\n contentAuthorProfile: {\n module: collectionAuthorProfile,\n component: 'ContentAuthorProfile',\n schema: 'contentAuthorProfileSchema',\n },\n // Category pills (AGL-1321): real anchors to /{collection}/category/{slug}.\n collectionCategories: {\n module: collectionCategories,\n component: 'CollectionCategories',\n schema: 'collectionCategoriesSchema',\n },\n // The toolbar search box (AGL-1516): the entries block's own field cannot\n // leave it, so the frame's pills-left / search-right row needs a block.\n collectionSearch: {\n module: collectionSearch,\n component: 'CollectionSearch',\n schema: 'collectionSearchSchema',\n },\n image: {\n module: image,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n video: {\n module: video,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n icon: {\n module: icon,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // booking moved to @aglyn/plugins-bookings (AGL-395).\n // eventList moved to @aglyn/plugins-events-calendar (AGL-313).\n languageSwitcher: {\n module: languageSwitcher,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n reusableInstance: {\n module: reusableInstance,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiScreenLink: {\n module: screenLink,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The linking container (AGL-1231): every other link element is a leaf,\n // so a tile whose icon and description also belong to the target had no\n // way to be authored.\n muiLinkBox: {\n module: linkBox,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Nav menu system (AGL-562): dropdown, mega menu, drawer + menu button.\n muiNavMenu: {\n module: navMenu,\n component: 'default',\n schema: 'navMenuSchema',\n presets: 'navMenuPresets',\n },\n muiMegaMenu: {\n module: navMenu,\n component: 'MegaMenu',\n schema: 'megaMenuSchema',\n },\n muiDrawer: {\n module: drawer,\n component: 'default',\n schema: 'drawerSchema',\n presets: 'drawerPresets',\n },\n muiDrawerToggle: {\n module: drawer,\n component: 'DrawerToggle',\n schema: 'drawerToggleSchema',\n },\n product: {\n module: product,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n marketplacePlugin: {\n module: plugin,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n 'custom-html': {\n module: customHtml,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n searchBox: {\n module: searchBox,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Long-form documents (AGL-1162): one markdown element carrying the whole\n // page, and an \"On this page\" aside derived from its headings.\n markdown: {\n module: markdown,\n component: 'Markdown',\n schema: 'markdownSchema',\n presets: 'markdownPresets',\n },\n tableOfContents: {\n module: markdown,\n component: 'TableOfContents',\n schema: 'tableOfContentsSchema',\n },\n section: {\n module: section,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiStack: {\n module: stack,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // Layout & surface primitives (AGL-1201).\n muiBox: {\n module: box,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n // The canvas ROOT (AGL-2486): registered so the Document layer has a\n // schema — an element picker — instead of falling through to the\n // renderer's unstyled div. No preset: it is not an element anybody drops.\n div: {\n module: documentRoot,\n component: 'default',\n schema: 'schema',\n },\n muiGrid: {\n module: grid,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiPaper: {\n module: paper,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiCard: {\n module: card,\n component: 'default',\n schema: 'cardSchema',\n presets: 'cardPresets',\n },\n muiCardHeader: {\n module: card,\n component: 'CardHeaderElement',\n schema: 'cardHeaderSchema',\n },\n muiCardContent: {\n module: card,\n component: 'CardContentElement',\n schema: 'cardContentSchema',\n },\n muiCardActions: {\n module: card,\n component: 'CardActionsElement',\n schema: 'cardActionsSchema',\n },\n muiAccordion: {\n module: accordion,\n component: 'default',\n schema: 'accordionSchema',\n presets: 'accordionPresets',\n },\n muiAccordionSummary: {\n module: accordion,\n component: 'AccordionSummaryElement',\n schema: 'accordionSummarySchema',\n },\n muiAccordionDetails: {\n module: accordion,\n component: 'AccordionDetailsElement',\n schema: 'accordionDetailsSchema',\n },\n muiTabs: {\n module: tabs,\n component: 'default',\n schema: 'tabsSchema',\n presets: 'tabsPresets',\n },\n muiTabPanel: {\n module: tabs,\n component: 'TabPanelElement',\n schema: 'tabPanelSchema',\n },\n muiImageList: {\n module: imageList,\n component: 'default',\n schema: 'imageListSchema',\n presets: 'imageListPresets',\n },\n muiImageListItem: {\n module: imageList,\n component: 'ImageListItemElement',\n schema: 'imageListItemSchema',\n },\n muiPagination: {\n module: pagination,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n muiBreadcrumbs: {\n module: breadcrumbs,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n themeModeSwitcher: {\n module: themeModeSwitcher,\n component: 'default',\n schema: 'schema',\n presets: 'presets',\n },\n}\n\n/**\n * The bundle entries for `componentIds` — every component when none are\n * named, which is what the console and the besigner ask for because their\n * palette shows every element.\n *\n * Both paths go through the same map, so there is one statement of where a\n * component comes from. An id the map does not know is dropped rather than\n * resolved to an undefined component: a page whose document carries an\n * element this bundle does not own is a document for another plugin's\n * element, not a reason to register a blank.\n */\nexport async function loadMuiBundle(\n componentIds?: readonly string[],\n): Promise<MuiBundleEntry[]> {\n const ids = (componentIds ?? Object.keys(MUI_COMPONENT_SOURCES)).filter(\n (id) => id in MUI_COMPONENT_SOURCES,\n )\n // Keyed on the THUNK, so a module that exports several elements is\n // imported once for all the ids that name it rather than once per id.\n const pending = new Map<\n MuiComponentSource['module'],\n Promise<Record<string, unknown>>\n >()\n const modules = await Promise.all(\n ids.map((id) => {\n const source = MUI_COMPONENT_SOURCES[id] as MuiComponentSource\n let load = pending.get(source.module)\n if (!load) {\n load = source.module()\n pending.set(source.module, load)\n }\n return load\n }),\n )\n // Each module's on-demand parts, once per module, before anything renders.\n const everything = componentIds === undefined\n const prepared = new Set<unknown>()\n await Promise.all(\n ids.map((id, index) => {\n const source = MUI_COMPONENT_SOURCES[id] as MuiComponentSource\n const mod = modules[index] as Record<string, unknown>\n if (!source.prepare || prepared.has(mod)) return undefined\n prepared.add(mod)\n const prepare = mod[source.prepare] as\n | ((everything: boolean) => Promise<unknown> | void)\n | undefined\n // A failed fetch is the render's to report, not the registration's:\n // the element asks again when it renders, and a block that still\n // cannot have it fails alone instead of taking the page with it.\n return Promise.resolve(prepare?.(everything)).catch(() => undefined)\n }),\n )\n return ids.map((id, index) => {\n const source = MUI_COMPONENT_SOURCES[id] as MuiComponentSource\n const mod = modules[index] as Record<string, unknown>\n return {\n component: mod[source.component],\n schema: mod[source.schema] as Aglyn.ComponentSchema<any>,\n ...(source.presets\n ? { presets: mod[source.presets] as Aglyn.PresetSchema[] }\n : {}),\n }\n })\n}\n\n/**\n * Every component registered so far, by id.\n *\n * A second page places elements the first did not, and reaches this bundle\n * again with them; the map is what tells the two apart, and what `load` and\n * `destroy` read so a reload registers everything asked for so far and\n * unregistration stays symmetric with registration.\n */\nconst registeredById = new Map<string, MuiBundleEntry>()\n\nfunction registerEntries(entries: readonly MuiBundleEntry[]): void {\n // One mobx transaction (AGL-371): a single observer notification\n // for the whole batch instead of one per component/preset.\n runInAction(() => {\n for (const entry of entries) {\n Aglyn.components.registerComponent(entry.component, entry.schema)\n }\n for (const entry of entries) {\n if (entry.presets?.length) {\n Aglyn.components.registerPreset(entry.presets)\n }\n }\n })\n}\n\n/**\n * Registers the core MUI component library with the `@aglyn/aglyn` global\n * plugin registry (`AglynNodeRenderer`, `Aglyn.canvas`, ...). This is the\n * platform's core component bundle; feature bundles (commerce,\n * events-calendar, email) declare a dependency on it.\n *\n * `use.componentIds` narrows it to the elements the surface places\n * (AGL-3116/AGL-3141), so a published page fetches those modules and no\n * others. A caller that names nothing gets the whole library, which is what\n * the console and the besigner need and what any surface that cannot say\n * what it places must be given: an element whose component never registered\n * renders NOTHING, silently (AGL-52).\n */\nexport async function registerMuiPlugin(use?: Aglyn.PluginUse): Promise<void> {\n // Install→preset mapper (AGL-419): the console's drawer registration\n // consumes it through core, never importing this plugin.\n registerPluginInstallPresetMapper(muiPluginInstallToPreset)\n // Declared canvas elements become their own palette entries (AGL-1031).\n registerPluginInstallPresetsMapper(muiPluginInstallToPresets)\n\n const wanted = (use?.componentIds ?? Object.keys(MUI_COMPONENT_SOURCES))\n .filter((id) => id in MUI_COMPONENT_SOURCES)\n .filter((id) => !registeredById.has(id))\n const existing = Aglyn.plugins.getDependency(BUNDLE_ID)\n if (existing && !wanted.length) return\n\n const entries = wanted.length ? await loadMuiBundle(wanted) : []\n for (const entry of entries) {\n registeredById.set(entry.schema.$id as string, entry)\n }\n\n // The dependency is added even when this page places nothing of it: a\n // feature bundle declares mui as a dependency and stays WAITING — its own\n // components never registering — until mui is in the manager.\n //\n // Re-read after the imports rather than trusting the check above: the\n // manager runs `load()` from `addDependency` synchronously, so the first\n // caller to get here creates the dependency and every later one takes the\n // branch that registers what it added into a bundle already LOADED.\n if (Aglyn.plugins.getDependency(BUNDLE_ID)) {\n if (entries.length) registerEntries(entries)\n return\n }\n\n Aglyn.plugins.addDependency({\n $id: BUNDLE_ID,\n displayName: 'Material UI',\n description: 'Material UI elements',\n title: 'Material UI',\n dependencies: {},\n load(): void {\n registerEntries([...registeredById.values()])\n },\n destroy(): void {\n const entries = [...registeredById.values()]\n runInAction(() => {\n for (const entry of entries) {\n if (entry.presets?.length) {\n Aglyn.components.unregisterPreset(\n entry.presets.map((preset) => preset.$id),\n )\n }\n }\n for (const entry of entries) {\n Aglyn.components.unregisterComponent(entry.schema.$id)\n }\n })\n },\n })\n}\n"],"names":["registerPluginInstallPresetMapper","registerPluginInstallPresetsMapper","muiPluginInstallToPreset","muiPluginInstallToPresets","Aglyn","runInAction","BUNDLE_ID","tierLoad","elementTier","inTier","name","then","tier","CORE_ELEMENTS","viaTier","appBar","toolbar","layoutSlot","documentRoot","section","container","box","stack","grid","paper","typography","inlineText","button","screenLink","linkBox","image","icon","list","listItem","listItemText","blocks","dataTable","collectionEntries","collectionEntryBody","collectionRelated","collectionShare","collectionEntryMeta","collectionEntryAuthor","collectionAuthorProfile","collectionCategories","collectionSearch","video","languageSwitcher","reusableInstance","navMenu","drawer","product","plugin","customHtml","searchBox","markdown","card","accordion","tabs","imageList","pagination","breadcrumbs","themeModeSwitcher","MUI_COMPONENT_SOURCES","muiAppBar","module","component","schema","presets","muiToolbar","muiTypography","muiInlineText","muiButton","muiContainer","muiList","muiListItem","muiListItemText","videoEmbed","socialLinks","prepare","contentAuthorProfile","muiScreenLink","muiLinkBox","muiNavMenu","muiMegaMenu","muiDrawer","muiDrawerToggle","marketplacePlugin","tableOfContents","muiStack","muiBox","div","muiGrid","muiPaper","muiCard","muiCardHeader","muiCardContent","muiCardActions","muiAccordion","muiAccordionSummary","muiAccordionDetails","muiTabs","muiTabPanel","muiImageList","muiImageListItem","muiPagination","muiBreadcrumbs","loadMuiBundle","componentIds","ids","Object","keys","filter","id","pending","Map","modules","Promise","all","map","source","load","get","set","everything","undefined","prepared","Set","index","mod","has","add","resolve","catch","registeredById","registerEntries","entries","entry","components","registerComponent","length","registerPreset","registerMuiPlugin","use","wanted","existing","plugins","getDependency","$id","addDependency","displayName","description","title","dependencies","values","destroy","unregisterPreset","preset","unregisterComponent"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iCAAiC,EACjCC,kCAAkC,QAC7B,eAAc;AACrB,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,yCAAqC;AAC5C,YAAYC,WAAW,eAAc;AACrC,SAASC,WAAW,QAAQ,OAAM;AAClC,SAASC,SAAS,QAAQ,+BAA2B;AAkBrD;;;;;;;CAOC,GACD,IAAIC;AACJ,MAAMC,cAAc,IACjBD,mBAAAA,WAAAA,WAAa,MAAM,CAAC;AACvB,MAAME,SACJ,CAACC,OACD,IACEF,cAAcG,IAAI,CAChB,CAACC,OAAkCA,KAAKC,aAAa,CAACH,KAAK;AAEjE,MAAMI,UACJ,CAACJ,OACD,IACEF,cAAcG,IAAI,CAAC,CAACC,OAAwBA,IAAI,CAACF,KAAK;AAE1D,MAAMK,SAASN,OAAO;AACtB,MAAMO,UAAUP,OAAO;AACvB,MAAMQ,aAAaR,OAAO;AAC1B,MAAMS,eAAeT,OAAO;AAC5B,MAAMU,UAAUV,OAAO;AACvB,MAAMW,YAAYX,OAAO;AACzB,MAAMY,MAAMZ,OAAO;AACnB,MAAMa,QAAQb,OAAO;AACrB,MAAMc,OAAOd,OAAO;AACpB,MAAMe,QAAQf,OAAO;AACrB,MAAMgB,aAAahB,OAAO;AAC1B,MAAMiB,aAAajB,OAAO;AAC1B,MAAMkB,SAASlB,OAAO;AACtB,MAAMmB,aAAanB,OAAO;AAC1B,MAAMoB,UAAUpB,OAAO;AACvB,MAAMqB,QAAQrB,OAAO;AACrB,MAAMsB,OAAOtB,OAAO;AAEpB,MAAMuB,OAAOlB,QAAQ;AACrB,MAAMmB,WAAWnB,QAAQ;AACzB,MAAMoB,eAAepB,QAAQ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,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
/**
|
|
19
|
+
* The Image element's `sizes` attribute (AGL-3485): how wide the browser
|
|
20
|
+
* should assume the picture will be, which decides the `srcset` candidate it
|
|
21
|
+
* downloads.
|
|
22
|
+
*
|
|
23
|
+
* Every image used to say `100vw`, so a 68px navbar logo and a 302px card
|
|
24
|
+
* picture both fetched a 1280px or 1920px variant. The answer is now decided
|
|
25
|
+
* in this order, first answer wins:
|
|
26
|
+
*
|
|
27
|
+
* 1. **The author's own Sizes attribute**, verbatim. An escape hatch for
|
|
28
|
+
* someone who knows the attribute; nobody needs to touch it.
|
|
29
|
+
* 2. **Per breakpoint band, a pixel width the element itself states**: a
|
|
30
|
+
* pixel `width` (`'320px'`, or a plain number in `sx`, which MUI reads as
|
|
31
|
+
* pixels), or a pixel `height` under `width: auto` at the asset's known
|
|
32
|
+
* shape. Responsive values are read per band, so the header logo's
|
|
33
|
+
* `height: { xs: 44, md: 56 }` is a 54px slot on a phone and a 68px one
|
|
34
|
+
* from `md` up.
|
|
35
|
+
* 3. **Per band, the width the Besigner MEASURED** when the page was saved.
|
|
36
|
+
* 4. **Per band, the slot the layout around the image states**
|
|
37
|
+
* ({@link layoutBandWidths}): Grid spans, `repeat(n, 1fr)` grids, widths
|
|
38
|
+
* and max widths, and the Container that caps the page.
|
|
39
|
+
* 5. For a band nothing describes, the next narrower band's answer, and
|
|
40
|
+
* `100vw` only for the narrowest band when nothing at all is known.
|
|
41
|
+
*
|
|
42
|
+
* Steps 2 and 4 are computed from the node tree the page renders, so they hold
|
|
43
|
+
* for every page already published — on the server, with no re-save. The
|
|
44
|
+
* measurement only refines what the layout cannot state.
|
|
45
|
+
*
|
|
46
|
+
* ## Why this does not bring back the AGL-2486 layout break
|
|
47
|
+
*
|
|
48
|
+
* `sizes` is not only a delivery hint: with `w` descriptors it is the image's
|
|
49
|
+
* intrinsic width, which is what `width: 100%` resolves against inside a
|
|
50
|
+
* shrink-to-fit parent. `sizes="auto"` broke fluid images because it is
|
|
51
|
+
* circular there (300px default object size). Every answer above is a real
|
|
52
|
+
* width of the slot the image fills: a definite length, a share of a parent of
|
|
53
|
+
* definite width, or a measurement of the very layout being described —
|
|
54
|
+
* which is a fixed point, since an image whose intrinsic width is its
|
|
55
|
+
* measured width lays out at its measured width.
|
|
56
|
+
*/
|
|
57
|
+
export interface ImageSizesInput {
|
|
58
|
+
/** The author's Sizes attribute. */
|
|
59
|
+
sizes?: unknown;
|
|
60
|
+
/** The element's `width` attribute, as the author set it. */
|
|
61
|
+
width?: unknown;
|
|
62
|
+
/** The element's `height` attribute, as the author set it. */
|
|
63
|
+
height?: unknown;
|
|
64
|
+
/**
|
|
65
|
+
* The node's own styles. Their `width` and `height` win over the
|
|
66
|
+
* attributes, as they do in the render (`sx` is composed after the
|
|
67
|
+
* defaults the attributes set).
|
|
68
|
+
*/
|
|
69
|
+
sx?: unknown;
|
|
70
|
+
intrinsicWidth?: unknown;
|
|
71
|
+
intrinsicHeight?: unknown;
|
|
72
|
+
/** What the Besigner measured, as the save stored it. */
|
|
73
|
+
renderedWidths?: unknown;
|
|
74
|
+
/** What the layout around the image states, per band. */
|
|
75
|
+
layoutWidths?: LayoutWidths;
|
|
76
|
+
}
|
|
77
|
+
export interface ImageSizes {
|
|
78
|
+
sizes: string;
|
|
79
|
+
/**
|
|
80
|
+
* The evidence says the image renders small everywhere it is known: a
|
|
81
|
+
* pixel width of {@link SMALL_IMAGE_MAX_PX} or less, or under
|
|
82
|
+
* {@link SMALL_IMAGE_MAX_PERCENT} of the page, in every band that was
|
|
83
|
+
* stated, measured or derived. A lead image that is small is a logo or an
|
|
84
|
+
* icon, not the page's largest paint, and gets no `fetchpriority="high"`.
|
|
85
|
+
*/
|
|
86
|
+
small: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** At or under this many pixels wide an image is not a hero. */
|
|
89
|
+
export declare const SMALL_IMAGE_MAX_PX = 240;
|
|
90
|
+
/** Under this share of the page in every known band, an image is not a hero. */
|
|
91
|
+
export declare const SMALL_IMAGE_MAX_PERCENT = 40;
|
|
92
|
+
type Band = Aglyn.RenderedWidthBand;
|
|
93
|
+
type BandValues<T> = Partial<Record<Band, T>>;
|
|
94
|
+
/**
|
|
95
|
+
* One slot the layout states for a band: a share of the viewport less the
|
|
96
|
+
* gutters and gaps taken out of it, and the pixel width it can never exceed
|
|
97
|
+
* when something above it caps the page — `min(vw% - offset, cap)`.
|
|
98
|
+
*/
|
|
99
|
+
export interface LayoutSlot {
|
|
100
|
+
vw: number;
|
|
101
|
+
offsetPx?: number;
|
|
102
|
+
capPx?: number;
|
|
103
|
+
}
|
|
104
|
+
export type LayoutWidths = BandValues<LayoutSlot>;
|
|
105
|
+
/** The `sizes` an Image element should carry. See the module note. */
|
|
106
|
+
export declare function imageSizes(input: ImageSizesInput): ImageSizes;
|
|
107
|
+
/** A node as the canvas holds it, as far as this walk reads it. */
|
|
108
|
+
export interface LayoutNode {
|
|
109
|
+
componentId?: string;
|
|
110
|
+
props?: Record<string, unknown>;
|
|
111
|
+
resolvedProps?: Record<string, unknown>;
|
|
112
|
+
sx?: unknown;
|
|
113
|
+
parent?: LayoutNode | undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The slot the layout around an image gives it, per band, from what the
|
|
117
|
+
* layout STATES rather than what anyone measured — computed from the node
|
|
118
|
+
* tree a page renders, so a published page has it on the server with nothing
|
|
119
|
+
* re-saved. Walking up from the image:
|
|
120
|
+
*
|
|
121
|
+
* - every **Grid cell** it sits in takes its responsive span of its row's
|
|
122
|
+
* columns (`xs:12 md:4` is a third from `md` up), less its share of the
|
|
123
|
+
* row's spacing;
|
|
124
|
+
* - every **CSS grid** of equal tracks (`repeat(3, 1fr)`, per breakpoint)
|
|
125
|
+
* gives each child one track, or the tracks its `gridColumn` spans, less
|
|
126
|
+
* its share of the gap;
|
|
127
|
+
* - every **width or max width** given as a share of the parent shrinks the
|
|
128
|
+
* slot by it, and one given in pixels caps it;
|
|
129
|
+
* - every **Container** takes its gutters off and caps it at its max width.
|
|
130
|
+
*
|
|
131
|
+
* Each step maps the parent's width to the child's as `share × parent −
|
|
132
|
+
* offset`, so they compose: a third of a half is a sixth, and a gap inside a
|
|
133
|
+
* capped Container is still a gap. The answer per band is `min(vw% − offset,
|
|
134
|
+
* cap)`. A band is answered only when something stated it and nothing between
|
|
135
|
+
* the image and the page made it unknowable — an `auto` or `grow` Grid cell is
|
|
136
|
+
* sized by its content, so a band where any cell is one has no answer here.
|
|
137
|
+
* Theme spacing is taken at MUI's 8px, and anything this does not model
|
|
138
|
+
* (padding on an ordinary Box, a flex row) is left in, so a guess errs wide:
|
|
139
|
+
* a slightly larger candidate, never a blurry one.
|
|
140
|
+
*
|
|
141
|
+
* The same function serves the Besigner canvas and the published render; the
|
|
142
|
+
* tree differs only in that the canvas has not grafted reusable components or
|
|
143
|
+
* expanded repeats, which the measurement covers there.
|
|
144
|
+
*/
|
|
145
|
+
export declare function layoutBandWidths(node: LayoutNode | undefined): LayoutWidths;
|
|
146
|
+
export {};
|