@aglyn/plugins-mui 1.20.3 → 1.22.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 +10 -10
- package/src/lib/components/collection-entries-search.d.ts +2 -1
- package/src/lib/components/collection-entries-search.js +9 -1
- package/src/lib/components/collection-entries-search.js.map +1 -1
- package/src/lib/components/collection-entries.d.ts +2 -5
- package/src/lib/components/collection-entries.js +9 -5
- package/src/lib/components/collection-entries.js.map +1 -1
- package/src/lib/components/collection-search-load.d.ts +48 -0
- package/src/lib/components/collection-search-load.js +52 -0
- package/src/lib/components/collection-search-load.js.map +1 -0
- package/src/lib/components/form-controls.js +12 -7
- package/src/lib/components/form-controls.js.map +1 -1
- package/src/lib/components/markdown.d.ts +2 -2
- package/src/lib/element-tier.d.ts +1 -1
- package/src/lib/element-tier.js +7 -1
- package/src/lib/element-tier.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.22.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
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.
|
|
34
|
-
"@swc/helpers": "0.5.
|
|
28
|
+
"@aglyn/aglyn": "1.22.0",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.22.0",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.22.0",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.22.0",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.22.0",
|
|
33
|
+
"@aglyn/shared-util-vendor": "1.22.0",
|
|
34
|
+
"@swc/helpers": "0.5.24",
|
|
35
35
|
"dayjs": "^1.11.23",
|
|
36
|
-
"mobx": "^7.
|
|
37
|
-
"mobx-react-lite": "^5.1.
|
|
36
|
+
"mobx": "^7.1.6",
|
|
37
|
+
"mobx-react-lite": "^5.1.2"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@mui/material": "^9.3.1",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import type { CollectionEntriesProps } from './collection-entries';
|
|
18
|
+
export { CollectionSearch, collectionSearchSchema, SEARCH_ID, type CollectionSearchProps, } from './collection-search';
|
|
18
19
|
/**
|
|
19
20
|
* Search (AGL-1516): a toolbar search box filters the rendered entry clones
|
|
20
21
|
* client-side against the server-stamped `searchIndex` — fuzzy, via the same
|
|
@@ -23,8 +23,12 @@ import { Children, forwardRef, useContext, useState } from "react";
|
|
|
23
23
|
// One coercion for every authored count in this bundle (AGL-1457) — number
|
|
24
24
|
// fields round-trip as strings, and a second parser here would drift.
|
|
25
25
|
import { toCount } from "../utils/to-count.js";
|
|
26
|
-
import { ENTRIES_SEARCH_ATTRIBUTE } from "./collection-entries.js";
|
|
27
26
|
import { SearchField, SuggestSearchBox, useEntryFuse } from "./collection-search-box.js";
|
|
27
|
+
import { ENTRIES_SEARCH_ATTRIBUTE } from "./collection-search-load.js";
|
|
28
|
+
// The standalone Collection Search block rides in this module too, so the two
|
|
29
|
+
// elements that draw the search box share one chunk group and download it once
|
|
30
|
+
// (AGL-4220): `collection-search-load.ts` says why.
|
|
31
|
+
export { CollectionSearch, collectionSearchSchema, SEARCH_ID } from "./collection-search.js";
|
|
28
32
|
/**
|
|
29
33
|
* The Collection Entries block with its search box on (AGL-1516, AGL-1525).
|
|
30
34
|
*
|
|
@@ -33,6 +37,10 @@ import { SearchField, SuggestSearchBox, useEntryFuse } from "./collection-search
|
|
|
33
37
|
* entries block otherwise has no use for, and most blocks — aglyn.com/press's
|
|
34
38
|
* among them — never turn search on. `collection-entries.tsx` renders the
|
|
35
39
|
* plain block itself and reaches for this one through `loadEntriesSearch`.
|
|
40
|
+
*
|
|
41
|
+
* The standalone Collection Search block is re-exported here, and the element
|
|
42
|
+
* tier loads it from this module: both draw the same box, and one module is
|
|
43
|
+
* what keeps a page placing both from downloading it twice (AGL-4220).
|
|
36
44
|
*/ /**
|
|
37
45
|
* How much of the collection an entries block's search could actually see
|
|
38
46
|
* (AGL-1516, AGL-2569) — `truncated` says the rendered window is smaller
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/collection-entries-search.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 MuiStack from '@mui/material/Stack'\nimport Typography from '@mui/material/Typography'\nimport type { ReactNode } from 'react'\nimport { Children, forwardRef, useContext, useState } from 'react'\n// One coercion for every authored count in this bundle (AGL-1457) — number\n// fields round-trip as strings, and a second parser here would drift.\nimport { toCount } from '../utils/to-count'\nimport {\n ENTRIES_SEARCH_ATTRIBUTE,\n type CollectionEntriesProps,\n type CollectionSearchMode,\n} from './collection-entries'\nimport {\n SearchField,\n SuggestSearchBox,\n useEntryFuse,\n} from './collection-search-box'\n\n/**\n * The Collection Entries block with its search box on (AGL-1516, AGL-1525).\n *\n * Its own module, loaded only by a block whose `search` is on (AGL-3438): the\n * box draws MUI's InputBase, TextareaAutosize and Chip, about 22 KB the\n * entries block otherwise has no use for, and most blocks — aglyn.com/press's\n * among them — never turn search on. `collection-entries.tsx` renders the\n * plain block itself and reaches for this one through `loadEntriesSearch`.\n */\n\n/**\n * How much of the collection an entries block's search could actually see\n * (AGL-1516, AGL-2569) — `truncated` says the rendered window is smaller\n * than the set, `paginated` says the missing part lives on other pages of\n * this same list rather than merely outside the block.\n *\n * The test is whether the window is SMALLER THAN THE SET, which only the\n * server knows — `perPage` is the wrong proxy for it in both directions. A\n * block truncated by `entriesLimit` or by the 100-entry cap has no `perPage`\n * at all and would claim a global miss over 6 of 40 posts; a block whose\n * `perPage` exceeds its entry count is a single complete page and would\n * blame pages that do not exist. `searchTotal` is stamped with `searchIndex`,\n * so the two are always in step.\n *\n * Absent — a page cached before that stamp shipped — falls back to the old\n * `perPage` reading rather than guessing \"complete\": understating the scope\n * of a search is the safe direction to be wrong in.\n *\n * `searchCapped` is the second way a block can fail to hold the set, and the\n * invisible one: `searchTotal` counts the entries the server READ, and that\n * read is bounded. Past the bound `shown === searchTotal` is satisfied by a\n * block holding 100 of 400 posts, and the wording that claims to have looked\n * everywhere is exactly the branch it would take.\n *\n * Both the miss and the hit disclose off this one answer, so the two can\n * never disagree about the same block.\n */\nconst searchScope = ({\n perPage,\n shown,\n searchTotal,\n searchCapped,\n}: {\n perPage?: CollectionEntriesProps['perPage']\n /** Entries this block searched — the length of its stamped index. */\n shown: number\n searchTotal?: number\n searchCapped?: boolean\n}): { paginated: boolean; truncated: boolean } => {\n const paginated = (toCount(perPage, 0) ?? 0) > 0\n return {\n paginated,\n truncated:\n typeof searchTotal === 'number'\n ? shown < searchTotal || Boolean(searchCapped)\n : paginated || Boolean(searchCapped),\n }\n}\n\n/**\n * Search (AGL-1516): a toolbar search box filters the rendered entry clones\n * client-side against the server-stamped `searchIndex` — fuzzy, via the same\n * Fuse the icon picker uses. The clones arrive as `children` in stamp order,\n * one group of template roots per entry, so group N of the children IS entry\n * N of the index. Matches keep the list's own order rather than Fuse's score\n * order: a blog list is chronological, and search narrows it, it does not\n * reshuffle it. In the besigner the field renders as an inert affordance (the\n * template renders once with literal tokens and there is no index to search),\n * matching how Category Pills go inert on editing surfaces.\n */\nexport const SearchingEntries = forwardRef<\n HTMLDivElement,\n CollectionEntriesProps\n>(\n // collectionSlug/entriesLimit/filter*/search* are compose-time or\n // search-only attributes: strip so they never hit the DOM.\n (\n {\n collectionSlug,\n entriesLimit,\n filterCategory,\n filterTag,\n perPage,\n page,\n firstPageOnly,\n search,\n searchMode,\n searchPlaceholder,\n searchIndex,\n searchTotal,\n searchCapped,\n children,\n ...props\n },\n ref,\n ) => {\n const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext)\n const items = searchIndex\n /** `filter` mode only — `suggest` owns its own query (AGL-1516). */\n const [query, setQuery] = useState('')\n const { fuzzy, requestFuzzy } = useEntryFuse(items)\n const childArray = Children.toArray(children)\n // Template roots per entry. Every entry clones the same template, so the\n // children divide evenly; anything else means the children are not the\n // stamped clones, and filtering blind would hide the wrong cards —\n // fail open and render everything.\n const groupSize =\n items?.length && childArray.length % items.length === 0\n ? childArray.length / items.length\n : 0\n // `suggest` draws its rows from the INDEX and never touches the clones,\n // so the clone-alignment precondition is a `filter` precondition only.\n // A block whose children do not divide evenly still suggests correctly;\n // requiring `groupSize` here would silently kill the panel on exactly\n // the templates that made the fail-open necessary.\n const mode: CollectionSearchMode =\n searchMode === 'suggest' ? 'suggest' : 'filter'\n // Whether there is an index to search, NOT whether the matcher has loaded:\n // the field has to be there for the keystroke that loads it.\n const live =\n !suppressNavigation &&\n Boolean(items?.length) &&\n (mode === 'suggest' || groupSize > 0)\n const trimmed = query.trim()\n let visible: ReactNode[] | ReactNode = children\n /**\n * The one line under the results that says what the search covered —\n * either a miss scoped to the set that came back empty, or a hit scoped\n * to the window it was drawn from. Never both.\n */\n let scopeNote: ReactNode = null\n if (mode === 'suggest') {\n // The grid is deliberately untouched (Figma 496:1218): the panel is an\n // overlay on a page the reader is still reading, not a filter.\n visible = children\n } else if (live && trimmed && fuzzy) {\n const matched = new Set(\n fuzzy.search(trimmed).map((result) => result.refIndex),\n )\n visible = childArray.filter((_, index) =>\n matched.has(Math.floor(index / groupSize)),\n )\n // HONEST scope (AGL-1516, AGL-2569): this block holds whatever window\n // the expansion gave it, and pretending the search was global would\n // turn every miss into a false \"this post does not exist\" — and every\n // hit into a result set that looks like the whole answer.\n const shown = items?.length ?? 0\n const { paginated, truncated } = searchScope({\n perPage,\n shown,\n searchTotal,\n searchCapped,\n })\n if (!(visible as ReactNode[]).length) {\n scopeNote = (\n <Typography variant=\"body2\" sx={{ color: 'text.secondary' }}>\n {!truncated\n ? `No matches for “${trimmed}”.`\n : paginated\n ? `No matches for “${trimmed}” on this page — other pages ` +\n 'are not searched.'\n : `No matches for “${trimmed}” in the ${shown} entries ` +\n 'shown here — the rest of the collection is not searched.'}\n </Typography>\n )\n } else if (truncated) {\n // The hit half of the same honesty (AGL-2569). Matches are drawn from\n // the same window the miss apologizes for, they carry no pager of\n // their own, and nothing else on screen says the pages behind this\n // one went unread — so a list that happens to be partial reads as\n // complete. A block that holds the whole collection says nothing\n // here: a disclaimer on a complete answer is noise, and every small\n // site would carry it.\n //\n // No route out to `/search?q=` (AGL-88): the suggestion panel links\n // there because it is the panel's only possible answer, but this\n // mode has a working list under the field and that page does not\n // exist yet. Trading a silent partial answer for a dead link is not\n // the trade.\n scopeNote = (\n <Typography variant=\"body2\" sx={{ color: 'text.secondary' }}>\n {paginated\n ? 'Showing matches on this page — other pages are not searched.'\n : `Showing matches in the ${shown} entries here — the rest of ` +\n 'the collection is not searched.'}\n </Typography>\n )\n }\n }\n // The field renders when there is something to search, and as an inert\n // affordance on editing surfaces so the author sees what they enabled.\n // A live surface with nothing stamped (unknown collection, zero entries)\n // renders no field at all — a search box over nothing is a lie.\n const showField = suppressNavigation || live\n const field = !showField ? null : mode === 'suggest' ? (\n // Rows in Fuse's SCORE order, the opposite of what `filter` does and\n // deliberately: filtering narrows a chronological feed, so reshuffling\n // it would be a second, unasked-for change to what the reader is\n // looking at. A suggestion list is not a feed — it is an answer to a\n // question, and the best answer belongs first.\n <SuggestSearchBox\n fuzzy={fuzzy}\n requestFuzzy={requestFuzzy}\n {...(items ? { items } : {})}\n {...(searchPlaceholder === undefined\n ? {}\n : { placeholder: searchPlaceholder })}\n {...(suppressNavigation ? { inert: true } : {})}\n // This block searched the entries IT rendered — a page window, an\n // `entriesLimit` slice, or a bounded read. Never \"this collection\".\n emptyText={(text) => `No matches for “${text}” on this page.`}\n />\n ) : (\n <SearchField\n value={query}\n landmark\n {...(searchPlaceholder === undefined ? {} : { placeholder: searchPlaceholder })}\n {...(suppressNavigation ? { inert: true } : {})}\n onQuery={(next) => {\n requestFuzzy()\n setQuery(next)\n }}\n />\n )\n return (\n <MuiStack\n ref={ref}\n spacing={4}\n {...props}\n // What the browser looks for before it hydrates the page, so this\n // module is fetched alongside the element rather than after it\n // (`prepareEntriesSearch`).\n {...{ [ENTRIES_SEARCH_ATTRIBUTE]: '' }}\n >\n {field}\n {visible}\n {scopeNote}\n </MuiStack>\n )\n },\n)\nSearchingEntries.displayName = 'AglynCollectionEntriesSearch'\n"],"names":["Aglyn","MuiStack","Typography","Children","forwardRef","useContext","useState","toCount","ENTRIES_SEARCH_ATTRIBUTE","SearchField","SuggestSearchBox","useEntryFuse","searchScope","perPage","shown","searchTotal","searchCapped","paginated","truncated","Boolean","SearchingEntries","collectionSlug","entriesLimit","filterCategory","filterTag","page","firstPageOnly","search","searchMode","searchPlaceholder","searchIndex","children","props","ref","suppressNavigation","ScreenLinkContext","items","query","setQuery","fuzzy","requestFuzzy","childArray","toArray","groupSize","length","mode","live","trimmed","trim","visible","scopeNote","matched","Set","map","result","refIndex","filter","_","index","has","Math","floor","variant","sx","color","showField","field","undefined","placeholder","inert","emptyText","text","value","landmark","onQuery","next","spacing","displayName"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,OAAOC,cAAc,sBAAqB;AAC1C,OAAOC,gBAAgB,2BAA0B;AAEjD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAClE,2EAA2E;AAC3E,sEAAsE;AACtE,SAASC,OAAO,QAAQ,uBAAmB;AAC3C,SACEC,wBAAwB,QAGnB,0BAAsB;AAC7B,SACEC,WAAW,EACXC,gBAAgB,EAChBC,YAAY,QACP,6BAAyB;AAEhC;;;;;;;;CAQC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,MAAMC,cAAc,CAAC,EACnBC,OAAO,EACPC,KAAK,EACLC,WAAW,EACXC,YAAY,EAOb;QACoBT;IAAnB,MAAMU,YAAY,EAACV,WAAAA,QAAQM,SAAS,cAAjBN,WAAuB,KAAK;IAC/C,OAAO;QACLU;QACAC,WACE,OAAOH,gBAAgB,WACnBD,QAAQC,eAAeI,QAAQH,gBAC/BC,aAAaE,QAAQH;IAC7B;AACF;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAMI,iCAAmBhB,WAI9B,kEAAkE;AAClE,2DAA2D;AAC3D;;;;iCACE,EACEiB,cAAc,EACdC,YAAY,EACZC,cAAc,EACdC,SAAS,EACTX,OAAO,EACPY,IAAI,EACJC,aAAa,EACbC,MAAM,EACNC,UAAU,EACVC,iBAAiB,EACjBC,WAAW,EACXf,WAAW,EACXC,YAAY,EACZe,QAAQ,EAET,UADIC;;;;;;;;;;;;;;;SAELC;IAEA,MAAM,EAAEC,kBAAkB,EAAE,GAAG7B,WAAWL,MAAMmC,iBAAiB;IACjE,MAAMC,QAAQN;IACd,kEAAkE,GAClE,MAAM,CAACO,OAAOC,SAAS,GAAGhC,SAAS;IACnC,MAAM,EAAEiC,KAAK,EAAEC,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AC7CK,SAAS,CAACC;YACRnC;YACAF,SAASqC;QACX;;IAGJ,qBACE,MAAC1E;QACCgC,KAAKA;QACL2C,SAAS;OACL5C;QAIE,CAACxB,yBAAyB,EAAE;;YAEjC0D;YACAjB;YACAC;;;AAGP,GACD;AACD9B,iBAAiByD,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/collection-entries-search.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 MuiStack from '@mui/material/Stack'\nimport Typography from '@mui/material/Typography'\nimport type { ReactNode } from 'react'\nimport { Children, forwardRef, useContext, useState } from 'react'\n// One coercion for every authored count in this bundle (AGL-1457) — number\n// fields round-trip as strings, and a second parser here would drift.\nimport { toCount } from '../utils/to-count'\n// Types only: a value import of the plain block would copy it, and its\n// presets, into this chunk, whose parent is the element tier (AGL-4220).\nimport type {\n CollectionEntriesProps,\n CollectionSearchMode,\n} from './collection-entries'\nimport {\n SearchField,\n SuggestSearchBox,\n useEntryFuse,\n} from './collection-search-box'\nimport { ENTRIES_SEARCH_ATTRIBUTE } from './collection-search-load'\n\n// The standalone Collection Search block rides in this module too, so the two\n// elements that draw the search box share one chunk group and download it once\n// (AGL-4220): `collection-search-load.ts` says why.\nexport {\n CollectionSearch,\n collectionSearchSchema,\n SEARCH_ID,\n type CollectionSearchProps,\n} from './collection-search'\n\n/**\n * The Collection Entries block with its search box on (AGL-1516, AGL-1525).\n *\n * Its own module, loaded only by a block whose `search` is on (AGL-3438): the\n * box draws MUI's InputBase, TextareaAutosize and Chip, about 22 KB the\n * entries block otherwise has no use for, and most blocks — aglyn.com/press's\n * among them — never turn search on. `collection-entries.tsx` renders the\n * plain block itself and reaches for this one through `loadEntriesSearch`.\n *\n * The standalone Collection Search block is re-exported here, and the element\n * tier loads it from this module: both draw the same box, and one module is\n * what keeps a page placing both from downloading it twice (AGL-4220).\n */\n\n/**\n * How much of the collection an entries block's search could actually see\n * (AGL-1516, AGL-2569) — `truncated` says the rendered window is smaller\n * than the set, `paginated` says the missing part lives on other pages of\n * this same list rather than merely outside the block.\n *\n * The test is whether the window is SMALLER THAN THE SET, which only the\n * server knows — `perPage` is the wrong proxy for it in both directions. A\n * block truncated by `entriesLimit` or by the 100-entry cap has no `perPage`\n * at all and would claim a global miss over 6 of 40 posts; a block whose\n * `perPage` exceeds its entry count is a single complete page and would\n * blame pages that do not exist. `searchTotal` is stamped with `searchIndex`,\n * so the two are always in step.\n *\n * Absent — a page cached before that stamp shipped — falls back to the old\n * `perPage` reading rather than guessing \"complete\": understating the scope\n * of a search is the safe direction to be wrong in.\n *\n * `searchCapped` is the second way a block can fail to hold the set, and the\n * invisible one: `searchTotal` counts the entries the server READ, and that\n * read is bounded. Past the bound `shown === searchTotal` is satisfied by a\n * block holding 100 of 400 posts, and the wording that claims to have looked\n * everywhere is exactly the branch it would take.\n *\n * Both the miss and the hit disclose off this one answer, so the two can\n * never disagree about the same block.\n */\nconst searchScope = ({\n perPage,\n shown,\n searchTotal,\n searchCapped,\n}: {\n perPage?: CollectionEntriesProps['perPage']\n /** Entries this block searched — the length of its stamped index. */\n shown: number\n searchTotal?: number\n searchCapped?: boolean\n}): { paginated: boolean; truncated: boolean } => {\n const paginated = (toCount(perPage, 0) ?? 0) > 0\n return {\n paginated,\n truncated:\n typeof searchTotal === 'number'\n ? shown < searchTotal || Boolean(searchCapped)\n : paginated || Boolean(searchCapped),\n }\n}\n\n/**\n * Search (AGL-1516): a toolbar search box filters the rendered entry clones\n * client-side against the server-stamped `searchIndex` — fuzzy, via the same\n * Fuse the icon picker uses. The clones arrive as `children` in stamp order,\n * one group of template roots per entry, so group N of the children IS entry\n * N of the index. Matches keep the list's own order rather than Fuse's score\n * order: a blog list is chronological, and search narrows it, it does not\n * reshuffle it. In the besigner the field renders as an inert affordance (the\n * template renders once with literal tokens and there is no index to search),\n * matching how Category Pills go inert on editing surfaces.\n */\nexport const SearchingEntries = forwardRef<\n HTMLDivElement,\n CollectionEntriesProps\n>(\n // collectionSlug/entriesLimit/filter*/search* are compose-time or\n // search-only attributes: strip so they never hit the DOM.\n (\n {\n collectionSlug,\n entriesLimit,\n filterCategory,\n filterTag,\n perPage,\n page,\n firstPageOnly,\n search,\n searchMode,\n searchPlaceholder,\n searchIndex,\n searchTotal,\n searchCapped,\n children,\n ...props\n },\n ref,\n ) => {\n const { suppressNavigation } = useContext(Aglyn.ScreenLinkContext)\n const items = searchIndex\n /** `filter` mode only — `suggest` owns its own query (AGL-1516). */\n const [query, setQuery] = useState('')\n const { fuzzy, requestFuzzy } = useEntryFuse(items)\n const childArray = Children.toArray(children)\n // Template roots per entry. Every entry clones the same template, so the\n // children divide evenly; anything else means the children are not the\n // stamped clones, and filtering blind would hide the wrong cards —\n // fail open and render everything.\n const groupSize =\n items?.length && childArray.length % items.length === 0\n ? childArray.length / items.length\n : 0\n // `suggest` draws its rows from the INDEX and never touches the clones,\n // so the clone-alignment precondition is a `filter` precondition only.\n // A block whose children do not divide evenly still suggests correctly;\n // requiring `groupSize` here would silently kill the panel on exactly\n // the templates that made the fail-open necessary.\n const mode: CollectionSearchMode =\n searchMode === 'suggest' ? 'suggest' : 'filter'\n // Whether there is an index to search, NOT whether the matcher has loaded:\n // the field has to be there for the keystroke that loads it.\n const live =\n !suppressNavigation &&\n Boolean(items?.length) &&\n (mode === 'suggest' || groupSize > 0)\n const trimmed = query.trim()\n let visible: ReactNode[] | ReactNode = children\n /**\n * The one line under the results that says what the search covered —\n * either a miss scoped to the set that came back empty, or a hit scoped\n * to the window it was drawn from. Never both.\n */\n let scopeNote: ReactNode = null\n if (mode === 'suggest') {\n // The grid is deliberately untouched (Figma 496:1218): the panel is an\n // overlay on a page the reader is still reading, not a filter.\n visible = children\n } else if (live && trimmed && fuzzy) {\n const matched = new Set(\n fuzzy.search(trimmed).map((result) => result.refIndex),\n )\n visible = childArray.filter((_, index) =>\n matched.has(Math.floor(index / groupSize)),\n )\n // HONEST scope (AGL-1516, AGL-2569): this block holds whatever window\n // the expansion gave it, and pretending the search was global would\n // turn every miss into a false \"this post does not exist\" — and every\n // hit into a result set that looks like the whole answer.\n const shown = items?.length ?? 0\n const { paginated, truncated } = searchScope({\n perPage,\n shown,\n searchTotal,\n searchCapped,\n })\n if (!(visible as ReactNode[]).length) {\n scopeNote = (\n <Typography variant=\"body2\" sx={{ color: 'text.secondary' }}>\n {!truncated\n ? `No matches for “${trimmed}”.`\n : paginated\n ? `No matches for “${trimmed}” on this page — other pages ` +\n 'are not searched.'\n : `No matches for “${trimmed}” in the ${shown} entries ` +\n 'shown here — the rest of the collection is not searched.'}\n </Typography>\n )\n } else if (truncated) {\n // The hit half of the same honesty (AGL-2569). Matches are drawn from\n // the same window the miss apologizes for, they carry no pager of\n // their own, and nothing else on screen says the pages behind this\n // one went unread — so a list that happens to be partial reads as\n // complete. A block that holds the whole collection says nothing\n // here: a disclaimer on a complete answer is noise, and every small\n // site would carry it.\n //\n // No route out to `/search?q=` (AGL-88): the suggestion panel links\n // there because it is the panel's only possible answer, but this\n // mode has a working list under the field and that page does not\n // exist yet. Trading a silent partial answer for a dead link is not\n // the trade.\n scopeNote = (\n <Typography variant=\"body2\" sx={{ color: 'text.secondary' }}>\n {paginated\n ? 'Showing matches on this page — other pages are not searched.'\n : `Showing matches in the ${shown} entries here — the rest of ` +\n 'the collection is not searched.'}\n </Typography>\n )\n }\n }\n // The field renders when there is something to search, and as an inert\n // affordance on editing surfaces so the author sees what they enabled.\n // A live surface with nothing stamped (unknown collection, zero entries)\n // renders no field at all — a search box over nothing is a lie.\n const showField = suppressNavigation || live\n const field = !showField ? null : mode === 'suggest' ? (\n // Rows in Fuse's SCORE order, the opposite of what `filter` does and\n // deliberately: filtering narrows a chronological feed, so reshuffling\n // it would be a second, unasked-for change to what the reader is\n // looking at. A suggestion list is not a feed — it is an answer to a\n // question, and the best answer belongs first.\n <SuggestSearchBox\n fuzzy={fuzzy}\n requestFuzzy={requestFuzzy}\n {...(items ? { items } : {})}\n {...(searchPlaceholder === undefined\n ? {}\n : { placeholder: searchPlaceholder })}\n {...(suppressNavigation ? { inert: true } : {})}\n // This block searched the entries IT rendered — a page window, an\n // `entriesLimit` slice, or a bounded read. Never \"this collection\".\n emptyText={(text) => `No matches for “${text}” on this page.`}\n />\n ) : (\n <SearchField\n value={query}\n landmark\n {...(searchPlaceholder === undefined ? {} : { placeholder: searchPlaceholder })}\n {...(suppressNavigation ? { inert: true } : {})}\n onQuery={(next) => {\n requestFuzzy()\n setQuery(next)\n }}\n />\n )\n return (\n <MuiStack\n ref={ref}\n spacing={4}\n {...props}\n // What the browser looks for before it hydrates the page, so this\n // module is fetched alongside the element rather than after it\n // (`prepareEntriesSearch`).\n {...{ [ENTRIES_SEARCH_ATTRIBUTE]: '' }}\n >\n {field}\n {visible}\n {scopeNote}\n </MuiStack>\n )\n },\n)\nSearchingEntries.displayName = 'AglynCollectionEntriesSearch'\n"],"names":["Aglyn","MuiStack","Typography","Children","forwardRef","useContext","useState","toCount","SearchField","SuggestSearchBox","useEntryFuse","ENTRIES_SEARCH_ATTRIBUTE","CollectionSearch","collectionSearchSchema","SEARCH_ID","searchScope","perPage","shown","searchTotal","searchCapped","paginated","truncated","Boolean","SearchingEntries","collectionSlug","entriesLimit","filterCategory","filterTag","page","firstPageOnly","search","searchMode","searchPlaceholder","searchIndex","children","props","ref","suppressNavigation","ScreenLinkContext","items","query","setQuery","fuzzy","requestFuzzy","childArray","toArray","groupSize","length","mode","live","trimmed","trim","visible","scopeNote","matched","Set","map","result","refIndex","filter","_","index","has","Math","floor","variant","sx","color","showField","field","undefined","placeholder","inert","emptyText","text","value","landmark","onQuery","next","spacing","displayName"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,OAAOC,cAAc,sBAAqB;AAC1C,OAAOC,gBAAgB,2BAA0B;AAEjD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAClE,2EAA2E;AAC3E,sEAAsE;AACtE,SAASC,OAAO,QAAQ,uBAAmB;AAO3C,SACEC,WAAW,EACXC,gBAAgB,EAChBC,YAAY,QACP,6BAAyB;AAChC,SAASC,wBAAwB,QAAQ,8BAA0B;AAEnE,8EAA8E;AAC9E,+EAA+E;AAC/E,oDAAoD;AACpD,SACEC,gBAAgB,EAChBC,sBAAsB,EACtBC,SAAS,QAEJ,yBAAqB;AAE5B;;;;;;;;;;;;CAYC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,MAAMC,cAAc,CAAC,EACnBC,OAAO,EACPC,KAAK,EACLC,WAAW,EACXC,YAAY,EAOb;QACoBZ;IAAnB,MAAMa,YAAY,EAACb,WAAAA,QAAQS,SAAS,cAAjBT,WAAuB,KAAK;IAC/C,OAAO;QACLa;QACAC,WACE,OAAOH,gBAAgB,WACnBD,QAAQC,eAAeI,QAAQH,gBAC/BC,aAAaE,QAAQH;IAC7B;AACF;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAMI,iCAAmBnB,WAI9B,kEAAkE;AAClE,2DAA2D;AAC3D;;;;iCACE,EACEoB,cAAc,EACdC,YAAY,EACZC,cAAc,EACdC,SAAS,EACTX,OAAO,EACPY,IAAI,EACJC,aAAa,EACbC,MAAM,EACNC,UAAU,EACVC,iBAAiB,EACjBC,WAAW,EACXf,WAAW,EACXC,YAAY,EACZe,QAAQ,EAET,UADIC;;;;;;;;;;;;;;;SAELC;IAEA,MAAM,EAAEC,kBAAkB,EAAE,GAAG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AClE;QACCmE,OAAOnC;QACPoC,QAAQ;OACH5C,sBAAsBsC,YAAY,CAAC,IAAI;QAAEC,aAAavC;IAAkB,GACxEK,qBAAqB;QAAEmC,OAAO;IAAK,IAAI,CAAC;QAC7CK,SAAS,CAACC;YACRnC;YACAF,SAASqC;QACX;;IAGJ,qBACE,MAAC7E;QACCmC,KAAKA;QACL2C,SAAS;OACL5C;QAIE,CAACxB,yBAAyB,EAAE;;YAEjC0D;YACAjB;YACAC;;;AAGP,GACD;AACD9B,iBAAiByD,WAAW,GAAG"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import * as Aglyn from '@aglyn/aglyn';
|
|
18
18
|
import { type StackProps } from '@mui/material/Stack';
|
|
19
|
+
import { ENTRIES_SEARCH_ATTRIBUTE } from './collection-search-load';
|
|
19
20
|
export declare const ENTRIES_ID: Aglyn.ComponentId;
|
|
20
21
|
export interface CollectionEntriesProps extends StackProps {
|
|
21
22
|
/**
|
|
@@ -116,11 +117,7 @@ export declare const COLLECTION_SEARCH_MODE_OPTIONS: ReadonlyArray<{
|
|
|
116
117
|
}>;
|
|
117
118
|
/** The searching variant's module (AGL-3438). */
|
|
118
119
|
type EntriesSearchModule = typeof import('./collection-entries-search');
|
|
119
|
-
|
|
120
|
-
* What a searching block stamps on its root. The browser looks for it before
|
|
121
|
-
* the page hydrates (`prepareEntriesSearch`); nothing styles or targets it.
|
|
122
|
-
*/
|
|
123
|
-
export declare const ENTRIES_SEARCH_ATTRIBUTE = "data-aglyn-entries-search";
|
|
120
|
+
export { ENTRIES_SEARCH_ATTRIBUTE };
|
|
124
121
|
/**
|
|
125
122
|
* The searching variant, fetched once per visit however many blocks ask. A
|
|
126
123
|
* failed fetch (a deploy mid-visit) is forgotten rather than cached, so the
|
|
@@ -21,6 +21,7 @@ import { mdiPostOutline } from "@aglyn/shared-data-mdi";
|
|
|
21
21
|
import MuiStack from "@mui/material/Stack";
|
|
22
22
|
import { forwardRef, use } from "react";
|
|
23
23
|
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
24
|
+
import { ENTRIES_SEARCH_ATTRIBUTE, loadCollectionSearch } from "./collection-search-load.js";
|
|
24
25
|
// Persisted component id (AGL-551/582); the compose pipeline references it
|
|
25
26
|
// through the @aglyn/aglyn constant. Never rename.
|
|
26
27
|
export const ENTRIES_ID = Aglyn.COLLECTION_ENTRIES_COMPONENT_ID;
|
|
@@ -41,10 +42,9 @@ export const ENTRIES_ID = Aglyn.COLLECTION_ENTRIES_COMPONENT_ID;
|
|
|
41
42
|
label: 'Show a suggestions dropdown'
|
|
42
43
|
}
|
|
43
44
|
];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*/ export const ENTRIES_SEARCH_ATTRIBUTE = 'data-aglyn-entries-search';
|
|
45
|
+
// Re-exported where it always was; it lives beside the shared loader so the
|
|
46
|
+
// searching variant can stamp it without importing this module (AGL-4220).
|
|
47
|
+
export { ENTRIES_SEARCH_ATTRIBUTE };
|
|
48
48
|
let searchLoad;
|
|
49
49
|
/**
|
|
50
50
|
* The searching variant, fetched once per visit however many blocks ask. A
|
|
@@ -52,7 +52,11 @@ let searchLoad;
|
|
|
52
52
|
* next render that asks tries again.
|
|
53
53
|
*/ export const loadEntriesSearch = ()=>{
|
|
54
54
|
if (searchLoad) return searchLoad;
|
|
55
|
-
|
|
55
|
+
// Through the loader the element tier shares, never an `import()` of its
|
|
56
|
+
// own: one written here would be a second chunk group, and the box drawn by
|
|
57
|
+
// both this variant and the Collection Search block would be downloaded
|
|
58
|
+
// once per group on a page placing both (AGL-4220).
|
|
59
|
+
const load = loadCollectionSearch();
|
|
56
60
|
searchLoad = load;
|
|
57
61
|
load.then((module)=>{
|
|
58
62
|
load.status = 'fulfilled';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/collection-entries.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 { mdiPostOutline } from '@aglyn/shared-data-mdi'\nimport MuiStack, { type StackProps } from '@mui/material/Stack'\nimport { forwardRef, use } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\n\n// Persisted component id (AGL-551/582); the compose pipeline references it\n// through the @aglyn/aglyn constant. Never rename.\nexport const ENTRIES_ID: Aglyn.ComponentId =\n Aglyn.COLLECTION_ENTRIES_COMPONENT_ID\n\nexport interface CollectionEntriesProps extends StackProps {\n /**\n * Collection to repeat over (compose-time, AGL-551). Blank = the\n * collection routed by the current URL on list-template screens.\n */\n collectionSlug?: string\n /** Maximum entries rendered (compose-time; blank = all, capped at 100). */\n entriesLimit?: number | string\n /**\n * Only entries in this category repeat (compose-time, AGL-582).\n * Matches the collection's category by stable id or display name.\n */\n filterCategory?: string\n /** Only entries carrying this tag repeat (compose-time, AGL-582). */\n filterTag?: string\n /**\n * Entries per page (compose-time, AGL-620). When set, the block renders one\n * page window instead of the top `entriesLimit`; the built-in collection\n * list uses this with the `page` from `/{collection}/page/{n}`.\n */\n perPage?: number | string\n /** 1-based page for `perPage` (compose-time, AGL-620). */\n page?: number | string\n /**\n * Render this block only on page 1 of the routed listing (compose-time,\n * AGL-1871). For a LEAD card — a block with no `perPage`, showing the top\n * of the set — every `/{collection}/page/{n}` past the first otherwise\n * repeats the identical entry above a page of different ones.\n *\n * Opt-in and default off: a block that legitimately belongs on every page\n * of a listing (a \"popular posts\" rail) has exactly the same shape.\n */\n firstPageOnly?: boolean\n /**\n * Show a search box that filters the RENDERED entries by title/excerpt as\n * the reader types (AGL-1516, Figma 494:1220). Opt-in and default off, so\n * every existing instance renders exactly as before.\n *\n * Client-evaluated over the entries this block already holds — the page is\n * ISR-cached, so a keystroke never costs a Firestore read. That set is\n * whatever the expansion left the block holding, which paging, an\n * `entriesLimit` or the 100-entry cap can each cut down. A truncated block\n * says so under its results either way — on a miss and on a hit\n * (AGL-1516, AGL-2569) — rather than pretending global search.\n */\n search?: boolean\n /**\n * What the search box DOES with a query (AGL-1525, Figma 496:1218).\n *\n * - `filter` (default, and the reading of an absent value) — hides the\n * non-matching cards in place. What AGL-1516 shipped.\n * - `suggest` — the card grid stays exactly as it was and a floating panel\n * of matching entries opens under the field, ending in a link to the\n * site-wide results page. The frame's toolbar behaviour: a reader\n * skimming the list is not made to lose it to a typo.\n */\n searchMode?: CollectionSearchMode\n /** Hint text inside the search box (blank = \"Search posts…\"). */\n searchPlaceholder?: string\n /**\n * Server-stamped matchable text per rendered entry\n * (`expandCollectionEntries`, AGL-1516); never set by hand.\n */\n searchIndex?: Aglyn.CollectionEntrySearchItem[]\n /**\n * How many entries `searchIndex` was drawn from — server-stamped by\n * `expandCollectionEntries` alongside it (AGL-1516), never set by hand.\n * `searchIndex.length < searchTotal` is the only honest test of whether\n * this block holds the whole set; `perPage` is not, because\n * `entriesLimit` and the 100-entry cap truncate too.\n */\n searchTotal?: number\n /**\n * Whether the read behind `searchTotal` reached its own bound — server-\n * stamped beside it (AGL-1516), never set by hand.\n *\n * `searchTotal` is a count of what the server SAW, and the collection read\n * is limited. Without this flag a block holding 100 of 400 posts satisfies\n * `searchIndex.length === searchTotal` and renders the one empty state that\n * claims to have looked everywhere.\n */\n searchCapped?: boolean\n}\n\n/** The two things the toolbar search box can do (AGL-1516/AGL-1525). */\nexport type CollectionSearchMode = 'filter' | 'suggest'\n\n/**\n * Author-facing choices for {@link CollectionEntriesProps.searchMode}.\n *\n * Both values are truthy on purpose (AGL-1453): `''` cannot survive a save,\n * so an author who tried the other mode would have no route back. \"Filter\"\n * carries the absent-value reading, which is what every block published\n * before AGL-1525 has.\n */\nexport const COLLECTION_SEARCH_MODE_OPTIONS: ReadonlyArray<{\n value: CollectionSearchMode\n label: string\n}> = [\n { value: 'filter', label: 'Filter the entries in place' },\n { value: 'suggest', label: 'Show a suggestions dropdown' },\n]\n\n/** The searching variant's module (AGL-3438). */\ntype EntriesSearchModule = typeof import('./collection-entries-search')\n\n/**\n * What a searching block stamps on its root. The browser looks for it before\n * the page hydrates (`prepareEntriesSearch`); nothing styles or targets it.\n */\nexport const ENTRIES_SEARCH_ATTRIBUTE = 'data-aglyn-entries-search'\n\n/**\n * React's thenable contract (`status`/`value`), stamped on the load once it\n * settles — the plugin loader's ensure promise carries it for the same reason\n * (AGL-1541): `use()` unwraps a stamped promise synchronously, and suspends on\n * a bare one even after it has resolved.\n */\ntype StampedLoad = Promise<EntriesSearchModule> & {\n status?: 'pending' | 'fulfilled' | 'rejected'\n value?: EntriesSearchModule\n reason?: unknown\n}\n\nlet searchLoad: StampedLoad | undefined\n\n/**\n * The searching variant, fetched once per visit however many blocks ask. A\n * failed fetch (a deploy mid-visit) is forgotten rather than cached, so the\n * next render that asks tries again.\n */\nexport const loadEntriesSearch = (): Promise<EntriesSearchModule> => {\n if (searchLoad) return searchLoad\n const load: StampedLoad = import('./collection-entries-search')\n searchLoad = load\n load.then(\n (module) => {\n load.status = 'fulfilled'\n load.value = module\n },\n (reason: unknown) => {\n load.status = 'rejected'\n load.reason = reason\n if (searchLoad === load) searchLoad = undefined\n },\n )\n return load\n}\n\n/**\n * Loads the searching variant BEFORE the element renders, wherever a render\n * that waited for it would cost something (AGL-3438). The plugin calls it as\n * the element registers (`prepare` in `plugin.ts`), and awaits it.\n *\n * - **On the server, always.** A render that suspended there would hold the\n * whole streamed shell for the fetch — and a first, cold one would do it\n * on a page the ISR cache then keeps.\n * - **Where the whole library is loading** (`everything`): the console and\n * the besigner, where an author can turn search on at any moment.\n * - **In a browser about to hydrate a searching block**, which the server\n * HTML says by carrying {@link ENTRIES_SEARCH_ATTRIBUTE}. The fetch then\n * rides along with the element's own instead of starting when hydration\n * reaches the block.\n *\n * Anywhere else nothing is fetched: a page whose blocks have search off —\n * most of them — never downloads the box. A searching block that renders\n * without it (a client-side navigation onto one) suspends until it lands,\n * which holds the navigation, never a half-drawn list.\n */\nexport const prepareEntriesSearch = (\n everything: boolean,\n): Promise<unknown> | undefined =>\n everything ||\n typeof document === 'undefined' ||\n document.querySelector(`[${ENTRIES_SEARCH_ATTRIBUTE}]`)\n ? loadEntriesSearch()\n : undefined\n\n/**\n * Repeats its children once per published entry of a content collection\n * (AGL-551) — the collections sibling of the dataset repeatable. The tenant\n * expands it at compose time with `{{entry.*}}` tokens; in the besigner the\n * template renders once with literal tokens, matching the repeatable UX.\n *\n * With `search` on (AGL-1516) the block is `SearchingEntries`, from its own\n * module (AGL-3438). Off — the default, and most blocks — it is the plain\n * stack below, and the search box's MUI input never reaches the page.\n *\n * There is NO Suspense boundary around the searching variant, on purpose. A\n * boundary would have to be in the server's tree too, and a client render\n * that suspended inside it would show its fallback: a list without its box,\n * then the box pushing it down. Without one, a render that has to wait holds\n * whatever is above it — the hydration of the page (whose server HTML stays\n * exactly as it is), or a navigation (whose old page stays up) — and\n * `prepareEntriesSearch` makes sure the published page almost never has to.\n */\nconst CollectionEntries = forwardRef<HTMLDivElement, CollectionEntriesProps>(\n (props, ref) => {\n if (props.search) {\n const { SearchingEntries } = use(loadEntriesSearch())\n return <SearchingEntries ref={ref} {...props} />\n }\n // collectionSlug/entriesLimit/filter*/search* are compose-time or\n // search-only attributes: strip so they never hit the DOM.\n const {\n collectionSlug,\n entriesLimit,\n filterCategory,\n filterTag,\n perPage,\n page,\n firstPageOnly,\n search,\n searchMode,\n searchPlaceholder,\n searchIndex,\n searchTotal,\n searchCapped,\n children,\n ...rest\n } = props\n return (\n <MuiStack ref={ref} spacing={4} {...rest}>\n {children}\n </MuiStack>\n )\n },\n)\nCollectionEntries.displayName = 'AglynCollectionEntries'\n\nexport const collectionEntriesSchema: Aglyn.ComponentSchema<CollectionEntriesProps> =\n {\n $id: ENTRIES_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Collection Entries',\n description: 'Repeats its children once per entry in a content collection.',\n category: Aglyn.ComponentCategory.DATA_DISPLAY,\n icon: { path: mdiPostOutline.path, sx: { color: 'secondary.main' } },\n // Search divides `Children.toArray(children)` into one group per entry\n // (AGL-1516), so the renderer has to hand it one React child per stamped\n // node (AGL-3660). Wrapped in the single `<Branch>`, a block of N entries\n // read as ONE child, never divided evenly, and failed open: no search\n // field on the published page at all.\n flags: { positionalChildren: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'collectionSlug',\n label: 'Collection slug',\n description:\n 'Content collection whose published entries the children repeat ' +\n 'over (e.g. \"blog\"). Leave blank on a list-template page to use ' +\n 'the collection from the URL.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'entriesLimit',\n label: 'Entries limit',\n description: 'Maximum entries rendered (blank = all, capped at 100).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'filterCategory',\n label: 'Filter by category',\n description:\n 'Only entries in this category repeat — the category name or its ' +\n 'stable id both match (e.g. \"Guides\"). Blank = no category filter.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'filterTag',\n label: 'Filter by tag',\n description:\n 'Only entries carrying this tag repeat (e.g. \"nextjs\"). Blank = ' +\n 'no tag filter.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'perPage',\n label: 'Entries per page',\n description:\n 'Paginate the list: entries per page (blank = no pagination). ' +\n 'Pairs with the page from /{collection}/page/{n}.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'page',\n label: 'Page',\n description: '1-based page to render when Entries per page is set.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'firstPageOnly',\n label: 'Only on page 1',\n description:\n 'Show this block on the first page of the listing only. Use it ' +\n 'for a featured or lead card: without it the same entry repeats ' +\n 'at the top of every /page/{n}, above a page of different ones.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'search',\n label: 'Search',\n description:\n 'Show a search box that filters the rendered entries by title ' +\n 'and excerpt as the reader types. It searches the entries this ' +\n 'block rendered — whatever paging, an entry limit or the ' +\n '100-entry cap left it holding, and it says so on a miss.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'searchMode',\n label: 'When the reader types',\n description:\n 'Filter the entries in place, or leave the list alone and open a ' +\n 'dropdown of matching entries under the box — each one a link, ' +\n 'ending in \"View all results\" for a search across the whole site.',\n component: Aglyn.FieldComponentType.SELECT,\n options: COLLECTION_SEARCH_MODE_OPTIONS.map((option) => ({\n ...option,\n })),\n // Meaningless while there is no search box to type in.\n condition: { when: 'search', is: true },\n },\n {\n name: 'searchPlaceholder',\n label: 'Search placeholder',\n description:\n 'Hint text inside this block’s own search box — the one that ' +\n 'filters the entries below it as a reader types. Blank shows ' +\n '\"Search posts…\".',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n // Meaningless while there is no search box to hint in.\n condition: { when: 'search', is: true },\n },\n // `searchIndex` and `searchTotal` are deliberately NOT attributes: both\n // are server-stamped by expandCollectionEntries, like Category Pills'\n // `items` and Related Posts' `entries`.\n {\n name: 'spacing',\n label: 'Spacing',\n description: 'Defines the space/gap between entries.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n ],\n }\n\nexport { CollectionEntries }\n// The collection family's palette presets ride this element's registry entry\n// (`presets: 'collectionPresets'` in plugin.ts), as they did when the family\n// was one module.\nexport { collectionPresets } from './collection-presets'\n"],"names":["Aglyn","mdiPostOutline","MuiStack","forwardRef","use","BUNDLE_ID","ENTRIES_ID","COLLECTION_ENTRIES_COMPONENT_ID","COLLECTION_SEARCH_MODE_OPTIONS","value","label","ENTRIES_SEARCH_ATTRIBUTE","searchLoad","loadEntriesSearch","load","then","module","status","reason","undefined","prepareEntriesSearch","everything","document","querySelector","CollectionEntries","props","ref","search","SearchingEntries","collectionSlug","entriesLimit","filterCategory","filterTag","perPage","page","firstPageOnly","searchMode","searchPlaceholder","searchIndex","searchTotal","searchCapped","children","rest","spacing","displayName","collectionEntriesSchema","$id","pluginId","description","category","ComponentCategory","DATA_DISPLAY","icon","path","sx","color","flags","positionalChildren","FEATURE_FLAG","ENABLED","attributes","name","component","FieldComponentType","TEXT_FIELD","type","SWITCH","SELECT","options","map","option","condition","when","is","collectionPresets"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,cAAc,QAAQ,yBAAwB;AACvD,OAAOC,cAAmC,sBAAqB;AAC/D,SAASC,UAAU,EAAEC,GAAG,QAAQ,QAAO;AACvC,SAASC,SAAS,QAAQ,gCAA4B;AAEtD,2EAA2E;AAC3E,mDAAmD;AACnD,OAAO,MAAMC,aACXN,MAAMO,+BAA+B,CAAA;AAyFvC;;;;;;;CAOC,GACD,OAAO,MAAMC,iCAGR;IACH;QAAEC,OAAO;QAAUC,OAAO;IAA8B;IACxD;QAAED,OAAO;QAAWC,OAAO;IAA8B;CAC1D,CAAA;AAKD;;;CAGC,GACD,OAAO,MAAMC,2BAA2B,4BAA2B;AAcnE,IAAIC;AAEJ;;;;CAIC,GACD,OAAO,MAAMC,oBAAoB;IAC/B,IAAID,YAAY,OAAOA;IACvB,MAAME,OAAoB,MAAM,CAAC;IACjCF,aAAaE;IACbA,KAAKC,IAAI,CACP,CAACC;QACCF,KAAKG,MAAM,GAAG;QACdH,KAAKL,KAAK,GAAGO;IACf,GACA,CAACE;QACCJ,KAAKG,MAAM,GAAG;QACdH,KAAKI,MAAM,GAAGA;QACd,IAAIN,eAAeE,MAAMF,aAAaO;IACxC;IAEF,OAAOL;AACT,EAAC;AAED;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMM,uBAAuB,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GAAE;AAC5B,6EAA6E;AAC7E,6EAA6E;AAC7E,kBAAkB;AAClB,SAASkD,iBAAiB,QAAQ,0BAAsB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/collection-entries.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 { mdiPostOutline } from '@aglyn/shared-data-mdi'\nimport MuiStack, { type StackProps } from '@mui/material/Stack'\nimport { forwardRef, use } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport {\n ENTRIES_SEARCH_ATTRIBUTE,\n loadCollectionSearch,\n} from './collection-search-load'\n\n// Persisted component id (AGL-551/582); the compose pipeline references it\n// through the @aglyn/aglyn constant. Never rename.\nexport const ENTRIES_ID: Aglyn.ComponentId =\n Aglyn.COLLECTION_ENTRIES_COMPONENT_ID\n\nexport interface CollectionEntriesProps extends StackProps {\n /**\n * Collection to repeat over (compose-time, AGL-551). Blank = the\n * collection routed by the current URL on list-template screens.\n */\n collectionSlug?: string\n /** Maximum entries rendered (compose-time; blank = all, capped at 100). */\n entriesLimit?: number | string\n /**\n * Only entries in this category repeat (compose-time, AGL-582).\n * Matches the collection's category by stable id or display name.\n */\n filterCategory?: string\n /** Only entries carrying this tag repeat (compose-time, AGL-582). */\n filterTag?: string\n /**\n * Entries per page (compose-time, AGL-620). When set, the block renders one\n * page window instead of the top `entriesLimit`; the built-in collection\n * list uses this with the `page` from `/{collection}/page/{n}`.\n */\n perPage?: number | string\n /** 1-based page for `perPage` (compose-time, AGL-620). */\n page?: number | string\n /**\n * Render this block only on page 1 of the routed listing (compose-time,\n * AGL-1871). For a LEAD card — a block with no `perPage`, showing the top\n * of the set — every `/{collection}/page/{n}` past the first otherwise\n * repeats the identical entry above a page of different ones.\n *\n * Opt-in and default off: a block that legitimately belongs on every page\n * of a listing (a \"popular posts\" rail) has exactly the same shape.\n */\n firstPageOnly?: boolean\n /**\n * Show a search box that filters the RENDERED entries by title/excerpt as\n * the reader types (AGL-1516, Figma 494:1220). Opt-in and default off, so\n * every existing instance renders exactly as before.\n *\n * Client-evaluated over the entries this block already holds — the page is\n * ISR-cached, so a keystroke never costs a Firestore read. That set is\n * whatever the expansion left the block holding, which paging, an\n * `entriesLimit` or the 100-entry cap can each cut down. A truncated block\n * says so under its results either way — on a miss and on a hit\n * (AGL-1516, AGL-2569) — rather than pretending global search.\n */\n search?: boolean\n /**\n * What the search box DOES with a query (AGL-1525, Figma 496:1218).\n *\n * - `filter` (default, and the reading of an absent value) — hides the\n * non-matching cards in place. What AGL-1516 shipped.\n * - `suggest` — the card grid stays exactly as it was and a floating panel\n * of matching entries opens under the field, ending in a link to the\n * site-wide results page. The frame's toolbar behaviour: a reader\n * skimming the list is not made to lose it to a typo.\n */\n searchMode?: CollectionSearchMode\n /** Hint text inside the search box (blank = \"Search posts…\"). */\n searchPlaceholder?: string\n /**\n * Server-stamped matchable text per rendered entry\n * (`expandCollectionEntries`, AGL-1516); never set by hand.\n */\n searchIndex?: Aglyn.CollectionEntrySearchItem[]\n /**\n * How many entries `searchIndex` was drawn from — server-stamped by\n * `expandCollectionEntries` alongside it (AGL-1516), never set by hand.\n * `searchIndex.length < searchTotal` is the only honest test of whether\n * this block holds the whole set; `perPage` is not, because\n * `entriesLimit` and the 100-entry cap truncate too.\n */\n searchTotal?: number\n /**\n * Whether the read behind `searchTotal` reached its own bound — server-\n * stamped beside it (AGL-1516), never set by hand.\n *\n * `searchTotal` is a count of what the server SAW, and the collection read\n * is limited. Without this flag a block holding 100 of 400 posts satisfies\n * `searchIndex.length === searchTotal` and renders the one empty state that\n * claims to have looked everywhere.\n */\n searchCapped?: boolean\n}\n\n/** The two things the toolbar search box can do (AGL-1516/AGL-1525). */\nexport type CollectionSearchMode = 'filter' | 'suggest'\n\n/**\n * Author-facing choices for {@link CollectionEntriesProps.searchMode}.\n *\n * Both values are truthy on purpose (AGL-1453): `''` cannot survive a save,\n * so an author who tried the other mode would have no route back. \"Filter\"\n * carries the absent-value reading, which is what every block published\n * before AGL-1525 has.\n */\nexport const COLLECTION_SEARCH_MODE_OPTIONS: ReadonlyArray<{\n value: CollectionSearchMode\n label: string\n}> = [\n { value: 'filter', label: 'Filter the entries in place' },\n { value: 'suggest', label: 'Show a suggestions dropdown' },\n]\n\n/** The searching variant's module (AGL-3438). */\ntype EntriesSearchModule = typeof import('./collection-entries-search')\n\n// Re-exported where it always was; it lives beside the shared loader so the\n// searching variant can stamp it without importing this module (AGL-4220).\nexport { ENTRIES_SEARCH_ATTRIBUTE }\n\n/**\n * React's thenable contract (`status`/`value`), stamped on the load once it\n * settles — the plugin loader's ensure promise carries it for the same reason\n * (AGL-1541): `use()` unwraps a stamped promise synchronously, and suspends on\n * a bare one even after it has resolved.\n */\ntype StampedLoad = Promise<EntriesSearchModule> & {\n status?: 'pending' | 'fulfilled' | 'rejected'\n value?: EntriesSearchModule\n reason?: unknown\n}\n\nlet searchLoad: StampedLoad | undefined\n\n/**\n * The searching variant, fetched once per visit however many blocks ask. A\n * failed fetch (a deploy mid-visit) is forgotten rather than cached, so the\n * next render that asks tries again.\n */\nexport const loadEntriesSearch = (): Promise<EntriesSearchModule> => {\n if (searchLoad) return searchLoad\n // Through the loader the element tier shares, never an `import()` of its\n // own: one written here would be a second chunk group, and the box drawn by\n // both this variant and the Collection Search block would be downloaded\n // once per group on a page placing both (AGL-4220).\n const load: StampedLoad = loadCollectionSearch()\n searchLoad = load\n load.then(\n (module) => {\n load.status = 'fulfilled'\n load.value = module\n },\n (reason: unknown) => {\n load.status = 'rejected'\n load.reason = reason\n if (searchLoad === load) searchLoad = undefined\n },\n )\n return load\n}\n\n/**\n * Loads the searching variant BEFORE the element renders, wherever a render\n * that waited for it would cost something (AGL-3438). The plugin calls it as\n * the element registers (`prepare` in `plugin.ts`), and awaits it.\n *\n * - **On the server, always.** A render that suspended there would hold the\n * whole streamed shell for the fetch — and a first, cold one would do it\n * on a page the ISR cache then keeps.\n * - **Where the whole library is loading** (`everything`): the console and\n * the besigner, where an author can turn search on at any moment.\n * - **In a browser about to hydrate a searching block**, which the server\n * HTML says by carrying {@link ENTRIES_SEARCH_ATTRIBUTE}. The fetch then\n * rides along with the element's own instead of starting when hydration\n * reaches the block.\n *\n * Anywhere else nothing is fetched: a page whose blocks have search off —\n * most of them — never downloads the box. A searching block that renders\n * without it (a client-side navigation onto one) suspends until it lands,\n * which holds the navigation, never a half-drawn list.\n */\nexport const prepareEntriesSearch = (\n everything: boolean,\n): Promise<unknown> | undefined =>\n everything ||\n typeof document === 'undefined' ||\n document.querySelector(`[${ENTRIES_SEARCH_ATTRIBUTE}]`)\n ? loadEntriesSearch()\n : undefined\n\n/**\n * Repeats its children once per published entry of a content collection\n * (AGL-551) — the collections sibling of the dataset repeatable. The tenant\n * expands it at compose time with `{{entry.*}}` tokens; in the besigner the\n * template renders once with literal tokens, matching the repeatable UX.\n *\n * With `search` on (AGL-1516) the block is `SearchingEntries`, from its own\n * module (AGL-3438). Off — the default, and most blocks — it is the plain\n * stack below, and the search box's MUI input never reaches the page.\n *\n * There is NO Suspense boundary around the searching variant, on purpose. A\n * boundary would have to be in the server's tree too, and a client render\n * that suspended inside it would show its fallback: a list without its box,\n * then the box pushing it down. Without one, a render that has to wait holds\n * whatever is above it — the hydration of the page (whose server HTML stays\n * exactly as it is), or a navigation (whose old page stays up) — and\n * `prepareEntriesSearch` makes sure the published page almost never has to.\n */\nconst CollectionEntries = forwardRef<HTMLDivElement, CollectionEntriesProps>(\n (props, ref) => {\n if (props.search) {\n const { SearchingEntries } = use(loadEntriesSearch())\n return <SearchingEntries ref={ref} {...props} />\n }\n // collectionSlug/entriesLimit/filter*/search* are compose-time or\n // search-only attributes: strip so they never hit the DOM.\n const {\n collectionSlug,\n entriesLimit,\n filterCategory,\n filterTag,\n perPage,\n page,\n firstPageOnly,\n search,\n searchMode,\n searchPlaceholder,\n searchIndex,\n searchTotal,\n searchCapped,\n children,\n ...rest\n } = props\n return (\n <MuiStack ref={ref} spacing={4} {...rest}>\n {children}\n </MuiStack>\n )\n },\n)\nCollectionEntries.displayName = 'AglynCollectionEntries'\n\nexport const collectionEntriesSchema: Aglyn.ComponentSchema<CollectionEntriesProps> =\n {\n $id: ENTRIES_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Collection Entries',\n description: 'Repeats its children once per entry in a content collection.',\n category: Aglyn.ComponentCategory.DATA_DISPLAY,\n icon: { path: mdiPostOutline.path, sx: { color: 'secondary.main' } },\n // Search divides `Children.toArray(children)` into one group per entry\n // (AGL-1516), so the renderer has to hand it one React child per stamped\n // node (AGL-3660). Wrapped in the single `<Branch>`, a block of N entries\n // read as ONE child, never divided evenly, and failed open: no search\n // field on the published page at all.\n flags: { positionalChildren: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'collectionSlug',\n label: 'Collection slug',\n description:\n 'Content collection whose published entries the children repeat ' +\n 'over (e.g. \"blog\"). Leave blank on a list-template page to use ' +\n 'the collection from the URL.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'entriesLimit',\n label: 'Entries limit',\n description: 'Maximum entries rendered (blank = all, capped at 100).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'filterCategory',\n label: 'Filter by category',\n description:\n 'Only entries in this category repeat — the category name or its ' +\n 'stable id both match (e.g. \"Guides\"). Blank = no category filter.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'filterTag',\n label: 'Filter by tag',\n description:\n 'Only entries carrying this tag repeat (e.g. \"nextjs\"). Blank = ' +\n 'no tag filter.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n {\n name: 'perPage',\n label: 'Entries per page',\n description:\n 'Paginate the list: entries per page (blank = no pagination). ' +\n 'Pairs with the page from /{collection}/page/{n}.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'page',\n label: 'Page',\n description: '1-based page to render when Entries per page is set.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'firstPageOnly',\n label: 'Only on page 1',\n description:\n 'Show this block on the first page of the listing only. Use it ' +\n 'for a featured or lead card: without it the same entry repeats ' +\n 'at the top of every /page/{n}, above a page of different ones.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'search',\n label: 'Search',\n description:\n 'Show a search box that filters the rendered entries by title ' +\n 'and excerpt as the reader types. It searches the entries this ' +\n 'block rendered — whatever paging, an entry limit or the ' +\n '100-entry cap left it holding, and it says so on a miss.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'searchMode',\n label: 'When the reader types',\n description:\n 'Filter the entries in place, or leave the list alone and open a ' +\n 'dropdown of matching entries under the box — each one a link, ' +\n 'ending in \"View all results\" for a search across the whole site.',\n component: Aglyn.FieldComponentType.SELECT,\n options: COLLECTION_SEARCH_MODE_OPTIONS.map((option) => ({\n ...option,\n })),\n // Meaningless while there is no search box to type in.\n condition: { when: 'search', is: true },\n },\n {\n name: 'searchPlaceholder',\n label: 'Search placeholder',\n description:\n 'Hint text inside this block’s own search box — the one that ' +\n 'filters the entries below it as a reader types. Blank shows ' +\n '\"Search posts…\".',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n // Meaningless while there is no search box to hint in.\n condition: { when: 'search', is: true },\n },\n // `searchIndex` and `searchTotal` are deliberately NOT attributes: both\n // are server-stamped by expandCollectionEntries, like Category Pills'\n // `items` and Related Posts' `entries`.\n {\n name: 'spacing',\n label: 'Spacing',\n description: 'Defines the space/gap between entries.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n ],\n }\n\nexport { CollectionEntries }\n// The collection family's palette presets ride this element's registry entry\n// (`presets: 'collectionPresets'` in plugin.ts), as they did when the family\n// was one module.\nexport { collectionPresets } from './collection-presets'\n"],"names":["Aglyn","mdiPostOutline","MuiStack","forwardRef","use","BUNDLE_ID","ENTRIES_SEARCH_ATTRIBUTE","loadCollectionSearch","ENTRIES_ID","COLLECTION_ENTRIES_COMPONENT_ID","COLLECTION_SEARCH_MODE_OPTIONS","value","label","searchLoad","loadEntriesSearch","load","then","module","status","reason","undefined","prepareEntriesSearch","everything","document","querySelector","CollectionEntries","props","ref","search","SearchingEntries","collectionSlug","entriesLimit","filterCategory","filterTag","perPage","page","firstPageOnly","searchMode","searchPlaceholder","searchIndex","searchTotal","searchCapped","children","rest","spacing","displayName","collectionEntriesSchema","$id","pluginId","description","category","ComponentCategory","DATA_DISPLAY","icon","path","sx","color","flags","positionalChildren","FEATURE_FLAG","ENABLED","attributes","name","component","FieldComponentType","TEXT_FIELD","type","SWITCH","SELECT","options","map","option","condition","when","is","collectionPresets"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,cAAc,QAAQ,yBAAwB;AACvD,OAAOC,cAAmC,sBAAqB;AAC/D,SAASC,UAAU,EAAEC,GAAG,QAAQ,QAAO;AACvC,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SACEC,wBAAwB,EACxBC,oBAAoB,QACf,8BAA0B;AAEjC,2EAA2E;AAC3E,mDAAmD;AACnD,OAAO,MAAMC,aACXR,MAAMS,+BAA+B,CAAA;AAyFvC;;;;;;;CAOC,GACD,OAAO,MAAMC,iCAGR;IACH;QAAEC,OAAO;QAAUC,OAAO;IAA8B;IACxD;QAAED,OAAO;QAAWC,OAAO;IAA8B;CAC1D,CAAA;AAKD,4EAA4E;AAC5E,2EAA2E;AAC3E,SAASN,wBAAw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A+B4D,GAAG,CAAC,CAACC,SAAY,aACpDA;YAEL,uDAAuD;YACvDC,WAAW;gBAAEC,MAAM;gBAAUC,IAAI;YAAK;QACxC;QACA;YACEZ,MAAM;YACNlD,OAAO;YACPqC,aACE,iEACA,iEACA;YACFc,WAAW/D,MAAMgE,kBAAkB,CAACC,UAAU;YAC9C,uDAAuD;YACvDO,WAAW;gBAAEC,MAAM;gBAAUC,IAAI;YAAK;QACxC;QACA,wEAAwE;QACxE,sEAAsE;QACtE,wCAAwC;QACxC;YACEZ,MAAM;YACNlD,OAAO;YACPqC,aAAa;YACbc,WAAW/D,MAAMgE,kBAAkB,CAACC,UAAU;YAC9CC,MAAM;QACR;KACD;AACH,EAAC;AAEH,SAASzC,iBAAiB,GAAE;AAC5B,6EAA6E;AAC7E,6EAA6E;AAC7E,kBAAkB;AAClB,SAASkD,iBAAiB,QAAQ,0BAAsB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
18
|
+
* The one `import()` both collection search boxes arrive through (AGL-4220).
|
|
19
|
+
*
|
|
20
|
+
* Two elements draw the collection search box: the standalone Collection
|
|
21
|
+
* Search block, and the Entries block once its `search` is on. Each used to
|
|
22
|
+
* be its own `import()` — the block's in `element-tier.ts`, the variant's in
|
|
23
|
+
* `collection-entries.tsx` — and so its own chunk group, and a page placing
|
|
24
|
+
* both downloaded the box twice: MUI's Chip, InputBase and TextareaAutosize
|
|
25
|
+
* and the box itself, 24 KB of module code, once per group.
|
|
26
|
+
*
|
|
27
|
+
* Both now reach `collection-entries-search.tsx`, which carries both
|
|
28
|
+
* elements, through the `import()` written HERE. `element-tier.ts` imports
|
|
29
|
+
* this module statically, so it sits in the tier's own chunk and the import
|
|
30
|
+
* below is ONE chunk group, whose parent is the tier whichever element asks:
|
|
31
|
+
* the box is fetched once, and whichever element arrives second costs no
|
|
32
|
+
* request at all. Each element carries the other's few lines (about 2 KB).
|
|
33
|
+
*
|
|
34
|
+
* The marker lives here, not in `collection-entries.tsx`, so the searching
|
|
35
|
+
* variant can stamp it without importing the plain block it replaces: that
|
|
36
|
+
* import would put a second copy of the entries block and its presets in the
|
|
37
|
+
* search chunk, whose parent is the tier, not the entries block.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* What a searching entries block stamps on its root. The browser looks for it
|
|
41
|
+
* before the page hydrates (`prepareEntriesSearch`); nothing styles or
|
|
42
|
+
* targets it.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ENTRIES_SEARCH_ATTRIBUTE = "data-aglyn-entries-search";
|
|
45
|
+
type SearchModule = typeof import('./collection-entries-search');
|
|
46
|
+
/** Both search elements' module, fetched once per visit. */
|
|
47
|
+
export declare const loadCollectionSearch: () => Promise<SearchModule>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
* The one `import()` both collection search boxes arrive through (AGL-4220).
|
|
18
|
+
*
|
|
19
|
+
* Two elements draw the collection search box: the standalone Collection
|
|
20
|
+
* Search block, and the Entries block once its `search` is on. Each used to
|
|
21
|
+
* be its own `import()` — the block's in `element-tier.ts`, the variant's in
|
|
22
|
+
* `collection-entries.tsx` — and so its own chunk group, and a page placing
|
|
23
|
+
* both downloaded the box twice: MUI's Chip, InputBase and TextareaAutosize
|
|
24
|
+
* and the box itself, 24 KB of module code, once per group.
|
|
25
|
+
*
|
|
26
|
+
* Both now reach `collection-entries-search.tsx`, which carries both
|
|
27
|
+
* elements, through the `import()` written HERE. `element-tier.ts` imports
|
|
28
|
+
* this module statically, so it sits in the tier's own chunk and the import
|
|
29
|
+
* below is ONE chunk group, whose parent is the tier whichever element asks:
|
|
30
|
+
* the box is fetched once, and whichever element arrives second costs no
|
|
31
|
+
* request at all. Each element carries the other's few lines (about 2 KB).
|
|
32
|
+
*
|
|
33
|
+
* The marker lives here, not in `collection-entries.tsx`, so the searching
|
|
34
|
+
* variant can stamp it without importing the plain block it replaces: that
|
|
35
|
+
* import would put a second copy of the entries block and its presets in the
|
|
36
|
+
* search chunk, whose parent is the tier, not the entries block.
|
|
37
|
+
*/ /**
|
|
38
|
+
* What a searching entries block stamps on its root. The browser looks for it
|
|
39
|
+
* before the page hydrates (`prepareEntriesSearch`); nothing styles or
|
|
40
|
+
* targets it.
|
|
41
|
+
*/ export const ENTRIES_SEARCH_ATTRIBUTE = 'data-aglyn-entries-search';
|
|
42
|
+
// One import shared by every caller, as `formControls` in `element-tier.ts`:
|
|
43
|
+
// a loader that hands a second caller a module still being evaluated (jiti,
|
|
44
|
+
// in the AI palette and axe guards) would give it empty exports. A failed
|
|
45
|
+
// load is forgotten so the next placement retries.
|
|
46
|
+
let searchLoad;
|
|
47
|
+
/** Both search elements' module, fetched once per visit. */ export const loadCollectionSearch = ()=>searchLoad != null ? searchLoad : searchLoad = import("./collection-entries-search.js").catch((error)=>{
|
|
48
|
+
searchLoad = undefined;
|
|
49
|
+
throw error;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=collection-search-load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/collection-search-load.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\n/**\n * The one `import()` both collection search boxes arrive through (AGL-4220).\n *\n * Two elements draw the collection search box: the standalone Collection\n * Search block, and the Entries block once its `search` is on. Each used to\n * be its own `import()` — the block's in `element-tier.ts`, the variant's in\n * `collection-entries.tsx` — and so its own chunk group, and a page placing\n * both downloaded the box twice: MUI's Chip, InputBase and TextareaAutosize\n * and the box itself, 24 KB of module code, once per group.\n *\n * Both now reach `collection-entries-search.tsx`, which carries both\n * elements, through the `import()` written HERE. `element-tier.ts` imports\n * this module statically, so it sits in the tier's own chunk and the import\n * below is ONE chunk group, whose parent is the tier whichever element asks:\n * the box is fetched once, and whichever element arrives second costs no\n * request at all. Each element carries the other's few lines (about 2 KB).\n *\n * The marker lives here, not in `collection-entries.tsx`, so the searching\n * variant can stamp it without importing the plain block it replaces: that\n * import would put a second copy of the entries block and its presets in the\n * search chunk, whose parent is the tier, not the entries block.\n */\n\n/**\n * What a searching entries block stamps on its root. The browser looks for it\n * before the page hydrates (`prepareEntriesSearch`); nothing styles or\n * targets it.\n */\nexport const ENTRIES_SEARCH_ATTRIBUTE = 'data-aglyn-entries-search'\n\ntype SearchModule = typeof import('./collection-entries-search')\n\n// One import shared by every caller, as `formControls` in `element-tier.ts`:\n// a loader that hands a second caller a module still being evaluated (jiti,\n// in the AI palette and axe guards) would give it empty exports. A failed\n// load is forgotten so the next placement retries.\nlet searchLoad: Promise<SearchModule> | undefined\n\n/** Both search elements' module, fetched once per visit. */\nexport const loadCollectionSearch = (): Promise<SearchModule> =>\n (searchLoad ??= import('./collection-entries-search').catch(\n (error: unknown) => {\n searchLoad = undefined\n throw error\n },\n ))\n"],"names":["ENTRIES_SEARCH_ATTRIBUTE","searchLoad","loadCollectionSearch","catch","error","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED;;;;CAIC,GACD,OAAO,MAAMA,2BAA2B,4BAA2B;AAInE,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,mDAAmD;AACnD,IAAIC;AAEJ,0DAA0D,GAC1D,OAAO,MAAMC,uBAAuB,IACjCD,qBAAAA,aAAAA,aAAe,MAAM,CAAC,kCAA+BE,KAAK,CACzD,CAACC;QACCH,aAAaI;QACb,MAAMD;IACR,GACA"}
|
|
@@ -233,16 +233,19 @@ AglynFormHelperText.displayName = 'AglynFormHelperText';
|
|
|
233
233
|
});
|
|
234
234
|
AglynSelect.displayName = 'AglynSelect';
|
|
235
235
|
/** One choice in a Select. */ export const AglynSelectOption = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
236
|
-
|
|
236
|
+
// `sx` is a style for an MUI component; a bare `<option>` would print it
|
|
237
|
+
// as an attribute (`sx=",,[object Object]"`).
|
|
238
|
+
const _dropClearedProps = dropClearedProps(props), { value, children, sx: _sx } = _dropClearedProps, rest = _object_without_properties_loose(_dropClearedProps, [
|
|
237
239
|
"value",
|
|
238
|
-
"children"
|
|
240
|
+
"children",
|
|
241
|
+
"sx"
|
|
239
242
|
]);
|
|
240
|
-
const text = typeof children === 'string' ? children : '';
|
|
243
|
+
const text = typeof children === 'string' || typeof children === 'number' ? String(children) : '';
|
|
241
244
|
return /*#__PURE__*/ _jsx("option", _extends({
|
|
242
|
-
ref: ref
|
|
243
|
-
value: value != null ? value : text
|
|
245
|
+
ref: ref
|
|
244
246
|
}, rest, {
|
|
245
|
-
|
|
247
|
+
value: value || text,
|
|
248
|
+
children: text
|
|
246
249
|
}));
|
|
247
250
|
});
|
|
248
251
|
AglynSelectOption.displayName = 'AglynSelectOption';
|
|
@@ -519,8 +522,10 @@ export const selectOptionSchema = {
|
|
|
519
522
|
color: 'info.main'
|
|
520
523
|
}
|
|
521
524
|
},
|
|
525
|
+
// `<option>` holds text and nothing else. Not selfClosing: that strips
|
|
526
|
+
// `children`, and every choice rendered blank.
|
|
522
527
|
flags: {
|
|
523
|
-
|
|
528
|
+
plainTextChildren: Aglyn.FEATURE_FLAG.ENABLED,
|
|
524
529
|
textEditable: Aglyn.FEATURE_FLAG.ENABLED
|
|
525
530
|
},
|
|
526
531
|
attributes: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/form-controls.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport {\n mdiCheckboxMarkedOutline,\n mdiFormDropdown,\n mdiFormTextbox,\n mdiFormatText,\n mdiRadioboxMarked,\n mdiStarOutline,\n mdiTextShort,\n mdiTagOutline,\n mdiFormSelect,\n} from '@aglyn/shared-data-mdi'\nimport Checkbox, { type CheckboxProps } from '@mui/material/Checkbox'\nimport FormControl, { type FormControlProps } from '@mui/material/FormControl'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport FormHelperText, {\n type FormHelperTextProps,\n} from '@mui/material/FormHelperText'\nimport FilledInput from '@mui/material/FilledInput'\nimport FormLabel, { type FormLabelProps } from '@mui/material/FormLabel'\nimport NativeSelect from '@mui/material/NativeSelect'\nimport OutlinedInput from '@mui/material/OutlinedInput'\nimport Radio, { type RadioProps } from '@mui/material/Radio'\nimport RadioGroup, { type RadioGroupProps } from '@mui/material/RadioGroup'\nimport Rating, { type RatingProps } from '@mui/material/Rating'\nimport {\n alpha,\n type SxProps,\n type Theme,\n useTheme,\n} from '@mui/material/styles'\nimport {\n createContext,\n forwardRef,\n type ReactNode,\n useContext,\n useId,\n} from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { FIELD_TEXT_CONTENT } from '../constants/field-presets'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n/*\n * MUI's FORM ELEMENTS, ONE BESIGNER ELEMENT EACH.\n *\n * A field is not one element: it is a Form Control holding a label, an input\n * and a line of help text, exactly as MUI builds it. Each piece is placed,\n * selected and styled on its own — a label's color, an input's fill and\n * corners, the help text's size — with the ordinary Styles panel, and the\n * presets at the bottom of this file are just ready-made arrangements of\n * them. Nothing here knows about forms submitting: an input carries a NAME,\n * and whatever form it sits in sends what the browser sends.\n *\n * Component ids are persisted in documents; never rename them.\n */\nexport const FORM_CONTROL_ID: Aglyn.ComponentId = 'muiFormControl'\nexport const FORM_LABEL_ID: Aglyn.ComponentId = 'muiFormLabel'\nexport const INPUT_ID: Aglyn.ComponentId = 'muiInput'\nexport const FORM_HELPER_TEXT_ID: Aglyn.ComponentId = 'muiFormHelperText'\nexport const SELECT_ID: Aglyn.ComponentId = 'muiSelect'\nexport const SELECT_OPTION_ID: Aglyn.ComponentId = 'muiSelectOption'\nexport const CHECKBOX_ID: Aglyn.ComponentId = 'muiCheckbox'\nexport const RADIO_GROUP_ID: Aglyn.ComponentId = 'muiRadioGroup'\nexport const RADIO_ID: Aglyn.ComponentId = 'muiRadio'\nexport const CHOICE_LABEL_ID: Aglyn.ComponentId = 'muiFormControlLabel'\nexport const RATING_ID: Aglyn.ComponentId = 'muiRating'\n\n/**\n * The Date and Time Pickers' module (AGL-3825), loaded from here so its chunk\n * is a child of this one: see `formPickers` in element-tier.ts.\n */\nexport const loadFormPickers = () => import('./form-pickers')\n\n/**\n * The id a Form Control gives the input inside it, so the Form Label beside\n * that input names it (`for=`) without the author wiring anything.\n */\nexport const FieldIdContext = createContext<string | undefined>(undefined)\n\nexport interface AglynFormControlProps extends FormControlProps {\n children?: ReactNode\n}\n\n/** A field's frame: label, input and help text together. */\nexport const AglynFormControl = forwardRef<HTMLDivElement, AglynFormControlProps>(\n (props, ref) => {\n const id = `field-${useId().replace(/:/g, '')}`\n return (\n <FieldIdContext.Provider value={id}>\n <FormControl ref={ref} {...dropClearedProps(props)} />\n </FieldIdContext.Provider>\n )\n },\n)\nAglynFormControl.displayName = 'AglynFormControl'\n\n/** The label above an input, linked to it by the Form Control. */\nexport const AglynFormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(\n (props, ref) => {\n const id = useContext(FieldIdContext)\n return (\n <FormLabel\n ref={ref as never}\n component=\"label\"\n {...(id ? { htmlFor: id } : {})}\n {...dropClearedProps(props)}\n />\n )\n },\n)\nAglynFormLabel.displayName = 'AglynFormLabel'\n\nexport interface AglynInputProps {\n /** What the answer is sent as. */\n name?: string\n type?: 'text' | 'email' | 'tel' | 'url' | 'number'\n /** Several lines (a message box) instead of one. */\n multiline?: boolean\n /** Lines a multi-line input starts at. */\n minRows?: number\n placeholder?: string\n required?: boolean\n /**\n * A name for assistive technology when no Form Label sits beside the\n * input — a sign-up row with only a placeholder, for one.\n */\n ariaLabel?: string\n fullWidth?: boolean\n [key: string]: any\n}\n\n/**\n * The outline an Input or Select draws, ON ITS OWN BOX.\n *\n * MUI paints an outlined input's border with an inner `<fieldset>`, so the\n * Styles panel's Border Color, Border and Corner Radius — which reach the\n * element's own box — would change nothing a visitor can see. Hiding that\n * fieldset and drawing the same outline (MUI's resting, hover, focus and\n * error colors) on the box itself puts every border and corner field on the\n * outline you actually see. The node's own styles come after, so whatever an\n * author sets wins; focus and error still show through their own rules.\n *\n * The resting outline sits under `:where()`, which weighs nothing, so the\n * site theme's input border color (the Style components card) outranks it,\n * as MUI's own corner radius and the theme's corners already do.\n */\nconst outlinedBoxSx = (theme: Theme) => ({\n '*:where(&)': {\n border: '1px solid',\n borderColor: alpha(theme.palette.text.primary, 0.23),\n },\n '& .MuiOutlinedInput-notchedOutline': { display: 'none' },\n '&:hover': { borderColor: 'text.primary' },\n '&.Mui-focused': {\n borderColor: 'primary.main',\n boxShadow: `0 0 0 1px ${theme.palette.primary.main}`,\n },\n '&.Mui-error': { borderColor: 'error.main' },\n '&.Mui-disabled': { borderColor: 'action.disabled' },\n})\n\n/**\n * Whether the site theme draws inputs filled: the Input style its Style\n * components card sets, which is MUI's own text field default.\n */\nexport const useFilledInputs = () =>\n useTheme().components?.MuiTextField?.defaultProps?.variant === 'filled'\n\n/** A node's `sx`, as a list the outline can go in front of. */\nexport const nodeSxList = (sx: unknown): SxProps<Theme>[] =>\n sx === undefined || sx === null\n ? []\n : ((Array.isArray(sx) ? sx : [sx]) as SxProps<Theme>[])\n\n/** The box a visitor types in. */\nexport const AglynInput = forwardRef<HTMLDivElement, AglynInputProps>(\n (props, ref) => {\n const {\n name,\n type,\n multiline,\n minRows,\n placeholder,\n required,\n ariaLabel,\n datasetFieldId: _datasetFieldId,\n ...rest\n } = dropClearedProps(props)\n const id = useContext(FieldIdContext)\n const filled = useFilledInputs()\n const inputProps = {\n ...(id ? { id } : {}),\n name: name || undefined,\n type: multiline ? undefined : type || 'text',\n multiline: Boolean(multiline),\n ...(multiline ? { minRows: minRows || 3 } : {}),\n placeholder: placeholder || undefined,\n required: Boolean(required),\n inputProps: ariaLabel ? { 'aria-label': ariaLabel } : undefined,\n }\n if (filled) return <FilledInput ref={ref} {...inputProps} {...rest} />\n return (\n <OutlinedInput\n ref={ref}\n // The label is its own element above the box, so the outline never\n // carries a notch for a floating one.\n notched={false}\n {...inputProps}\n {...rest}\n sx={[outlinedBoxSx, ...nodeSxList(rest['sx'])] as SxProps<Theme>}\n />\n )\n },\n)\nAglynInput.displayName = 'AglynInput'\n\n/** One line of help or guidance under a field. */\nexport const AglynFormHelperText = forwardRef<\n HTMLParagraphElement,\n FormHelperTextProps\n>((props, ref) => <FormHelperText ref={ref} {...dropClearedProps(props)} />)\nAglynFormHelperText.displayName = 'AglynFormHelperText'\n\nexport interface AglynSelectProps {\n name?: string\n required?: boolean\n /** Shown until a choice is made; never sent as an answer. */\n placeholder?: string\n ariaLabel?: string\n fullWidth?: boolean\n size?: 'small' | 'medium'\n children?: ReactNode\n [key: string]: any\n}\n\n/**\n * A dropdown. Its choices are Select Option elements inside it — the\n * browser's own list, so every choice is a real element a page can edit.\n */\nexport const AglynSelect = forwardRef<HTMLDivElement, AglynSelectProps>(\n (props, ref) => {\n const {\n name,\n required,\n placeholder,\n ariaLabel,\n children,\n size,\n datasetFieldId: _datasetFieldId,\n ...rest\n } = dropClearedProps(props)\n const id = useContext(FieldIdContext)\n const filled = useFilledInputs()\n return (\n <NativeSelect\n ref={ref}\n input={\n filled ? (\n <FilledInput size={size} sx={rest['sx']} />\n ) : (\n <OutlinedInput\n notched={false}\n size={size}\n sx={[outlinedBoxSx, ...nodeSxList(rest['sx'])] as SxProps<Theme>}\n />\n )\n }\n defaultValue=\"\"\n inputProps={{\n ...(id ? { id } : {}),\n name: name || undefined,\n required: Boolean(required),\n ...(ariaLabel ? { 'aria-label': ariaLabel } : {}),\n }}\n {...rest}\n // The node's styles ride the outlined box above, where they reach\n // what a visitor sees.\n sx={undefined}\n >\n <option value=\"\" disabled={Boolean(required)}>\n {placeholder || ''}\n </option>\n {children}\n </NativeSelect>\n )\n },\n)\nAglynSelect.displayName = 'AglynSelect'\n\nexport interface AglynSelectOptionProps {\n value?: string\n children?: ReactNode\n}\n\n/** One choice in a Select. */\nexport const AglynSelectOption = forwardRef<\n HTMLOptionElement,\n AglynSelectOptionProps\n>((props, ref) => {\n const { value, children, ...rest } = dropClearedProps(props)\n const text = typeof children === 'string' ? children : ''\n return (\n <option ref={ref} value={value ?? text} {...(rest as object)}>\n {children}\n </option>\n )\n})\nAglynSelectOption.displayName = 'AglynSelectOption'\n\n/**\n * The props an answer element hands MUI: cleared values dropped, and the\n * dataset mapping — authoring data read off the node, never a DOM attribute —\n * taken out.\n */\nfunction withoutMapping<T extends object>(props: T): T {\n const { datasetFieldId: _datasetFieldId, ...rest } = dropClearedProps(\n props as T & { datasetFieldId?: unknown },\n )\n return rest as T\n}\n\n/** A tick box. Put it in a Choice Label to give it words. */\nexport const AglynCheckbox = forwardRef<HTMLButtonElement, CheckboxProps>(\n (props, ref) => <Checkbox ref={ref} {...withoutMapping(props)} />,\n)\nAglynCheckbox.displayName = 'AglynCheckbox'\n\n/** A set of Radio choices sharing one name; one may be picked. */\nexport const AglynRadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n (props, ref) => <RadioGroup ref={ref} {...withoutMapping(props)} />,\n)\nAglynRadioGroup.displayName = 'AglynRadioGroup'\n\n/** One choice in a Radio Group. Put it in a Choice Label to give it words. */\nexport const AglynRadio = forwardRef<HTMLButtonElement, RadioProps>(\n (props, ref) => <Radio ref={ref} {...dropClearedProps(props)} />,\n)\nAglynRadio.displayName = 'AglynRadio'\n\nexport interface AglynChoiceLabelProps {\n /** The words beside the tick box or radio. */\n label?: string\n children?: ReactNode\n [key: string]: any\n}\n\n/**\n * The words beside a Checkbox or Radio, clickable as one with it — MUI's\n * FormControlLabel, holding the control as its child element.\n */\nexport const AglynChoiceLabel = forwardRef<HTMLLabelElement, AglynChoiceLabelProps>(\n (props, ref) => {\n const { label, children, ...rest } = dropClearedProps(props)\n return (\n <FormControlLabel\n ref={ref}\n label={label ?? ''}\n // The control is whatever element the author placed inside; a\n // `display: contents` holder keeps it the label's direct box.\n control={<span style={{ display: 'contents' }}>{children}</span>}\n {...rest}\n />\n )\n },\n)\nAglynChoiceLabel.displayName = 'AglynChoiceLabel'\n\n/** Stars a visitor picks; sends the number chosen. */\nexport const AglynRating = forwardRef<HTMLSpanElement, RatingProps>(\n (props, ref) => <Rating ref={ref} {...withoutMapping(props)} />,\n)\nAglynRating.displayName = 'AglynRating'\n\n// ── Attributes ──────────────────────────────────────────────────────────────\n\nexport const FIELD_NAME: Aglyn.AglynAttributeSchema = {\n name: 'name',\n label: 'Field name',\n description:\n 'What the answer is sent as — the key it is stored under in submissions. ' +\n 'Two inputs in one form need two names (radios share their group’s).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\n/**\n * Which field of the form's dataset this answer is stored under — the same\n * picker the all-in-one Form Field had, listing the fields of the dataset\n * chosen on the Form around it. Stored by id, so renaming the dataset field\n * never breaks the mapping; left empty, the answer matches by name.\n */\nexport const FIELD_DATASET_FIELD: Aglyn.AglynAttributeSchema = {\n name: 'datasetFieldId',\n label: 'Maps to schema field',\n description:\n 'The field of the form’s dataset this answer is stored under. Left ' +\n 'empty, it matches a dataset field by its Field name.',\n component: Aglyn.FieldComponentType.DATASET_FIELD_SELECT,\n}\nexport const FIELD_INPUT_SIZE: Aglyn.AglynAttributeSchema = {\n name: 'size',\n label: 'Size',\n description: 'Normal is 56px tall; Small is 40px, to sit beside a button.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'medium', label: 'Normal' },\n { value: 'small', label: 'Small' },\n ],\n}\nexport const FIELD_REQUIRED: Aglyn.AglynAttributeSchema = {\n name: 'required',\n label: 'Required?',\n description: 'The form will not send until this is answered.',\n component: Aglyn.FieldComponentType.SWITCH,\n}\nexport const FIELD_ARIA_LABEL: Aglyn.AglynAttributeSchema = {\n name: 'ariaLabel',\n label: 'Accessible label',\n description:\n 'Names the input for screen readers when there is no Form Label beside ' +\n 'it. Not shown on the page.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\nexport const FIELD_FULL_WIDTH: Aglyn.AglynAttributeSchema = {\n name: 'fullWidth',\n label: 'Full width?',\n description: 'Fills the width of whatever holds it.',\n component: Aglyn.FieldComponentType.SWITCH,\n}\nconst FIELD_PLACEHOLDER: Aglyn.AglynAttributeSchema = {\n name: 'placeholder',\n label: 'Placeholder',\n description:\n 'A gray hint inside the empty input, such as you@company.com. It is ' +\n 'not a label: it disappears as soon as someone types.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\nconst FIELD_CHOICE_VALUE: Aglyn.AglynAttributeSchema = {\n name: 'value',\n label: 'Value',\n description: 'What is sent when this is chosen.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\n\nexport const category = Aglyn.ComponentCategory.FORMS\n\nexport const formControlSchema: Aglyn.ComponentSchema<AglynFormControlProps> = {\n $id: FORM_CONTROL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Form Control',\n description:\n 'One field’s frame: holds a Form Label, an input and Helper Text, and ' +\n 'links the label to the input.',\n category,\n icon: { path: mdiFormTextbox.path, sx: { color: 'info.main' } },\n attributes: [\n FIELD_FULL_WIDTH,\n {\n ...FIELD_REQUIRED,\n description: 'Marks the label with an asterisk. Set Required? on the input too.',\n },\n ],\n}\n\nexport const formLabelSchema: Aglyn.ComponentSchema<FormLabelProps> = {\n $id: FORM_LABEL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Form Label',\n description: 'The words that name a field, above its input.',\n category,\n icon: { path: mdiTagOutline.path, sx: { color: 'info.main' } },\n flags: { textEditable: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_TEXT_CONTENT],\n}\n\nexport const inputSchema: Aglyn.ComponentSchema<AglynInputProps> = {\n $id: INPUT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Input',\n description: 'A box a visitor types in: text, email, phone, link or number.',\n category,\n icon: { path: mdiTextShort.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'type',\n label: 'Type',\n description: 'What goes in it. Email, phone and link bring the right phone keyboard.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'text', label: 'Text' },\n { value: 'email', label: 'Email' },\n { value: 'tel', label: 'Phone' },\n { value: 'url', label: 'Link' },\n { value: 'number', label: 'Number' },\n ],\n },\n FIELD_PLACEHOLDER,\n FIELD_REQUIRED,\n {\n name: 'multiline',\n label: 'Several lines?',\n description: 'A message box instead of a single line.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n FIELD_INPUT_SIZE,\n FIELD_FULL_WIDTH,\n FIELD_ARIA_LABEL,\n ],\n}\n\nexport const formHelperTextSchema: Aglyn.ComponentSchema<FormHelperTextProps> = {\n $id: FORM_HELPER_TEXT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Helper Text',\n description: 'A line of guidance under a field.',\n category,\n icon: { path: mdiFormatText.path, sx: { color: 'info.main' } },\n flags: { textEditable: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_TEXT_CONTENT],\n}\n\nexport const selectSchema: Aglyn.ComponentSchema<AglynSelectProps> = {\n $id: SELECT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Select',\n description: 'A dropdown of Select Options; one may be picked.',\n category,\n icon: { path: mdiFormDropdown.path, sx: { color: 'info.main' } },\n restrictChildren: [\n Aglyn.LinealDirectiveFlag.LIMIT_TO,\n { components: [SELECT_OPTION_ID] },\n ],\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n { ...FIELD_PLACEHOLDER, description: 'Shown until a choice is made; never sent.' },\n FIELD_REQUIRED,\n FIELD_INPUT_SIZE,\n FIELD_FULL_WIDTH,\n FIELD_ARIA_LABEL,\n ],\n}\n\nexport const selectOptionSchema: Aglyn.ComponentSchema<AglynSelectOptionProps> = {\n $id: SELECT_OPTION_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Select Option',\n description: 'One choice in a Select.',\n category,\n icon: { path: mdiFormSelect.path, sx: { color: 'info.main' } },\n flags: {\n selfClosing: Aglyn.FEATURE_FLAG.ENABLED,\n textEditable: Aglyn.FEATURE_FLAG.ENABLED,\n },\n attributes: [\n FIELD_TEXT_CONTENT,\n { ...FIELD_CHOICE_VALUE, description: 'What is sent. Leave empty to send the text.' },\n ],\n}\n\nexport const checkboxSchema: Aglyn.ComponentSchema<CheckboxProps> = {\n $id: CHECKBOX_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Checkbox',\n description: 'A tick box. Put it in a Choice Label to give it words.',\n category,\n icon: { path: mdiCheckboxMarkedOutline.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n { ...FIELD_CHOICE_VALUE, description: 'What is sent when ticked, such as Yes.' },\n FIELD_REQUIRED,\n ],\n}\n\nexport const radioGroupSchema: Aglyn.ComponentSchema<RadioGroupProps> = {\n $id: RADIO_GROUP_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Radio Group',\n description: 'A set of Radio choices; one may be picked.',\n category,\n icon: { path: mdiRadioboxMarked.path, sx: { color: 'info.main' } },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'row',\n label: 'In a row?',\n description: 'Side by side instead of one under another.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n ],\n}\n\nexport const radioSchema: Aglyn.ComponentSchema<RadioProps> = {\n $id: RADIO_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Radio',\n description: 'One choice in a Radio Group. Put it in a Choice Label to give it words.',\n category,\n icon: { path: mdiRadioboxMarked.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_CHOICE_VALUE, FIELD_REQUIRED],\n}\n\nexport const choiceLabelSchema: Aglyn.ComponentSchema<AglynChoiceLabelProps> = {\n $id: CHOICE_LABEL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Choice Label',\n description: 'The words beside a Checkbox or Radio placed inside it; clicking them ticks it.',\n category,\n icon: { path: mdiTagOutline.path, sx: { color: 'info.main' } },\n restrictChildren: [\n Aglyn.LinealDirectiveFlag.LIMIT_TO,\n { components: [CHECKBOX_ID, RADIO_ID] },\n ],\n attributes: [\n {\n name: 'label',\n label: 'Text',\n description: 'The words beside the box.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n ],\n}\n\nexport const ratingSchema: Aglyn.ComponentSchema<RatingProps> = {\n $id: RATING_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Rating',\n description: 'Stars a visitor picks; sends the number chosen.',\n category,\n icon: { path: mdiStarOutline.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'max',\n label: 'Stars',\n description: 'How many stars to show.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n ],\n}\n\n// ── Presets: ready-made arrangements of the pieces above ────────────────────\n\nexport const node = (\n componentId: Aglyn.ComponentId,\n props?: Record<string, unknown>,\n nodes?: Aglyn.NodePresetData[],\n sx?: Record<string, unknown>,\n): Aglyn.NodePresetData =>\n ({\n $id: null,\n componentId,\n pluginId: BUNDLE_ID,\n ...(props ? { props } : {}),\n ...(nodes ? { nodes } : {}),\n ...(sx ? { sx } : {}),\n }) as Aglyn.NodePresetData\n\n/** A labelled text field: Form Control › Form Label + Input. */\nexport const textFieldPreset = (\n label: string,\n input: Record<string, unknown>,\n): Aglyn.NodePresetData =>\n node(FORM_CONTROL_ID, { fullWidth: true }, [\n node(FORM_LABEL_ID, { children: label }),\n node(INPUT_ID, { fullWidth: true, ...input }),\n ])\n\nexport const preset = (\n $id: string,\n displayName: string,\n description: string,\n icon: string,\n data: Aglyn.NodePresetData,\n): Aglyn.PresetSchema => ({\n $id,\n type: Aglyn.NodeType.PRESET,\n displayName,\n description,\n pluginId: BUNDLE_ID,\n category,\n icon: { path: icon, sx: { color: 'info.main' } },\n data,\n})\n\n/**\n * Each element on its own, so any piece can be inserted by itself — a bare\n * Input beside a Button in a sign-up row, a Form Label above a field the\n * author is assembling, one more Radio in a group. The field presets below\n * are ready-made arrangements of the same pieces.\n */\nconst singleElementPresets: Aglyn.PresetSchema[] = [\n preset(\n generatePresetId(FORM_CONTROL_ID),\n 'Form Control',\n 'An empty field frame: put a Form Label, an input and Helper Text in it.',\n mdiFormTextbox.path,\n node(FORM_CONTROL_ID, { fullWidth: true }),\n ),\n preset(\n generatePresetId(FORM_LABEL_ID),\n 'Form Label',\n 'The words that name a field, above its input.',\n mdiTagOutline.path,\n node(FORM_LABEL_ID, { children: 'Label' }),\n ),\n preset(\n generatePresetId(INPUT_ID),\n 'Input',\n 'A box a visitor types in, on its own.',\n mdiTextShort.path,\n node(INPUT_ID, { name: 'field', placeholder: 'Type here' }),\n ),\n preset(\n generatePresetId(SELECT_ID),\n 'Select',\n 'A dropdown with two options.',\n mdiFormDropdown.path,\n node(SELECT_ID, { name: 'choice', placeholder: 'Choose…' }, [\n node(SELECT_OPTION_ID, { children: 'Option one' }),\n node(SELECT_OPTION_ID, { children: 'Option two' }),\n ]),\n ),\n preset(\n generatePresetId(SELECT_OPTION_ID),\n 'Select Option',\n 'One more choice for a Select.',\n mdiFormSelect.path,\n node(SELECT_OPTION_ID, { children: 'Option' }),\n ),\n preset(\n generatePresetId(RADIO_GROUP_ID),\n 'Radio Group',\n 'A set of Radio choices sharing one Field name.',\n mdiRadioboxMarked.path,\n node(RADIO_GROUP_ID, { name: 'pick' }, [\n node(CHOICE_LABEL_ID, { label: 'First' }, [node(RADIO_ID, { value: 'First' })]),\n node(CHOICE_LABEL_ID, { label: 'Second' }, [node(RADIO_ID, { value: 'Second' })]),\n ]),\n ),\n preset(\n generatePresetId(RADIO_ID),\n 'Radio',\n 'One more choice for a Radio Group, with its words.',\n mdiRadioboxMarked.path,\n node(CHOICE_LABEL_ID, { label: 'Another choice' }, [\n node(RADIO_ID, { value: 'Another choice' }),\n ]),\n ),\n preset(\n generatePresetId(CHOICE_LABEL_ID),\n 'Choice Label',\n 'Words beside a tick box; holds a Checkbox.',\n mdiTagOutline.path,\n node(CHOICE_LABEL_ID, { label: 'Yes, please' }, [\n node(CHECKBOX_ID, { name: 'agree', value: 'Yes' }),\n ]),\n ),\n preset(\n generatePresetId(RATING_ID),\n 'Rating',\n 'Five stars, on their own.',\n mdiStarOutline.path,\n node(RATING_ID, { name: 'rating' }),\n ),\n]\n\nexport const formControlPresets: Aglyn.PresetSchema[] = [\n ...singleElementPresets,\n preset(\n generatePresetId(FORM_CONTROL_ID, 'text'),\n 'Text field',\n 'A label and a one-line input.',\n mdiFormTextbox.path,\n textFieldPreset('Name', { name: 'name' }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'email'),\n 'Email field',\n 'A label and an email input.',\n mdiFormTextbox.path,\n textFieldPreset('Email', { name: 'email', type: 'email', required: true }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'message'),\n 'Message field',\n 'A label and a several-line input.',\n mdiFormTextbox.path,\n textFieldPreset('Message', { name: 'message', multiline: true, minRows: 4 }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'select'),\n 'Dropdown field',\n 'A label and a Select with three options.',\n mdiFormDropdown.path,\n node(FORM_CONTROL_ID, { fullWidth: true }, [\n node(FORM_LABEL_ID, { children: 'Choose one' }),\n node(SELECT_ID, { name: 'choice', fullWidth: true, placeholder: 'Choose…' }, [\n node(SELECT_OPTION_ID, { children: 'Option one' }),\n node(SELECT_OPTION_ID, { children: 'Option two' }),\n node(SELECT_OPTION_ID, { children: 'Option three' }),\n ]),\n ]),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'radio'),\n 'Radio choice field',\n 'A label and a Radio Group with three choices.',\n mdiRadioboxMarked.path,\n node(FORM_CONTROL_ID, {}, [\n node(FORM_LABEL_ID, { children: 'Pick one' }),\n node(RADIO_GROUP_ID, { name: 'pick' }, [\n node(CHOICE_LABEL_ID, { label: 'First' }, [node(RADIO_ID, { value: 'First' })]),\n node(CHOICE_LABEL_ID, { label: 'Second' }, [node(RADIO_ID, { value: 'Second' })]),\n node(CHOICE_LABEL_ID, { label: 'Third' }, [node(RADIO_ID, { value: 'Third' })]),\n ]),\n ]),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'checkbox'),\n 'Checkbox',\n 'A tick box with words beside it.',\n mdiCheckboxMarkedOutline.path,\n node(CHOICE_LABEL_ID, { label: 'Yes, please' }, [\n node(CHECKBOX_ID, { name: 'agree', value: 'Yes' }),\n ]),\n ),\n preset(\n generatePresetId(FORM_HELPER_TEXT_ID),\n 'Helper Text',\n 'A line of guidance under a field.',\n mdiFormatText.path,\n node(FORM_HELPER_TEXT_ID, { children: 'We never share your address.' }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'rating'),\n 'Rating field',\n 'A label and five stars.',\n mdiStarOutline.path,\n node(FORM_CONTROL_ID, {}, [\n node(FORM_LABEL_ID, { children: 'How did we do?' }),\n node(RATING_ID, { name: 'rating' }),\n ]),\n ),\n]\n"],"names":["Aglyn","mdiCheckboxMarkedOutline","mdiFormDropdown","mdiFormTextbox","mdiFormatText","mdiRadioboxMarked","mdiStarOutline","mdiTextShort","mdiTagOutline","mdiFormSelect","Checkbox","FormControl","FormControlLabel","FormHelperText","FilledInput","FormLabel","NativeSelect","OutlinedInput","Radio","RadioGroup","Rating","alpha","useTheme","createContext","forwardRef","useContext","useId","BUNDLE_ID","FIELD_TEXT_CONTENT","dropClearedProps","generatePresetId","FORM_CONTROL_ID","FORM_LABEL_ID","INPUT_ID","FORM_HELPER_TEXT_ID","SELECT_ID","SELECT_OPTION_ID","CHECKBOX_ID","RADIO_GROUP_ID","RADIO_ID","CHOICE_LABEL_ID","RATING_ID","loadFormPickers","FieldIdContext","undefined","AglynFormControl","props","ref","id","replace","Provider","value","displayName","AglynFormLabel","component","htmlFor","outlinedBoxSx","theme","border","borderColor","palette","text","primary","display","boxShadow","main","useFilledInputs","components","MuiTextField","defaultProps","variant","nodeSxList","sx","Array","isArray","AglynInput","name","type","multiline","minRows","placeholder","required","ariaLabel","datasetFieldId","_datasetFieldId","rest","filled","inputProps","Boolean","notched","AglynFormHelperText","AglynSelect","children","size","input","defaultValue","option","disabled","AglynSelectOption","withoutMapping","AglynCheckbox","AglynRadioGroup","AglynRadio","AglynChoiceLabel","label","control","span","style","AglynRating","FIELD_NAME","description","FieldComponentType","TEXT_FIELD","FIELD_DATASET_FIELD","DATASET_FIELD_SELECT","FIELD_INPUT_SIZE","SELECT","options","FIELD_REQUIRED","SWITCH","FIELD_ARIA_LABEL","FIELD_FULL_WIDTH","FIELD_PLACEHOLDER","FIELD_CHOICE_VALUE","category","ComponentCategory","FORMS","formControlSchema","$id","pluginId","icon","path","color","attributes","formLabelSchema","flags","textEditable","FEATURE_FLAG","ENABLED","inputSchema","selfClosing","formHelperTextSchema","selectSchema","restrictChildren","LinealDirectiveFlag","LIMIT_TO","selectOptionSchema","checkboxSchema","radioGroupSchema","radioSchema","choiceLabelSchema","ratingSchema","node","componentId","nodes","textFieldPreset","fullWidth","preset","data","NodeType","PRESET","singleElementPresets","formControlPresets"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,wBAAwB,EACxBC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,aAAa,QACR,yBAAwB;AAC/B,OAAOC,cAAsC,yBAAwB;AACrE,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e6H,IAAI,EACnBqB,KAAKzH,iBAAiB,CAAC,GAAG;QACxByH,KAAKxH,eAAe;YAAE4D,UAAU;QAAiB;QACjD4D,KAAK/G,WAAW;YAAEmC,MAAM;QAAS;KAClC;CAEJ,CAAA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/form-controls.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport {\n mdiCheckboxMarkedOutline,\n mdiFormDropdown,\n mdiFormTextbox,\n mdiFormatText,\n mdiRadioboxMarked,\n mdiStarOutline,\n mdiTextShort,\n mdiTagOutline,\n mdiFormSelect,\n} from '@aglyn/shared-data-mdi'\nimport Checkbox, { type CheckboxProps } from '@mui/material/Checkbox'\nimport FormControl, { type FormControlProps } from '@mui/material/FormControl'\nimport FormControlLabel from '@mui/material/FormControlLabel'\nimport FormHelperText, {\n type FormHelperTextProps,\n} from '@mui/material/FormHelperText'\nimport FilledInput from '@mui/material/FilledInput'\nimport FormLabel, { type FormLabelProps } from '@mui/material/FormLabel'\nimport NativeSelect from '@mui/material/NativeSelect'\nimport OutlinedInput from '@mui/material/OutlinedInput'\nimport Radio, { type RadioProps } from '@mui/material/Radio'\nimport RadioGroup, { type RadioGroupProps } from '@mui/material/RadioGroup'\nimport Rating, { type RatingProps } from '@mui/material/Rating'\nimport {\n alpha,\n type SxProps,\n type Theme,\n useTheme,\n} from '@mui/material/styles'\nimport {\n createContext,\n forwardRef,\n type ReactNode,\n useContext,\n useId,\n} from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { FIELD_TEXT_CONTENT } from '../constants/field-presets'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n/*\n * MUI's FORM ELEMENTS, ONE BESIGNER ELEMENT EACH.\n *\n * A field is not one element: it is a Form Control holding a label, an input\n * and a line of help text, exactly as MUI builds it. Each piece is placed,\n * selected and styled on its own — a label's color, an input's fill and\n * corners, the help text's size — with the ordinary Styles panel, and the\n * presets at the bottom of this file are just ready-made arrangements of\n * them. Nothing here knows about forms submitting: an input carries a NAME,\n * and whatever form it sits in sends what the browser sends.\n *\n * Component ids are persisted in documents; never rename them.\n */\nexport const FORM_CONTROL_ID: Aglyn.ComponentId = 'muiFormControl'\nexport const FORM_LABEL_ID: Aglyn.ComponentId = 'muiFormLabel'\nexport const INPUT_ID: Aglyn.ComponentId = 'muiInput'\nexport const FORM_HELPER_TEXT_ID: Aglyn.ComponentId = 'muiFormHelperText'\nexport const SELECT_ID: Aglyn.ComponentId = 'muiSelect'\nexport const SELECT_OPTION_ID: Aglyn.ComponentId = 'muiSelectOption'\nexport const CHECKBOX_ID: Aglyn.ComponentId = 'muiCheckbox'\nexport const RADIO_GROUP_ID: Aglyn.ComponentId = 'muiRadioGroup'\nexport const RADIO_ID: Aglyn.ComponentId = 'muiRadio'\nexport const CHOICE_LABEL_ID: Aglyn.ComponentId = 'muiFormControlLabel'\nexport const RATING_ID: Aglyn.ComponentId = 'muiRating'\n\n/**\n * The Date and Time Pickers' module (AGL-3825), loaded from here so its chunk\n * is a child of this one: see `formPickers` in element-tier.ts.\n */\nexport const loadFormPickers = () => import('./form-pickers')\n\n/**\n * The id a Form Control gives the input inside it, so the Form Label beside\n * that input names it (`for=`) without the author wiring anything.\n */\nexport const FieldIdContext = createContext<string | undefined>(undefined)\n\nexport interface AglynFormControlProps extends FormControlProps {\n children?: ReactNode\n}\n\n/** A field's frame: label, input and help text together. */\nexport const AglynFormControl = forwardRef<HTMLDivElement, AglynFormControlProps>(\n (props, ref) => {\n const id = `field-${useId().replace(/:/g, '')}`\n return (\n <FieldIdContext.Provider value={id}>\n <FormControl ref={ref} {...dropClearedProps(props)} />\n </FieldIdContext.Provider>\n )\n },\n)\nAglynFormControl.displayName = 'AglynFormControl'\n\n/** The label above an input, linked to it by the Form Control. */\nexport const AglynFormLabel = forwardRef<HTMLLabelElement, FormLabelProps>(\n (props, ref) => {\n const id = useContext(FieldIdContext)\n return (\n <FormLabel\n ref={ref as never}\n component=\"label\"\n {...(id ? { htmlFor: id } : {})}\n {...dropClearedProps(props)}\n />\n )\n },\n)\nAglynFormLabel.displayName = 'AglynFormLabel'\n\nexport interface AglynInputProps {\n /** What the answer is sent as. */\n name?: string\n type?: 'text' | 'email' | 'tel' | 'url' | 'number'\n /** Several lines (a message box) instead of one. */\n multiline?: boolean\n /** Lines a multi-line input starts at. */\n minRows?: number\n placeholder?: string\n required?: boolean\n /**\n * A name for assistive technology when no Form Label sits beside the\n * input — a sign-up row with only a placeholder, for one.\n */\n ariaLabel?: string\n fullWidth?: boolean\n [key: string]: any\n}\n\n/**\n * The outline an Input or Select draws, ON ITS OWN BOX.\n *\n * MUI paints an outlined input's border with an inner `<fieldset>`, so the\n * Styles panel's Border Color, Border and Corner Radius — which reach the\n * element's own box — would change nothing a visitor can see. Hiding that\n * fieldset and drawing the same outline (MUI's resting, hover, focus and\n * error colors) on the box itself puts every border and corner field on the\n * outline you actually see. The node's own styles come after, so whatever an\n * author sets wins; focus and error still show through their own rules.\n *\n * The resting outline sits under `:where()`, which weighs nothing, so the\n * site theme's input border color (the Style components card) outranks it,\n * as MUI's own corner radius and the theme's corners already do.\n */\nconst outlinedBoxSx = (theme: Theme) => ({\n '*:where(&)': {\n border: '1px solid',\n borderColor: alpha(theme.palette.text.primary, 0.23),\n },\n '& .MuiOutlinedInput-notchedOutline': { display: 'none' },\n '&:hover': { borderColor: 'text.primary' },\n '&.Mui-focused': {\n borderColor: 'primary.main',\n boxShadow: `0 0 0 1px ${theme.palette.primary.main}`,\n },\n '&.Mui-error': { borderColor: 'error.main' },\n '&.Mui-disabled': { borderColor: 'action.disabled' },\n})\n\n/**\n * Whether the site theme draws inputs filled: the Input style its Style\n * components card sets, which is MUI's own text field default.\n */\nexport const useFilledInputs = () =>\n useTheme().components?.MuiTextField?.defaultProps?.variant === 'filled'\n\n/** A node's `sx`, as a list the outline can go in front of. */\nexport const nodeSxList = (sx: unknown): SxProps<Theme>[] =>\n sx === undefined || sx === null\n ? []\n : ((Array.isArray(sx) ? sx : [sx]) as SxProps<Theme>[])\n\n/** The box a visitor types in. */\nexport const AglynInput = forwardRef<HTMLDivElement, AglynInputProps>(\n (props, ref) => {\n const {\n name,\n type,\n multiline,\n minRows,\n placeholder,\n required,\n ariaLabel,\n datasetFieldId: _datasetFieldId,\n ...rest\n } = dropClearedProps(props)\n const id = useContext(FieldIdContext)\n const filled = useFilledInputs()\n const inputProps = {\n ...(id ? { id } : {}),\n name: name || undefined,\n type: multiline ? undefined : type || 'text',\n multiline: Boolean(multiline),\n ...(multiline ? { minRows: minRows || 3 } : {}),\n placeholder: placeholder || undefined,\n required: Boolean(required),\n inputProps: ariaLabel ? { 'aria-label': ariaLabel } : undefined,\n }\n if (filled) return <FilledInput ref={ref} {...inputProps} {...rest} />\n return (\n <OutlinedInput\n ref={ref}\n // The label is its own element above the box, so the outline never\n // carries a notch for a floating one.\n notched={false}\n {...inputProps}\n {...rest}\n sx={[outlinedBoxSx, ...nodeSxList(rest['sx'])] as SxProps<Theme>}\n />\n )\n },\n)\nAglynInput.displayName = 'AglynInput'\n\n/** One line of help or guidance under a field. */\nexport const AglynFormHelperText = forwardRef<\n HTMLParagraphElement,\n FormHelperTextProps\n>((props, ref) => <FormHelperText ref={ref} {...dropClearedProps(props)} />)\nAglynFormHelperText.displayName = 'AglynFormHelperText'\n\nexport interface AglynSelectProps {\n name?: string\n required?: boolean\n /** Shown until a choice is made; never sent as an answer. */\n placeholder?: string\n ariaLabel?: string\n fullWidth?: boolean\n size?: 'small' | 'medium'\n children?: ReactNode\n [key: string]: any\n}\n\n/**\n * A dropdown. Its choices are Select Option elements inside it — the\n * browser's own list, so every choice is a real element a page can edit.\n */\nexport const AglynSelect = forwardRef<HTMLDivElement, AglynSelectProps>(\n (props, ref) => {\n const {\n name,\n required,\n placeholder,\n ariaLabel,\n children,\n size,\n datasetFieldId: _datasetFieldId,\n ...rest\n } = dropClearedProps(props)\n const id = useContext(FieldIdContext)\n const filled = useFilledInputs()\n return (\n <NativeSelect\n ref={ref}\n input={\n filled ? (\n <FilledInput size={size} sx={rest['sx']} />\n ) : (\n <OutlinedInput\n notched={false}\n size={size}\n sx={[outlinedBoxSx, ...nodeSxList(rest['sx'])] as SxProps<Theme>}\n />\n )\n }\n defaultValue=\"\"\n inputProps={{\n ...(id ? { id } : {}),\n name: name || undefined,\n required: Boolean(required),\n ...(ariaLabel ? { 'aria-label': ariaLabel } : {}),\n }}\n {...rest}\n // The node's styles ride the outlined box above, where they reach\n // what a visitor sees.\n sx={undefined}\n >\n <option value=\"\" disabled={Boolean(required)}>\n {placeholder || ''}\n </option>\n {children}\n </NativeSelect>\n )\n },\n)\nAglynSelect.displayName = 'AglynSelect'\n\nexport interface AglynSelectOptionProps {\n value?: string\n children?: ReactNode\n}\n\n/** One choice in a Select. */\nexport const AglynSelectOption = forwardRef<\n HTMLOptionElement,\n AglynSelectOptionProps\n>((props, ref) => {\n // `sx` is a style for an MUI component; a bare `<option>` would print it\n // as an attribute (`sx=\",,[object Object]\"`).\n const { value, children, sx: _sx, ...rest } = dropClearedProps(\n props as AglynSelectOptionProps & { sx?: unknown },\n )\n const text =\n typeof children === 'string' || typeof children === 'number'\n ? String(children)\n : ''\n return (\n <option ref={ref} {...(rest as object)} value={value || text}>\n {text}\n </option>\n )\n})\nAglynSelectOption.displayName = 'AglynSelectOption'\n\n/**\n * The props an answer element hands MUI: cleared values dropped, and the\n * dataset mapping — authoring data read off the node, never a DOM attribute —\n * taken out.\n */\nfunction withoutMapping<T extends object>(props: T): T {\n const { datasetFieldId: _datasetFieldId, ...rest } = dropClearedProps(\n props as T & { datasetFieldId?: unknown },\n )\n return rest as T\n}\n\n/** A tick box. Put it in a Choice Label to give it words. */\nexport const AglynCheckbox = forwardRef<HTMLButtonElement, CheckboxProps>(\n (props, ref) => <Checkbox ref={ref} {...withoutMapping(props)} />,\n)\nAglynCheckbox.displayName = 'AglynCheckbox'\n\n/** A set of Radio choices sharing one name; one may be picked. */\nexport const AglynRadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(\n (props, ref) => <RadioGroup ref={ref} {...withoutMapping(props)} />,\n)\nAglynRadioGroup.displayName = 'AglynRadioGroup'\n\n/** One choice in a Radio Group. Put it in a Choice Label to give it words. */\nexport const AglynRadio = forwardRef<HTMLButtonElement, RadioProps>(\n (props, ref) => <Radio ref={ref} {...dropClearedProps(props)} />,\n)\nAglynRadio.displayName = 'AglynRadio'\n\nexport interface AglynChoiceLabelProps {\n /** The words beside the tick box or radio. */\n label?: string\n children?: ReactNode\n [key: string]: any\n}\n\n/**\n * The words beside a Checkbox or Radio, clickable as one with it — MUI's\n * FormControlLabel, holding the control as its child element.\n */\nexport const AglynChoiceLabel = forwardRef<HTMLLabelElement, AglynChoiceLabelProps>(\n (props, ref) => {\n const { label, children, ...rest } = dropClearedProps(props)\n return (\n <FormControlLabel\n ref={ref}\n label={label ?? ''}\n // The control is whatever element the author placed inside; a\n // `display: contents` holder keeps it the label's direct box.\n control={<span style={{ display: 'contents' }}>{children}</span>}\n {...rest}\n />\n )\n },\n)\nAglynChoiceLabel.displayName = 'AglynChoiceLabel'\n\n/** Stars a visitor picks; sends the number chosen. */\nexport const AglynRating = forwardRef<HTMLSpanElement, RatingProps>(\n (props, ref) => <Rating ref={ref} {...withoutMapping(props)} />,\n)\nAglynRating.displayName = 'AglynRating'\n\n// ── Attributes ──────────────────────────────────────────────────────────────\n\nexport const FIELD_NAME: Aglyn.AglynAttributeSchema = {\n name: 'name',\n label: 'Field name',\n description:\n 'What the answer is sent as — the key it is stored under in submissions. ' +\n 'Two inputs in one form need two names (radios share their group’s).',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\n/**\n * Which field of the form's dataset this answer is stored under — the same\n * picker the all-in-one Form Field had, listing the fields of the dataset\n * chosen on the Form around it. Stored by id, so renaming the dataset field\n * never breaks the mapping; left empty, the answer matches by name.\n */\nexport const FIELD_DATASET_FIELD: Aglyn.AglynAttributeSchema = {\n name: 'datasetFieldId',\n label: 'Maps to schema field',\n description:\n 'The field of the form’s dataset this answer is stored under. Left ' +\n 'empty, it matches a dataset field by its Field name.',\n component: Aglyn.FieldComponentType.DATASET_FIELD_SELECT,\n}\nexport const FIELD_INPUT_SIZE: Aglyn.AglynAttributeSchema = {\n name: 'size',\n label: 'Size',\n description: 'Normal is 56px tall; Small is 40px, to sit beside a button.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'medium', label: 'Normal' },\n { value: 'small', label: 'Small' },\n ],\n}\nexport const FIELD_REQUIRED: Aglyn.AglynAttributeSchema = {\n name: 'required',\n label: 'Required?',\n description: 'The form will not send until this is answered.',\n component: Aglyn.FieldComponentType.SWITCH,\n}\nexport const FIELD_ARIA_LABEL: Aglyn.AglynAttributeSchema = {\n name: 'ariaLabel',\n label: 'Accessible label',\n description:\n 'Names the input for screen readers when there is no Form Label beside ' +\n 'it. Not shown on the page.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\nexport const FIELD_FULL_WIDTH: Aglyn.AglynAttributeSchema = {\n name: 'fullWidth',\n label: 'Full width?',\n description: 'Fills the width of whatever holds it.',\n component: Aglyn.FieldComponentType.SWITCH,\n}\nconst FIELD_PLACEHOLDER: Aglyn.AglynAttributeSchema = {\n name: 'placeholder',\n label: 'Placeholder',\n description:\n 'A gray hint inside the empty input, such as you@company.com. It is ' +\n 'not a label: it disappears as soon as someone types.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\nconst FIELD_CHOICE_VALUE: Aglyn.AglynAttributeSchema = {\n name: 'value',\n label: 'Value',\n description: 'What is sent when this is chosen.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n}\n\nexport const category = Aglyn.ComponentCategory.FORMS\n\nexport const formControlSchema: Aglyn.ComponentSchema<AglynFormControlProps> = {\n $id: FORM_CONTROL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Form Control',\n description:\n 'One field’s frame: holds a Form Label, an input and Helper Text, and ' +\n 'links the label to the input.',\n category,\n icon: { path: mdiFormTextbox.path, sx: { color: 'info.main' } },\n attributes: [\n FIELD_FULL_WIDTH,\n {\n ...FIELD_REQUIRED,\n description: 'Marks the label with an asterisk. Set Required? on the input too.',\n },\n ],\n}\n\nexport const formLabelSchema: Aglyn.ComponentSchema<FormLabelProps> = {\n $id: FORM_LABEL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Form Label',\n description: 'The words that name a field, above its input.',\n category,\n icon: { path: mdiTagOutline.path, sx: { color: 'info.main' } },\n flags: { textEditable: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_TEXT_CONTENT],\n}\n\nexport const inputSchema: Aglyn.ComponentSchema<AglynInputProps> = {\n $id: INPUT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Input',\n description: 'A box a visitor types in: text, email, phone, link or number.',\n category,\n icon: { path: mdiTextShort.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'type',\n label: 'Type',\n description: 'What goes in it. Email, phone and link bring the right phone keyboard.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'text', label: 'Text' },\n { value: 'email', label: 'Email' },\n { value: 'tel', label: 'Phone' },\n { value: 'url', label: 'Link' },\n { value: 'number', label: 'Number' },\n ],\n },\n FIELD_PLACEHOLDER,\n FIELD_REQUIRED,\n {\n name: 'multiline',\n label: 'Several lines?',\n description: 'A message box instead of a single line.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n FIELD_INPUT_SIZE,\n FIELD_FULL_WIDTH,\n FIELD_ARIA_LABEL,\n ],\n}\n\nexport const formHelperTextSchema: Aglyn.ComponentSchema<FormHelperTextProps> = {\n $id: FORM_HELPER_TEXT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Helper Text',\n description: 'A line of guidance under a field.',\n category,\n icon: { path: mdiFormatText.path, sx: { color: 'info.main' } },\n flags: { textEditable: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_TEXT_CONTENT],\n}\n\nexport const selectSchema: Aglyn.ComponentSchema<AglynSelectProps> = {\n $id: SELECT_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Select',\n description: 'A dropdown of Select Options; one may be picked.',\n category,\n icon: { path: mdiFormDropdown.path, sx: { color: 'info.main' } },\n restrictChildren: [\n Aglyn.LinealDirectiveFlag.LIMIT_TO,\n { components: [SELECT_OPTION_ID] },\n ],\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n { ...FIELD_PLACEHOLDER, description: 'Shown until a choice is made; never sent.' },\n FIELD_REQUIRED,\n FIELD_INPUT_SIZE,\n FIELD_FULL_WIDTH,\n FIELD_ARIA_LABEL,\n ],\n}\n\nexport const selectOptionSchema: Aglyn.ComponentSchema<AglynSelectOptionProps> = {\n $id: SELECT_OPTION_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Select Option',\n description: 'One choice in a Select.',\n category,\n icon: { path: mdiFormSelect.path, sx: { color: 'info.main' } },\n // `<option>` holds text and nothing else. Not selfClosing: that strips\n // `children`, and every choice rendered blank.\n flags: {\n plainTextChildren: Aglyn.FEATURE_FLAG.ENABLED,\n textEditable: Aglyn.FEATURE_FLAG.ENABLED,\n },\n attributes: [\n FIELD_TEXT_CONTENT,\n { ...FIELD_CHOICE_VALUE, description: 'What is sent. Leave empty to send the text.' },\n ],\n}\n\nexport const checkboxSchema: Aglyn.ComponentSchema<CheckboxProps> = {\n $id: CHECKBOX_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Checkbox',\n description: 'A tick box. Put it in a Choice Label to give it words.',\n category,\n icon: { path: mdiCheckboxMarkedOutline.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n { ...FIELD_CHOICE_VALUE, description: 'What is sent when ticked, such as Yes.' },\n FIELD_REQUIRED,\n ],\n}\n\nexport const radioGroupSchema: Aglyn.ComponentSchema<RadioGroupProps> = {\n $id: RADIO_GROUP_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Radio Group',\n description: 'A set of Radio choices; one may be picked.',\n category,\n icon: { path: mdiRadioboxMarked.path, sx: { color: 'info.main' } },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'row',\n label: 'In a row?',\n description: 'Side by side instead of one under another.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n ],\n}\n\nexport const radioSchema: Aglyn.ComponentSchema<RadioProps> = {\n $id: RADIO_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Radio',\n description: 'One choice in a Radio Group. Put it in a Choice Label to give it words.',\n category,\n icon: { path: mdiRadioboxMarked.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [FIELD_CHOICE_VALUE, FIELD_REQUIRED],\n}\n\nexport const choiceLabelSchema: Aglyn.ComponentSchema<AglynChoiceLabelProps> = {\n $id: CHOICE_LABEL_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Choice Label',\n description: 'The words beside a Checkbox or Radio placed inside it; clicking them ticks it.',\n category,\n icon: { path: mdiTagOutline.path, sx: { color: 'info.main' } },\n restrictChildren: [\n Aglyn.LinealDirectiveFlag.LIMIT_TO,\n { components: [CHECKBOX_ID, RADIO_ID] },\n ],\n attributes: [\n {\n name: 'label',\n label: 'Text',\n description: 'The words beside the box.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n },\n ],\n}\n\nexport const ratingSchema: Aglyn.ComponentSchema<RatingProps> = {\n $id: RATING_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Rating',\n description: 'Stars a visitor picks; sends the number chosen.',\n category,\n icon: { path: mdiStarOutline.path, sx: { color: 'info.main' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n FIELD_NAME,\n FIELD_DATASET_FIELD,\n {\n name: 'max',\n label: 'Stars',\n description: 'How many stars to show.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n ],\n}\n\n// ── Presets: ready-made arrangements of the pieces above ────────────────────\n\nexport const node = (\n componentId: Aglyn.ComponentId,\n props?: Record<string, unknown>,\n nodes?: Aglyn.NodePresetData[],\n sx?: Record<string, unknown>,\n): Aglyn.NodePresetData =>\n ({\n $id: null,\n componentId,\n pluginId: BUNDLE_ID,\n ...(props ? { props } : {}),\n ...(nodes ? { nodes } : {}),\n ...(sx ? { sx } : {}),\n }) as Aglyn.NodePresetData\n\n/** A labelled text field: Form Control › Form Label + Input. */\nexport const textFieldPreset = (\n label: string,\n input: Record<string, unknown>,\n): Aglyn.NodePresetData =>\n node(FORM_CONTROL_ID, { fullWidth: true }, [\n node(FORM_LABEL_ID, { children: label }),\n node(INPUT_ID, { fullWidth: true, ...input }),\n ])\n\nexport const preset = (\n $id: string,\n displayName: string,\n description: string,\n icon: string,\n data: Aglyn.NodePresetData,\n): Aglyn.PresetSchema => ({\n $id,\n type: Aglyn.NodeType.PRESET,\n displayName,\n description,\n pluginId: BUNDLE_ID,\n category,\n icon: { path: icon, sx: { color: 'info.main' } },\n data,\n})\n\n/**\n * Each element on its own, so any piece can be inserted by itself — a bare\n * Input beside a Button in a sign-up row, a Form Label above a field the\n * author is assembling, one more Radio in a group. The field presets below\n * are ready-made arrangements of the same pieces.\n */\nconst singleElementPresets: Aglyn.PresetSchema[] = [\n preset(\n generatePresetId(FORM_CONTROL_ID),\n 'Form Control',\n 'An empty field frame: put a Form Label, an input and Helper Text in it.',\n mdiFormTextbox.path,\n node(FORM_CONTROL_ID, { fullWidth: true }),\n ),\n preset(\n generatePresetId(FORM_LABEL_ID),\n 'Form Label',\n 'The words that name a field, above its input.',\n mdiTagOutline.path,\n node(FORM_LABEL_ID, { children: 'Label' }),\n ),\n preset(\n generatePresetId(INPUT_ID),\n 'Input',\n 'A box a visitor types in, on its own.',\n mdiTextShort.path,\n node(INPUT_ID, { name: 'field', placeholder: 'Type here' }),\n ),\n preset(\n generatePresetId(SELECT_ID),\n 'Select',\n 'A dropdown with two options.',\n mdiFormDropdown.path,\n node(SELECT_ID, { name: 'choice', placeholder: 'Choose…' }, [\n node(SELECT_OPTION_ID, { children: 'Option one' }),\n node(SELECT_OPTION_ID, { children: 'Option two' }),\n ]),\n ),\n preset(\n generatePresetId(SELECT_OPTION_ID),\n 'Select Option',\n 'One more choice for a Select.',\n mdiFormSelect.path,\n node(SELECT_OPTION_ID, { children: 'Option' }),\n ),\n preset(\n generatePresetId(RADIO_GROUP_ID),\n 'Radio Group',\n 'A set of Radio choices sharing one Field name.',\n mdiRadioboxMarked.path,\n node(RADIO_GROUP_ID, { name: 'pick' }, [\n node(CHOICE_LABEL_ID, { label: 'First' }, [node(RADIO_ID, { value: 'First' })]),\n node(CHOICE_LABEL_ID, { label: 'Second' }, [node(RADIO_ID, { value: 'Second' })]),\n ]),\n ),\n preset(\n generatePresetId(RADIO_ID),\n 'Radio',\n 'One more choice for a Radio Group, with its words.',\n mdiRadioboxMarked.path,\n node(CHOICE_LABEL_ID, { label: 'Another choice' }, [\n node(RADIO_ID, { value: 'Another choice' }),\n ]),\n ),\n preset(\n generatePresetId(CHOICE_LABEL_ID),\n 'Choice Label',\n 'Words beside a tick box; holds a Checkbox.',\n mdiTagOutline.path,\n node(CHOICE_LABEL_ID, { label: 'Yes, please' }, [\n node(CHECKBOX_ID, { name: 'agree', value: 'Yes' }),\n ]),\n ),\n preset(\n generatePresetId(RATING_ID),\n 'Rating',\n 'Five stars, on their own.',\n mdiStarOutline.path,\n node(RATING_ID, { name: 'rating' }),\n ),\n]\n\nexport const formControlPresets: Aglyn.PresetSchema[] = [\n ...singleElementPresets,\n preset(\n generatePresetId(FORM_CONTROL_ID, 'text'),\n 'Text field',\n 'A label and a one-line input.',\n mdiFormTextbox.path,\n textFieldPreset('Name', { name: 'name' }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'email'),\n 'Email field',\n 'A label and an email input.',\n mdiFormTextbox.path,\n textFieldPreset('Email', { name: 'email', type: 'email', required: true }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'message'),\n 'Message field',\n 'A label and a several-line input.',\n mdiFormTextbox.path,\n textFieldPreset('Message', { name: 'message', multiline: true, minRows: 4 }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'select'),\n 'Dropdown field',\n 'A label and a Select with three options.',\n mdiFormDropdown.path,\n node(FORM_CONTROL_ID, { fullWidth: true }, [\n node(FORM_LABEL_ID, { children: 'Choose one' }),\n node(SELECT_ID, { name: 'choice', fullWidth: true, placeholder: 'Choose…' }, [\n node(SELECT_OPTION_ID, { children: 'Option one' }),\n node(SELECT_OPTION_ID, { children: 'Option two' }),\n node(SELECT_OPTION_ID, { children: 'Option three' }),\n ]),\n ]),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'radio'),\n 'Radio choice field',\n 'A label and a Radio Group with three choices.',\n mdiRadioboxMarked.path,\n node(FORM_CONTROL_ID, {}, [\n node(FORM_LABEL_ID, { children: 'Pick one' }),\n node(RADIO_GROUP_ID, { name: 'pick' }, [\n node(CHOICE_LABEL_ID, { label: 'First' }, [node(RADIO_ID, { value: 'First' })]),\n node(CHOICE_LABEL_ID, { label: 'Second' }, [node(RADIO_ID, { value: 'Second' })]),\n node(CHOICE_LABEL_ID, { label: 'Third' }, [node(RADIO_ID, { value: 'Third' })]),\n ]),\n ]),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'checkbox'),\n 'Checkbox',\n 'A tick box with words beside it.',\n mdiCheckboxMarkedOutline.path,\n node(CHOICE_LABEL_ID, { label: 'Yes, please' }, [\n node(CHECKBOX_ID, { name: 'agree', value: 'Yes' }),\n ]),\n ),\n preset(\n generatePresetId(FORM_HELPER_TEXT_ID),\n 'Helper Text',\n 'A line of guidance under a field.',\n mdiFormatText.path,\n node(FORM_HELPER_TEXT_ID, { children: 'We never share your address.' }),\n ),\n preset(\n generatePresetId(FORM_CONTROL_ID, 'rating'),\n 'Rating field',\n 'A label and five stars.',\n mdiStarOutline.path,\n node(FORM_CONTROL_ID, {}, [\n node(FORM_LABEL_ID, { children: 'How did we do?' }),\n node(RATING_ID, { name: 'rating' }),\n ]),\n ),\n]\n"],"names":["Aglyn","mdiCheckboxMarkedOutline","mdiFormDropdown","mdiFormTextbox","mdiFormatText","mdiRadioboxMarked","mdiStarOutline","mdiTextShort","mdiTagOutline","mdiFormSelect","Checkbox","FormControl","FormControlLabel","FormHelperText","FilledInput","FormLabel","NativeSelect","OutlinedInput","Radio","RadioGroup","Rating","alpha","useTheme","createContext","forwardRef","useContext","useId","BUNDLE_ID","FIELD_TEXT_CONTENT","dropClearedProps","generatePresetId","FORM_CONTROL_ID","FORM_LABEL_ID","INPUT_ID","FORM_HELPER_TEXT_ID","SELECT_ID","SELECT_OPTION_ID","CHECKBOX_ID","RADIO_GROUP_ID","RADIO_ID","CHOICE_LABEL_ID","RATING_ID","loadFormPickers","FieldIdContext","undefined","AglynFormControl","props","ref","id","replace","Provider","value","displayName","AglynFormLabel","component","htmlFor","outlinedBoxSx","theme","border","borderColor","palette","text","primary","display","boxShadow","main","useFilledInputs","components","MuiTextField","defaultProps","variant","nodeSxList","sx","Array","isArray","AglynInput","name","type","multiline","minRows","placeholder","required","ariaLabel","datasetFieldId","_datasetFieldId","rest","filled","inputProps","Boolean","notched","AglynFormHelperText","AglynSelect","children","size","input","defaultValue","option","disabled","AglynSelectOption","_sx","String","withoutMapping","AglynCheckbox","AglynRadioGroup","AglynRadio","AglynChoiceLabel","label","control","span","style","AglynRating","FIELD_NAME","description","FieldComponentType","TEXT_FIELD","FIELD_DATASET_FIELD","DATASET_FIELD_SELECT","FIELD_INPUT_SIZE","SELECT","options","FIELD_REQUIRED","SWITCH","FIELD_ARIA_LABEL","FIELD_FULL_WIDTH","FIELD_PLACEHOLDER","FIELD_CHOICE_VALUE","category","ComponentCategory","FORMS","formControlSchema","$id","pluginId","icon","path","color","attributes","formLabelSchema","flags","textEditable","FEATURE_FLAG","ENABLED","inputSchema","selfClosing","formHelperTextSchema","selectSchema","restrictChildren","LinealDirectiveFlag","LIMIT_TO","selectOptionSchema","plainTextChildren","checkboxSchema","radioGroupSchema","radioSchema","choiceLabelSchema","ratingSchema","node","componentId","nodes","textFieldPreset","fullWidth","preset","data","NodeType","PRESET","singleElementPresets","formControlPresets"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SACEC,wBAAwB,EACxBC,eAAe,EACfC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,EACdC,YAAY,EACZC,aAAa,EACbC,aAAa,QACR,yBAAwB;AAC/B,OAAOC,cAAsC,yBAAwB;AACrE,OAAOC,iBAA4C,4BAA2B;AAC9E,OAAOC,sBAAsB,iCAAgC;AAC7D,OAAOC,oBAEA,+BAA8B;AACrC,OAAOC,iBAAiB,4BAA2B;AACnD,OAAOC,eAAwC,0BAAyB;AACxE,OAAOC,kBAAkB,6BAA4B;AACrD,OAAOC,mBAAmB,8BAA6B;AACvD,OAAOC,WAAgC,sBAAqB;AAC5D,OAAOC,gBAA0C,2BAA0B;AAC3E,OAAOC,YAAkC,uBAAsB;AAC/D,SACEC,KAAK,EAGLC,QAAQ,QACH,uBAAsB;AAC7B,SACEC,aAAa,EACbC,UAAU,EAEVC,UAAU,EACVC,KAAK,QACA,QAAO;AACd,SAASC,SAAS,QAAQ,g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;IAEHoE,OACElI,iBAAiBC,iBAAiB,UAClC,sBACA,iDACA1B,kBAAkBgI,IAAI,EACtBsB,KAAK5H,iBAAiB,CAAC,GAAG;QACxB4H,KAAK3H,eAAe;YAAE4D,UAAU;QAAW;QAC3C+D,KAAKrH,gBAAgB;YAAEsC,MAAM;QAAO,GAAG;YACrC+E,KAAKnH,iBAAiB;gBAAEkE,OAAO;YAAQ,GAAG;gBAACiD,KAAKpH,UAAU;oBAAEY,OAAO;gBAAQ;aAAG;YAC9EwG,KAAKnH,iBAAiB;gBAAEkE,OAAO;YAAS,GAAG;gBAACiD,KAAKpH,UAAU;oBAAEY,OAAO;gBAAS;aAAG;YAChFwG,KAAKnH,iBAAiB;gBAAEkE,OAAO;YAAQ,GAAG;gBAACiD,KAAKpH,UAAU;oBAAEY,OAAO;gBAAQ;aAAG;SAC/E;KACF;IAEH6G,OACElI,iBAAiBC,iBAAiB,aAClC,YACA,oCACA9B,yBAAyBoI,IAAI,EAC7BsB,KAAKnH,iBAAiB;QAAEkE,OAAO;IAAc,GAAG;QAC9CiD,KAAKtH,aAAa;YAAEuC,MAAM;YAASzB,OAAO;QAAM;KACjD;IAEH6G,OACElI,iBAAiBI,sBACjB,eACA,qCACA9B,cAAciI,IAAI,EAClBsB,KAAKzH,qBAAqB;QAAE0D,UAAU;IAA+B;IAEvEoE,OACElI,iBAAiBC,iBAAiB,WAClC,gBACA,2BACAzB,eAAe+H,IAAI,EACnBsB,KAAK5H,iBAAiB,CAAC,GAAG;QACxB4H,KAAK3H,eAAe;YAAE4D,UAAU;QAAiB;QACjD+D,KAAKlH,WAAW;YAAEmC,MAAM;QAAS;KAClC;CAEJ,CAAA"}
|
|
@@ -122,8 +122,8 @@ export declare function scrollToHeading(anchor: Element, slug: string): boolean;
|
|
|
122
122
|
* so without this the aside in the besigner would keep listing the headings
|
|
123
123
|
* of the document as it was when the aside mounted.
|
|
124
124
|
*/
|
|
125
|
-
declare const TableOfContents: import("react").
|
|
126
|
-
readonly type: import("react").
|
|
125
|
+
declare const TableOfContents: import("react").FunctionComponent<Omit<TableOfContentsProps, "ref"> & import("react").RefAttributes<HTMLElement>> & import("react").NamedExoticComponent<Omit<TableOfContentsProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
|
|
126
|
+
readonly type: import("react").FunctionComponent<Omit<TableOfContentsProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
127
127
|
};
|
|
128
128
|
export declare const markdownSchema: Aglyn.ComponentSchema<MarkdownProps>;
|
|
129
129
|
export declare const tableOfContentsSchema: Aglyn.ComponentSchema<TableOfContentsProps>;
|
|
@@ -106,7 +106,7 @@ export declare const collectionEntryMeta: () => Promise<typeof import("./compone
|
|
|
106
106
|
export declare const collectionEntryAuthor: () => Promise<typeof import("./components/collection-entry-author")>;
|
|
107
107
|
export declare const collectionAuthorProfile: () => Promise<typeof import("./components/collection-author-profile")>;
|
|
108
108
|
export declare const collectionCategories: () => Promise<typeof import("./components/collection-categories")>;
|
|
109
|
-
export declare const collectionSearch: () => Promise<typeof import("./components/collection-search")>;
|
|
109
|
+
export declare const collectionSearch: () => Promise<typeof import("./components/collection-entries-search")>;
|
|
110
110
|
export declare const video: () => Promise<typeof import("./components/video")>;
|
|
111
111
|
export declare const languageSwitcher: () => Promise<typeof import("./components/language-switcher")>;
|
|
112
112
|
export declare const reusableInstance: () => Promise<typeof import("./components/reusable-instance")>;
|
package/src/lib/element-tier.js
CHANGED
|
@@ -30,6 +30,7 @@ import * as screenLink from "./components/screen-link.js";
|
|
|
30
30
|
import * as linkBox from "./components/link-box.js";
|
|
31
31
|
import * as image from "./components/image.js";
|
|
32
32
|
import * as icon from "./components/icon.js";
|
|
33
|
+
import { loadCollectionSearch } from "./components/collection-search-load.js";
|
|
33
34
|
/**
|
|
34
35
|
* The element tier: how a page's mui elements reach it (AGL-3401).
|
|
35
36
|
*
|
|
@@ -121,7 +122,12 @@ export const collectionEntryMeta = ()=>import("./components/collection-entry-met
|
|
|
121
122
|
export const collectionEntryAuthor = ()=>import("./components/collection-entry-author.js");
|
|
122
123
|
export const collectionAuthorProfile = ()=>import("./components/collection-author-profile.js");
|
|
123
124
|
export const collectionCategories = ()=>import("./components/collection-categories.js");
|
|
124
|
-
|
|
125
|
+
// The Collection Search block arrives in the Entries block's searching
|
|
126
|
+
// variant's module, through the one loader both share: each `import()` of the
|
|
127
|
+
// box of its own was a chunk group of its own, and a page placing both
|
|
128
|
+
// downloaded the box twice (AGL-4220). `collection-search-load.ts` is imported
|
|
129
|
+
// statically above so that its `import()` is this tier's child.
|
|
130
|
+
export const collectionSearch = loadCollectionSearch;
|
|
125
131
|
export const video = ()=>import("./components/video.js");
|
|
126
132
|
export const languageSwitcher = ()=>import("./components/language-switcher.js");
|
|
127
133
|
export const reusableInstance = ()=>import("./components/reusable-instance.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/mui/src/lib/element-tier.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 */\nimport * as appBar from './components/app-bar'\nimport * as toolbar from './components/toolbar'\nimport * as layoutSlot from './components/layout-slot'\nimport * as documentRoot from './components/document-root'\nimport * as section from './components/section'\nimport * as container from './components/container'\nimport * as box from './components/box'\nimport * as stack from './components/stack'\nimport * as grid from './components/grid'\nimport * as paper from './components/paper'\nimport * as typography from './components/typography'\nimport * as inlineText from './components/inline-text'\nimport * as button from './components/button'\nimport * as screenLink from './components/screen-link'\nimport * as linkBox from './components/link-box'\nimport * as image from './components/image'\nimport * as icon from './components/icon'\n\n/**\n * The element tier: how a page's mui elements reach it (AGL-3401).\n *\n * `plugin.ts` imports this module lazily, and every element module is reached\n * through it — the common ones as part of it, the rest by an `import()` written\n * HERE. Where that `import()` is written is the whole point.\n *\n * ## Why not sixty sibling imports\n *\n * Each `import()` is a chunk group, and Turbopack gives each group every\n * module it needs that its PARENT group has not already loaded. Sixty element\n * imports written side by side in `plugin.ts` were sixty siblings: none of\n * them could count on another having loaded `@mui/material/Button`, so the\n * chunker merged a copy of Button, ButtonBase and its ripple, SvgIcon, Paper,\n * Stack, the link helpers and the field presets into group after group. On a\n * production aglyn.com build 30% of the module code a page downloaded was a\n * second-or-later copy (Button eight times, SvgIcon fifteen).\n *\n * No chunking switch fixes that without trading it for requests: turning the\n * merge off removed the copies and cost a page 280 files, which compress\n * worse than the bytes they saved (measured in AGL-3401).\n *\n * ## What this module does instead\n *\n * `CORE_ELEMENTS` are the elements nearly every page places — its frame, its\n * layout, its text, its links, buttons and images. They load together as one\n * chunk, and so do the MUI modules they share. Every other element's\n * `import()` is written below, which makes its group a CHILD of this one:\n * whatever this chunk carries is available to it, so none of it is copied.\n *\n * The price is on either side of that line. A page that places none of the\n * core elements but the frame still downloads them (a six-element page paid\n * 3.7 KB more), and an element outside the core arrives one request later,\n * after this chunk. Moving an element into the core is right when most pages\n * place it; `check:tenant-wire-weight`'s duplication measure is what says\n * whether the copies are coming back.\n *\n * Each core element is held as a module namespace, because the registry reads\n * a component, its schema and its presets off it by export name.\n */\n\nexport const CORE_ELEMENTS = {\n appBar,\n toolbar,\n layoutSlot,\n documentRoot,\n section,\n container,\n box,\n stack,\n grid,\n paper,\n typography,\n inlineText,\n button,\n screenLink,\n linkBox,\n image,\n icon,\n}\n\n/** The elements a page places less often, each loaded when it is placed. */\nexport const list = () => import('./components/list')\nexport const listItem = () => import('./components/list-item')\nexport const listItemText = () => import('./components/list-item-text')\n// One import shared by every caller: the form elements' entries and the\n// pickers' (below) each ask for it, and a loader that hands a second caller a\n// module still being evaluated (jiti, in the AI palette and axe guards) would\n// give it empty exports. A browser's module map shares the promise anyway; a\n// failed load is forgotten so the next placement retries.\nlet formControlsLoad: Promise<typeof import('./components/form-controls')> | undefined\nexport const formControls = () =>\n (formControlsLoad ??= import('./components/form-controls').catch((error: unknown) => {\n formControlsLoad = undefined\n throw error\n }))\n// The date and time pickers carry MUI X and a date library: their own chunk,\n// fetched only by a page that places one (AGL-3825). It is imported FROM\n// form-controls, never beside it: a picker always sits in a Form Control, and\n// a chunk loaded as a child of form-controls' group is handed only what that\n// group lacks, where a sibling import would carry its own copy of the Form\n// Control, the input pieces and everything they share.\nexport const formPickers = () =>\n formControls().then((module) => module.loadFormPickers())\nexport const blocks = () => import('./components/blocks')\nexport const dataTable = () => import('./components/data-table')\n// The collection family is one module per element (AGL-3401): a page placing\n// an entries list does not download the entry body's markdown renderer, the\n// author cards' platform marks or the search box.\nexport const collectionEntries = () => import('./components/collection-entries')\nexport const collectionEntryBody = () =>\n import('./components/collection-entry-body')\nexport const collectionRelated = () => import('./components/collection-related')\nexport const collectionShare = () => import('./components/collection-share')\nexport const collectionEntryMeta = () =>\n import('./components/collection-entry-meta')\nexport const collectionEntryAuthor = () =>\n import('./components/collection-entry-author')\nexport const collectionAuthorProfile = () =>\n import('./components/collection-author-profile')\nexport const collectionCategories = () =>\n import('./components/collection-categories')\nexport const collectionSearch = () => import('./components/collection-search')\nexport const video = () => import('./components/video')\nexport const languageSwitcher = () => import('./components/language-switcher')\nexport const reusableInstance = () => import('./components/reusable-instance')\nexport const navMenu = () => import('./components/nav-menu')\nexport const drawer = () => import('./components/drawer')\nexport const product = () => import('./components/product')\nexport const plugin = () => import('./components/plugin')\nexport const customHtml = () => import('./components/custom-html')\nexport const searchBox = () => import('./components/search-box')\nexport const markdown = () => import('./components/markdown')\nexport const card = () => import('./components/card')\nexport const accordion = () => import('./components/accordion')\nexport const tabs = () => import('./components/tabs')\nexport const imageList = () => import('./components/image-list')\nexport const pagination = () => import('./components/pagination')\nexport const breadcrumbs = () => import('./components/breadcrumbs')\nexport const themeModeSwitcher = () =>\n import('./components/theme-mode-switcher')\n"],"names":["appBar","toolbar","layoutSlot","documentRoot","section","container","box","stack","grid","paper","typography","inlineText","button","screenLink","linkBox","image","icon","CORE_ELEMENTS","list","listItem","listItemText","formControlsLoad","formControls","catch","error","undefined","formPickers","then","module","loadFormPickers","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"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,YAAYA,YAAY,0BAAsB;AAC9C,YAAYC,aAAa,0BAAsB;AAC/C,YAAYC,gBAAgB,8BAA0B;AACtD,YAAYC,kBAAkB,gCAA4B;AAC1D,YAAYC,aAAa,0BAAsB;AAC/C,YAAYC,eAAe,4BAAwB;AACnD,YAAYC,SAAS,sBAAkB;AACvC,YAAYC,WAAW,wBAAoB;AAC3C,YAAYC,UAAU,uBAAmB;AACzC,YAAYC,WAAW,wBAAoB;AAC3C,YAAYC,gBAAgB,6BAAyB;AACrD,YAAYC,gBAAgB,8BAA0B;AACtD,YAAYC,YAAY,yBAAqB;AAC7C,YAAYC,gBAAgB,8BAA0B;AACtD,YAAYC,aAAa,2BAAuB;AAChD,YAAYC,WAAW,wBAAoB;AAC3C,YAAYC,UAAU,uBAAmB;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GAED,OAAO,MAAMC,gBAAgB;IAC3BjB;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;AACF,EAAC;AAED,0EAA0E,GAC1E,OAAO,MAAME,OAAO,IAAM,MAAM,CAAC,wBAAoB;AACrD,OAAO,MAAMC,WAAW,IAAM,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E,OAAO,MAAMC,mBAAmB,IAAM,MAAM,CAAC,qCAAiC;AAC9E,OAAO,MAAMC,UAAU,IAAM,MAAM,CAAC,4BAAwB;AAC5D,OAAO,MAAMC,SAAS,IAAM,MAAM,CAAC,0BAAsB;AACzD,OAAO,MAAMC,UAAU,IAAM,MAAM,CAAC,2BAAuB;AAC3D,OAAO,MAAMC,SAAS,IAAM,MAAM,CAAC,0BAAsB;AACzD,OAAO,MAAMC,aAAa,IAAM,MAAM,CAAC,+BAA2B;AAClE,OAAO,MAAMC,YAAY,IAAM,MAAM,CAAC,8BAA0B;AAChE,OAAO,MAAMC,WAAW,IAAM,MAAM,CAAC,4BAAwB;AAC7D,OAAO,MAAMC,OAAO,IAAM,MAAM,CAAC,wBAAoB;AACrD,OAAO,MAAMC,YAAY,IAAM,MAAM,CAAC,6BAAyB;AAC/D,OAAO,MAAMC,OAAO,IAAM,MAAM,CAAC,wBAAoB;AACrD,OAAO,MAAMC,YAAY,IAAM,MAAM,CAAC,8BAA0B;AAChE,OAAO,MAAMC,aAAa,IAAM,MAAM,CAAC,8BAA0B;AACjE,OAAO,MAAMC,cAAc,IAAM,MAAM,CAAC,+BAA2B;AACnE,OAAO,MAAMC,oBAAoB,IAC/B,MAAM,CAAC,uCAAmC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/mui/src/lib/element-tier.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 */\nimport * as appBar from './components/app-bar'\nimport * as toolbar from './components/toolbar'\nimport * as layoutSlot from './components/layout-slot'\nimport * as documentRoot from './components/document-root'\nimport * as section from './components/section'\nimport * as container from './components/container'\nimport * as box from './components/box'\nimport * as stack from './components/stack'\nimport * as grid from './components/grid'\nimport * as paper from './components/paper'\nimport * as typography from './components/typography'\nimport * as inlineText from './components/inline-text'\nimport * as button from './components/button'\nimport * as screenLink from './components/screen-link'\nimport * as linkBox from './components/link-box'\nimport * as image from './components/image'\nimport * as icon from './components/icon'\nimport { loadCollectionSearch } from './components/collection-search-load'\n\n/**\n * The element tier: how a page's mui elements reach it (AGL-3401).\n *\n * `plugin.ts` imports this module lazily, and every element module is reached\n * through it — the common ones as part of it, the rest by an `import()` written\n * HERE. Where that `import()` is written is the whole point.\n *\n * ## Why not sixty sibling imports\n *\n * Each `import()` is a chunk group, and Turbopack gives each group every\n * module it needs that its PARENT group has not already loaded. Sixty element\n * imports written side by side in `plugin.ts` were sixty siblings: none of\n * them could count on another having loaded `@mui/material/Button`, so the\n * chunker merged a copy of Button, ButtonBase and its ripple, SvgIcon, Paper,\n * Stack, the link helpers and the field presets into group after group. On a\n * production aglyn.com build 30% of the module code a page downloaded was a\n * second-or-later copy (Button eight times, SvgIcon fifteen).\n *\n * No chunking switch fixes that without trading it for requests: turning the\n * merge off removed the copies and cost a page 280 files, which compress\n * worse than the bytes they saved (measured in AGL-3401).\n *\n * ## What this module does instead\n *\n * `CORE_ELEMENTS` are the elements nearly every page places — its frame, its\n * layout, its text, its links, buttons and images. They load together as one\n * chunk, and so do the MUI modules they share. Every other element's\n * `import()` is written below, which makes its group a CHILD of this one:\n * whatever this chunk carries is available to it, so none of it is copied.\n *\n * The price is on either side of that line. A page that places none of the\n * core elements but the frame still downloads them (a six-element page paid\n * 3.7 KB more), and an element outside the core arrives one request later,\n * after this chunk. Moving an element into the core is right when most pages\n * place it; `check:tenant-wire-weight`'s duplication measure is what says\n * whether the copies are coming back.\n *\n * Each core element is held as a module namespace, because the registry reads\n * a component, its schema and its presets off it by export name.\n */\n\nexport const CORE_ELEMENTS = {\n appBar,\n toolbar,\n layoutSlot,\n documentRoot,\n section,\n container,\n box,\n stack,\n grid,\n paper,\n typography,\n inlineText,\n button,\n screenLink,\n linkBox,\n image,\n icon,\n}\n\n/** The elements a page places less often, each loaded when it is placed. */\nexport const list = () => import('./components/list')\nexport const listItem = () => import('./components/list-item')\nexport const listItemText = () => import('./components/list-item-text')\n// One import shared by every caller: the form elements' entries and the\n// pickers' (below) each ask for it, and a loader that hands a second caller a\n// module still being evaluated (jiti, in the AI palette and axe guards) would\n// give it empty exports. A browser's module map shares the promise anyway; a\n// failed load is forgotten so the next placement retries.\nlet formControlsLoad: Promise<typeof import('./components/form-controls')> | undefined\nexport const formControls = () =>\n (formControlsLoad ??= import('./components/form-controls').catch((error: unknown) => {\n formControlsLoad = undefined\n throw error\n }))\n// The date and time pickers carry MUI X and a date library: their own chunk,\n// fetched only by a page that places one (AGL-3825). It is imported FROM\n// form-controls, never beside it: a picker always sits in a Form Control, and\n// a chunk loaded as a child of form-controls' group is handed only what that\n// group lacks, where a sibling import would carry its own copy of the Form\n// Control, the input pieces and everything they share.\nexport const formPickers = () =>\n formControls().then((module) => module.loadFormPickers())\nexport const blocks = () => import('./components/blocks')\nexport const dataTable = () => import('./components/data-table')\n// The collection family is one module per element (AGL-3401): a page placing\n// an entries list does not download the entry body's markdown renderer, the\n// author cards' platform marks or the search box.\nexport const collectionEntries = () => import('./components/collection-entries')\nexport const collectionEntryBody = () =>\n import('./components/collection-entry-body')\nexport const collectionRelated = () => import('./components/collection-related')\nexport const collectionShare = () => import('./components/collection-share')\nexport const collectionEntryMeta = () =>\n import('./components/collection-entry-meta')\nexport const collectionEntryAuthor = () =>\n import('./components/collection-entry-author')\nexport const collectionAuthorProfile = () =>\n import('./components/collection-author-profile')\nexport const collectionCategories = () =>\n import('./components/collection-categories')\n// The Collection Search block arrives in the Entries block's searching\n// variant's module, through the one loader both share: each `import()` of the\n// box of its own was a chunk group of its own, and a page placing both\n// downloaded the box twice (AGL-4220). `collection-search-load.ts` is imported\n// statically above so that its `import()` is this tier's child.\nexport const collectionSearch = loadCollectionSearch\nexport const video = () => import('./components/video')\nexport const languageSwitcher = () => import('./components/language-switcher')\nexport const reusableInstance = () => import('./components/reusable-instance')\nexport const navMenu = () => import('./components/nav-menu')\nexport const drawer = () => import('./components/drawer')\nexport const product = () => import('./components/product')\nexport const plugin = () => import('./components/plugin')\nexport const customHtml = () => import('./components/custom-html')\nexport const searchBox = () => import('./components/search-box')\nexport const markdown = () => import('./components/markdown')\nexport const card = () => import('./components/card')\nexport const accordion = () => import('./components/accordion')\nexport const tabs = () => import('./components/tabs')\nexport const imageList = () => import('./components/image-list')\nexport const pagination = () => import('./components/pagination')\nexport const breadcrumbs = () => import('./components/breadcrumbs')\nexport const themeModeSwitcher = () =>\n import('./components/theme-mode-switcher')\n"],"names":["appBar","toolbar","layoutSlot","documentRoot","section","container","box","stack","grid","paper","typography","inlineText","button","screenLink","linkBox","image","icon","loadCollectionSearch","CORE_ELEMENTS","list","listItem","listItemText","formControlsLoad","formControls","catch","error","undefined","formPickers","then","module","loadFormPickers","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"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,YAAYA,YAAY,0BAAsB;AAC9C,YAAYC,aAAa,0BAAsB;AAC/C,YAAYC,gBAAgB,8BAA0B;AACtD,YAAYC,kBAAkB,gCAA4B;AAC1D,YAAYC,aAAa,0BAAsB;AAC/C,YAAYC,eAAe,4BAAwB;AACnD,YAAYC,SAAS,sBAAkB;AACvC,YAAYC,WAAW,wBAAoB;AAC3C,YAAYC,UAAU,uBAAmB;AACzC,YAAYC,WAAW,wBAAoB;AAC3C,YAAYC,gBAAgB,6BAAyB;AACrD,YAAYC,gBAAgB,8B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