@aglyn/aglyn-node-renderer 1.0.0-beta.213 → 1.0.0-beta.215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/aglyn-node-renderer",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.215",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"./package.json": "./package.json"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
28
|
-
"@aglyn/shared-data-types": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
27
|
+
"@aglyn/aglyn": "1.0.0-beta.215",
|
|
28
|
+
"@aglyn/shared-data-types": "1.0.0-beta.215",
|
|
29
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.215",
|
|
30
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.215",
|
|
31
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.215",
|
|
32
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.215",
|
|
33
33
|
"mobx-react-lite": "^4.1.1",
|
|
34
34
|
"react-is": "^19.2.8"
|
|
35
35
|
},
|
|
@@ -39,10 +39,13 @@ import { AglynText } from "@aglyn/shared-ui-jsx/components/aglyn-text";
|
|
|
39
39
|
import { styled, ThemeProvider, useSiteSchemeThemes, useTheme } from "@aglyn/shared-ui-theme";
|
|
40
40
|
import { mergeSxProps } from "@aglyn/shared-ui-theme";
|
|
41
41
|
import { observer } from "mobx-react-lite";
|
|
42
|
-
import {
|
|
42
|
+
import { isNamespacedComponentId } from "@aglyn/aglyn/plugin-manager/plugin-contributions";
|
|
43
|
+
import { RealmElementsContext } from "@aglyn/aglyn/app-utils/realm-elements-context";
|
|
44
|
+
import { forwardRef, Suspense, use, useContext } from "react";
|
|
43
45
|
import { isValidElementType } from "react-is";
|
|
44
46
|
import RendererComponents from "../contexts/renderer-components.js";
|
|
45
47
|
import { LeafSxTransformContext } from "../contexts/leaf-sx-transform.js";
|
|
48
|
+
import { RealmBoundaryContext } from "../contexts/realm-boundary.js";
|
|
46
49
|
import { resolvePaletteVarsSx, resolveSchemeSx } from "../utils/scheme-sx.js";
|
|
47
50
|
const DefaultComponent = styled('div')({});
|
|
48
51
|
export const Leaf = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
|
|
@@ -116,6 +119,18 @@ export const Leaf = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
116
119
|
const registeredSchema = components.getSchema(node == null ? void 0 : node.componentId);
|
|
117
120
|
const offForSite = isSwitchedOffForRenderedSite(registeredSchema == null ? void 0 : registeredSchema.pluginId, enabledPlugins);
|
|
118
121
|
const Factory = offForSite ? undefined : components.getFactory(node == null ? void 0 : node.componentId);
|
|
122
|
+
// A signed marketplace plugin's element (AGL-3390) renders on the server,
|
|
123
|
+
// and the browser registers its component a moment later. Inside the
|
|
124
|
+
// element's own boundary (below) it waits for that load rather than
|
|
125
|
+
// hydrating the server's HTML as an unregistered element, which would
|
|
126
|
+
// not match it.
|
|
127
|
+
const realmElement = isNamespacedComponentId(node == null ? void 0 : node.componentId);
|
|
128
|
+
const realmBoundary = useContext(RealmBoundaryContext);
|
|
129
|
+
const realmLoadFor = useContext(RealmElementsContext);
|
|
130
|
+
if (realmElement && realmBoundary === (node == null ? void 0 : node.$id) && !Factory && !offForSite) {
|
|
131
|
+
const loading = realmLoadFor == null ? void 0 : realmLoadFor(node.componentId);
|
|
132
|
+
if (loading) use(loading);
|
|
133
|
+
}
|
|
119
134
|
const Component = isValidElementType(Factory) ? Factory : DefaultComponent;
|
|
120
135
|
// Self-closing components (AGL-579): a component whose schema flags it
|
|
121
136
|
// selfClosing renders a void DOM element (e.g. Image -> <img>), and React
|
|
@@ -160,6 +175,20 @@ export const Leaf = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
160
175
|
const pinnedScheme = resolveElementColorScheme(_colorScheme);
|
|
161
176
|
const schemeThemes = useSiteSchemeThemes();
|
|
162
177
|
const forcedTheme = pinnedScheme && pinnedScheme !== activeScheme && schemeThemes ? schemeThemes(pinnedScheme) : undefined;
|
|
178
|
+
// Each realm element hydrates in a boundary of its own (AGL-3390), so one
|
|
179
|
+
// waiting for its bundle holds only itself. Rendered on the server too:
|
|
180
|
+
// the browser's tree has to have the same boundary to hydrate into.
|
|
181
|
+
if (realmElement && realmBoundary !== (node == null ? void 0 : node.$id)) {
|
|
182
|
+
return /*#__PURE__*/ _jsx(Suspense, {
|
|
183
|
+
fallback: null,
|
|
184
|
+
children: /*#__PURE__*/ _jsx(RealmBoundaryContext.Provider, {
|
|
185
|
+
value: node == null ? void 0 : node.$id,
|
|
186
|
+
children: /*#__PURE__*/ _jsx(Leaf, _extends({}, props, {
|
|
187
|
+
ref: ref
|
|
188
|
+
}))
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
163
192
|
if (forcedTheme && ((_forcedTheme_palette = forcedTheme.palette) == null ? void 0 : _forcedTheme_palette.mode) === pinnedScheme) {
|
|
164
193
|
return /*#__PURE__*/ _jsx(ThemeProvider, {
|
|
165
194
|
theme: forcedTheme,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/components/leaf.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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// Type-only, with every value this file reads named below (AGL-2486's rule,\n// applied to the render path's hottest file): a VALUE namespace import of the\n// core barrel is opaque to a bundler — it cannot know which exports are read,\n// so every module the barrel reaches is pinned into the published page's first\n// load.\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { components } from '@aglyn/aglyn/aglyn'\nimport { sanitizeAuthorSx } from '@aglyn/aglyn/app-utils/author-css'\nimport { pinRampedTypographySx } from '@aglyn/aglyn/app-utils/responsive-typography-sx'\nimport {\n NODE_HIDE_IF_PROP,\n NODE_HIDE_UNLESS_PROP,\n} from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport {\n NODE_ANIMATION_DELAY_PROP,\n NODE_ANIMATION_DURATION_PROP,\n NODE_ANIMATION_EASE_PROP,\n NODE_ANIMATION_PROP,\n NODE_ANIMATION_REPEAT_PROP,\n NODE_ANIMATION_STAGGER_PROP,\n NODE_ANIMATION_STAGGER_STEP_PROP,\n NODE_ANIMATION_TRIGGER_PROP,\n resolveElementAnimation,\n} from '@aglyn/aglyn/app-utils/element-animation'\nimport {\n EnabledPluginsContext,\n isSwitchedOffForRenderedSite,\n} from '@aglyn/aglyn/app-utils/enabled-plugins-context'\nimport { NodeIdentityContext } from '@aglyn/aglyn/app-utils/node-identity'\nimport {\n NODE_COLOR_SCHEME_PROP,\n resolveElementColorScheme,\n} from '@aglyn/aglyn/app-utils/element-color-scheme'\nimport { FEATURE_FLAG } from '@aglyn/aglyn/foundation/constants/shared'\n// Deep import, NOT the barrel: `@aglyn/shared-ui-jsx`'s index re-exports the\n// Pages Router hooks (`next/router`), the inline SVG icon set and the whole\n// ~12,000-module MDI catalog, none of which a rendered node needs. This file\n// is on every published page, so the barrel's reach is that page's reach.\nimport { AglynText } from '@aglyn/shared-ui-jsx/components/aglyn-text'\nimport {\n styled,\n ThemeProvider,\n useSiteSchemeThemes,\n useTheme,\n} from '@aglyn/shared-ui-theme'\nimport { mergeSxProps } from '@aglyn/shared-ui-theme'\nimport { observer } from 'mobx-react-lite'\nimport { forwardRef, type HTMLAttributes, useContext } from 'react'\nimport { isValidElementType } from 'react-is'\nimport RendererComponents from '../contexts/renderer-components'\nimport { LeafSxTransformContext } from '../contexts/leaf-sx-transform'\nimport { resolvePaletteVarsSx, resolveSchemeSx } from '../utils/scheme-sx'\n\nconst DefaultComponent = styled('div')({})\n\nexport interface LeafProps extends HTMLAttributes<any> {\n children?: any\n node: Aglyn.NodeSchema\n sx?: JSX.SxProps\n}\n\nexport const Leaf = observer(\n forwardRef<any, LeafProps>((props, ref) => {\n const { children, node, sx, className, style, ...rest } = props\n\n // Pull sx/className/style out of the node's props so the spreads below\n // can never clobber the merged values composed explicitly afterwards\n // (AGL-569: `props.sx` used to overwrite the node-level sx entirely).\n //\n // The visibility directives (AGL-1314) come out here too. The compose\n // step consumes and strips them, so a rendered page never carries one —\n // but the component EDITOR renders definition nodes ungrafted, on\n // purpose (the author has to see and select the part a page will hide),\n // and there the raw `hideIf` would spread onto the element as an\n // unknown `hideif` DOM attribute.\n const {\n sx: propsSx,\n className: propsClassName,\n style: propsStyle,\n [NODE_HIDE_IF_PROP]: _hideIf,\n [NODE_HIDE_UNLESS_PROP]: _hideUnless,\n // Element animation (AGL-2486): the reserved animation props come\n // out here for the same reason the visibility directives above do —\n // they are directives to the RENDERER, and spreading them onto the\n // element would land `aglynanimation=\"slide-up\"` as an unknown DOM\n // attribute. Destructured rather than `delete`d after the fact so the\n // `none` case is stripped too (it resolves to no animation, but it is\n // still a prop an author saved) and so the props object keeps one\n // shape.\n [NODE_ANIMATION_PROP]: _animation,\n [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger,\n [NODE_ANIMATION_DURATION_PROP]: _animationDuration,\n [NODE_ANIMATION_DELAY_PROP]: _animationDelay,\n [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat,\n [NODE_ANIMATION_EASE_PROP]: _animationEase,\n [NODE_ANIMATION_STAGGER_PROP]: _animationStagger,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep,\n // A pinned color scheme (AGL-3284) is a directive to the renderer, like\n // the two groups above: consumed below, never handed to the component.\n [NODE_COLOR_SCHEME_PROP]: _colorScheme,\n ...resolvedProps\n } = (node?.resolvedProps ?? node?.props ?? {}) as Record<string, any>\n\n // Resolves to a class, a `data-` attribute and two custom properties; the\n // keyframes themselves live in the tenant's stylesheet, so this costs no\n // JS on any surface. The besigner canvas never ships that stylesheet\n // (same posture as the AGL-562 hidden class), so an author sees the\n // element in its normal, selectable, un-animated state while editing.\n const animation = resolveElementAnimation({\n [NODE_ANIMATION_PROP]: _animation,\n [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger,\n [NODE_ANIMATION_DURATION_PROP]: _animationDuration,\n [NODE_ANIMATION_DELAY_PROP]: _animationDelay,\n [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat,\n [NODE_ANIMATION_EASE_PROP]: _animationEase,\n [NODE_ANIMATION_STAGGER_PROP]: _animationStagger,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep,\n })\n // A component whose first-party plugin does not run on the rendered site\n // is drawn exactly as an unregistered one is (AGL-3033): the registry is\n // process-global and outlives the site that loaded the bundle, and the\n // site's own browser never loads it. Its schema goes with it, so the\n // void-element and positional flags cannot tell the server a different\n // story from the client either.\n const enabledPlugins = useContext(EnabledPluginsContext)\n const registeredSchema = components.getSchema(node?.componentId)\n const offForSite = isSwitchedOffForRenderedSite(\n registeredSchema?.pluginId,\n enabledPlugins,\n )\n const Factory = offForSite ? undefined : components.getFactory(node?.componentId)\n const Component = isValidElementType(Factory) ? Factory : DefaultComponent\n\n // Self-closing components (AGL-579): a component whose schema flags it\n // selfClosing renders a void DOM element (e.g. Image -> <img>), and React\n // throws during SSR when ANY children value reaches one — even the empty\n // `[undefined, false]` the JSX below always produces. Rendering the whole\n // page 500s off one image node (blog covers, AGL-579), so honor the flag\n // here: no JSX children, and strip a stray `children` prop too.\n const schema = offForSite ? undefined : registeredSchema\n const selfClosing = Boolean(\n (schema?.flags?.selfClosing ?? 0) & FEATURE_FLAG.ENABLED,\n )\n if (selfClosing) delete resolvedProps['children']\n\n const textContent = selfClosing ? null : resolvedProps?.['children']\n\n const mergedClassName =\n [propsClassName, node?.className, className, animation?.className]\n .filter(Boolean)\n .join(' ') || undefined\n // The animation's custom properties go in FIRST so an author who typed\n // `--aglyn-anim-duration` into the Custom CSS tab still wins.\n const mergedStyle =\n animation || propsStyle || style\n ? { ...animation?.style, ...propsStyle, ...style }\n : undefined\n\n // Canvas-only hook (AGL-581): the besigner provides a transform that\n // re-targets viewport media queries at the artboard device width.\n // Undefined everywhere else, keeping the tenant path unchanged.\n const transformSx = useContext(LeafSxTransformContext)\n // Scheme-scoped styles (AGL-588): sites swap a single-mode theme for\n // light/dark (tenant HostThemeProvider, canvas useAglynSiteTheme), so\n // '@scheme dark' sx slices resolve here against the ACTIVE theme's\n // palette mode — the one signal that is correct in both places.\n const theme = useTheme() as {\n palette?: { mode?: string } & Record<string, unknown>\n } | null\n const activeScheme = theme?.palette?.mode === 'dark' ? 'dark' : 'light'\n // \"Always light\" / \"Always dark\" (AGL-3284). When the pinned scheme is not\n // the active one, the element re-renders itself under the site's theme\n // for that scheme, so its OWN sx — not only its descendants' — resolves\n // palette tokens and `@scheme dark` slices for the pinned scheme. The\n // inner render then sees the pinned scheme as active and takes the plain\n // path; the mode check below is what guarantees that, because a site with\n // one theme for both schemes (a single `fallback`) hands back a theme\n // whose mode never changes, and re-wrapping it would never terminate.\n // No provider (an email render, a bare test) means nothing to force.\n // Every hook above runs on both paths, so the early return keeps the\n // hook order stable when an author flips the setting.\n const pinnedScheme = resolveElementColorScheme(_colorScheme)\n const schemeThemes = useSiteSchemeThemes()\n const forcedTheme =\n pinnedScheme && pinnedScheme !== activeScheme && schemeThemes\n ? schemeThemes(pinnedScheme)\n : undefined\n if (forcedTheme && forcedTheme.palette?.mode === pinnedScheme) {\n return (\n <ThemeProvider theme={forcedTheme}>\n <Leaf {...props} ref={ref} />\n </ThemeProvider>\n )\n }\n // MUI array composition: later entries win on key conflicts, so the\n // node-level sx (Styles panel output) overrides props.sx.\n //\n // Palette token references (AGL-1331): the Background Fill field\n // persists a token-bound gradient stop as\n // `var(--mui-palette-primary-main, #00B0FF)`, because `backgroundImage`\n // is NOT one of the sx keys MUI resolves against the palette. They are\n // substituted here, against the site theme, so the canvas cannot pick\n // up the console's `--mui-palette-*` and the tenant (whose theme has no\n // CSS variables at all) still tracks palette changes. Values carrying\n // no reference come back by identity.\n // Author CSS (AGL-1725): `node.sx` is the Styles panel's output, and it\n // is free text — `backgroundImage` is a first-class field and the Custom\n // CSS tab is free-solo, so any property and any value can be typed. On a\n // published site that lands in the visitor's document as a real `url()`,\n // which no input validator and no lint rule can see. Scrubbed HERE, at\n // the last point before the merge, so it also catches values already\n // stored; `sx` and `props.sx` are OUR components' own styles and are\n // deliberately left alone. The scrub is scheme-only and returns its\n // input by identity when nothing is refused, so the overwhelmingly\n // common case (no `url()` at all) costs one walk and no new object.\n // Responsive type ramp: LAST of the three sx passes, and it has to be —\n // it moves a scalar `fontSize` into the `xs` slice so the author's\n // explicit size sorts after the variant's `responsiveFontSizes` at-rules,\n // and the scheme pass above is what collapses a dark-scheme slice down\n // into that same top level. Running it earlier would leave a dark\n // override's font size unpinned.\n //\n // A pinned element paints its scheme's page background and text color\n // (AGL-3284), UNDER every other style so an author's own background wins.\n // Without it an \"Always dark\" band with no background of its own is\n // light text on the light page behind it, and text that sets no color\n // inherits the page's dark body color. `color-scheme` makes the browser's\n // own controls and scrollbars inside the band match. Only a pinned\n // element carries this, so an unpinned one renders exactly as before —\n // and so does a pinned one on a surface with no site themes to pin to.\n const authorSx = sanitizeAuthorSx(node?.sx)\n const composedSx = pinRampedTypographySx(\n resolvePaletteVarsSx(\n resolveSchemeSx(\n pinnedScheme && schemeThemes\n ? mergeSxProps(\n {\n colorScheme: pinnedScheme,\n color: 'text.primary',\n bgcolor: 'background.default',\n } as any,\n sx as any,\n propsSx as any,\n authorSx as any,\n )\n : mergeSxProps(sx as any, propsSx as any, authorSx as any),\n activeScheme,\n ),\n theme?.palette,\n ),\n )\n /**\n * Author visibility — the eye on the hierarchy row.\n *\n * LAST, and deliberately so. It has to override the element's own\n * display, not replace it: an author who hides a Stack laid out with\n * `display: flex` gets that flex back the moment they show it again,\n * because the stored style was never touched. Writing `display: none`\n * into `node.sx` would have destroyed the value it overwrote, and there\n * would be nothing left to restore.\n *\n * The same rule on both surfaces. A hidden element is absent from the\n * published page and from the canvas — \"hidden\" that still renders in the\n * editor is a preview of a page nobody will ever see.\n */\n const mergedSx = node?.hidden\n ? mergeSxProps(composedSx as any, { display: 'none' } as any)\n : composedSx\n\n // Shared leaf attributes; self-closing components must receive NO\n // children at all (AGL-579) — a separate element expression keeps the\n // childless case genuinely childless instead of `[undefined, false]`.\n const leafProps = {\n ref,\n 'data-aglyn': `leaf:${node?.$id}`,\n // Before the spreads: the animation trigger/repeat attributes are ours,\n // but an element that genuinely declared one of these should win.\n ...animation?.attributes,\n ...resolvedProps,\n ...rest,\n className: mergedClassName,\n style: mergedStyle,\n sx: transformSx\n ? (transformSx(mergedSx, node?.$id) as typeof mergedSx)\n : mergedSx,\n }\n\n // Node identity (AGL-659): components get their node id through a\n // context rather than a prop, so a block can look up the server-seeded\n // slice of `pageData` that belongs to IT — two grids on one page have\n // different queries and must not share a seed. Nothing is added to any\n // component's props, so no unknown attribute reaches the DOM.\n // Positional children (AGL-1237): a component that splits its children\n // by index — MUI's Accordion is `[summary, ...rest]` — must receive one\n // React child per node child. The default single `<Branch>` element reads\n // as ONE child to `Children.toArray`, so the first slot swallowed the\n // whole subtree and every later slot got nothing.\n const positional = Boolean(\n (schema?.flags?.positionalChildren ?? 0) & FEATURE_FLAG.ENABLED,\n )\n const childNodes = positional ? (node?.children ?? []) : null\n\n const element = selfClosing ? (\n <Component {...leafProps} />\n ) : positional ? (\n <RendererComponents.Consumer>\n {({ StemComponent }) => (\n <Component {...leafProps}>\n {childNodes!.map((child: any, key: number) => (\n <StemComponent key={child?.$id ?? key} node={child} />\n ))}\n {textContent != null && (\n <AglynText>{textContent as any}</AglynText>\n )}\n </Component>\n )}\n </RendererComponents.Consumer>\n ) : (\n <Component {...leafProps}>\n {children}\n\n {textContent != null && (\n <AglynText>{textContent as any}</AglynText>\n )}\n </Component>\n )\n\n return (\n <NodeIdentityContext.Provider value={node?.$id ?? ''}>\n {element}\n </NodeIdentityContext.Provider>\n )\n }),\n)\nLeaf.displayName = 'Leaf'\nLeaf['aglyn'] = true\n\nexport default Leaf\n"],"names":["components","sanitizeAuthorSx","pinRampedTypographySx","NODE_HIDE_IF_PROP","NODE_HIDE_UNLESS_PROP","NODE_ANIMATION_DELAY_PROP","NODE_ANIMATION_DURATION_PROP","NODE_ANIMATION_EASE_PROP","NODE_ANIMATION_PROP","NODE_ANIMATION_REPEAT_PROP","NODE_ANIMATION_STAGGER_PROP","NODE_ANIMATION_STAGGER_STEP_PROP","NODE_ANIMATION_TRIGGER_PROP","resolveElementAnimation","EnabledPluginsContext","isSwitchedOffForRenderedSite","NodeIdentityContext","NODE_COLOR_SCHEME_PROP","resolveElementColorScheme","FEATURE_FLAG","AglynText","styled","ThemeProvider","useSiteSchemeThemes","useTheme","mergeSxProps","observer","forwardRef","useContext","isValidElementType","RendererComponents","LeafSxTransformContext","resolvePaletteVarsSx","resolveSchemeSx","DefaultComponent","Leaf","props","ref","node","schema","theme","forcedTheme","children","sx","className","style","rest","resolvedProps","propsSx","propsClassName","propsStyle","_hideIf","_hideUnless","_animation","_animationTrigger","_animationDuration","_animationDelay","_animationRepeat","_animationEase","_animationStagger","_animationStaggerStep","_colorScheme","animation","enabledPlugins","registeredSchema","getSchema","componentId","offForSite","pluginId","Factory","undefined","getFactory","Component","selfClosing","Boolean","flags","ENABLED","textContent","mergedClassName","filter","join","mergedStyle","transformSx","activeScheme","palette","mode","pinnedScheme","schemeThemes","authorSx","composedSx","colorScheme","color","bgcolor","mergedSx","hidden","display","leafProps","$id","attributes","positional","positionalChildren","childNodes","element","Consumer","StemComponent","map","child","key","Provider","value","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,QAAQ;;;;;AAER,SAASA,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,qBAAqB,QAAQ,kDAAiD;AACvF,SACEC,iBAAiB,EACjBC,qBAAqB,QAChB,iDAAgD;AACvD,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,mBAAmB,EACnBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,gCAAgC,EAChCC,2BAA2B,EAC3BC,uBAAuB,QAClB,2CAA0C;AACjD,SACEC,qBAAqB,EACrBC,4BAA4B,QACvB,iDAAgD;AACvD,SAASC,mBAAmB,QAAQ,uCAAsC;AAC1E,SACEC,sBAAsB,EACtBC,yBAAyB,QACpB,8CAA6C;AACpD,SAASC,YAAY,QAAQ,2CAA0C;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,SAASC,SAAS,QAAQ,6CAA4C;AACtE,SACEC,MAAM,EACNC,aAAa,EACbC,mBAAmB,EACnBC,QAAQ,QACH,yBAAwB;AAC/B,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,EAAuBC,UAAU,QAAQ,QAAO;AACnE,SAASC,kBAAkB,QAAQ,WAAU;AAC7C,OAAOC,wBAAwB,qCAAiC;AAChE,SAASC,sBAAsB,QAAQ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ACd,KAACD,wBAAcwB,cACbG,2BACF,KAACrE,mBAAmByE,QAAQ;kBACzB,CAAC,EAAEC,aAAa,EAAE,iBACjB,MAAChC,wBAAcwB;;oBACZK,WAAYI,GAAG,CAAC,CAACC,OAAYC;;6CAC5B,KAACH;4BAAsClE,MAAMoE;mCAAzBA,yBAAAA,MAAOT,GAAG,mBAAIU;;oBAEnC9B,eAAe,sBACd,KAACzD;kCAAWyD;;;;uBAMpB,MAACL,wBAAcwB;;YACZtD;YAEAmC,eAAe,sBACd,KAACzD;0BAAWyD;;;;IAKlB,qBACE,KAAC7D,oBAAoB4F,QAAQ;QAACC,KAAK,WAAEvE,wBAAAA,KAAM2D,GAAG,oBAAI;kBAC/CK;;AAGP,IACD;AACDnE,KAAK2E,WAAW,GAAG;AACnB3E,IAAI,CAAC,QAAQ,GAAG;AAEhB,eAAeA,KAAI"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/components/leaf.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 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// Type-only, with every value this file reads named below (AGL-2486's rule,\n// applied to the render path's hottest file): a VALUE namespace import of the\n// core barrel is opaque to a bundler — it cannot know which exports are read,\n// so every module the barrel reaches is pinned into the published page's first\n// load.\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { components } from '@aglyn/aglyn/aglyn'\nimport { sanitizeAuthorSx } from '@aglyn/aglyn/app-utils/author-css'\nimport { pinRampedTypographySx } from '@aglyn/aglyn/app-utils/responsive-typography-sx'\nimport {\n NODE_HIDE_IF_PROP,\n NODE_HIDE_UNLESS_PROP,\n} from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport {\n NODE_ANIMATION_DELAY_PROP,\n NODE_ANIMATION_DURATION_PROP,\n NODE_ANIMATION_EASE_PROP,\n NODE_ANIMATION_PROP,\n NODE_ANIMATION_REPEAT_PROP,\n NODE_ANIMATION_STAGGER_PROP,\n NODE_ANIMATION_STAGGER_STEP_PROP,\n NODE_ANIMATION_TRIGGER_PROP,\n resolveElementAnimation,\n} from '@aglyn/aglyn/app-utils/element-animation'\nimport {\n EnabledPluginsContext,\n isSwitchedOffForRenderedSite,\n} from '@aglyn/aglyn/app-utils/enabled-plugins-context'\nimport { NodeIdentityContext } from '@aglyn/aglyn/app-utils/node-identity'\nimport {\n NODE_COLOR_SCHEME_PROP,\n resolveElementColorScheme,\n} from '@aglyn/aglyn/app-utils/element-color-scheme'\nimport { FEATURE_FLAG } from '@aglyn/aglyn/foundation/constants/shared'\n// Deep import, NOT the barrel: `@aglyn/shared-ui-jsx`'s index re-exports the\n// Pages Router hooks (`next/router`), the inline SVG icon set and the whole\n// ~12,000-module MDI catalog, none of which a rendered node needs. This file\n// is on every published page, so the barrel's reach is that page's reach.\nimport { AglynText } from '@aglyn/shared-ui-jsx/components/aglyn-text'\nimport {\n styled,\n ThemeProvider,\n useSiteSchemeThemes,\n useTheme,\n} from '@aglyn/shared-ui-theme'\nimport { mergeSxProps } from '@aglyn/shared-ui-theme'\nimport { observer } from 'mobx-react-lite'\nimport { isNamespacedComponentId } from '@aglyn/aglyn/plugin-manager/plugin-contributions'\nimport { RealmElementsContext } from '@aglyn/aglyn/app-utils/realm-elements-context'\nimport {\n forwardRef,\n type HTMLAttributes,\n Suspense,\n use,\n useContext,\n} from 'react'\nimport { isValidElementType } from 'react-is'\nimport RendererComponents from '../contexts/renderer-components'\nimport { LeafSxTransformContext } from '../contexts/leaf-sx-transform'\nimport { RealmBoundaryContext } from '../contexts/realm-boundary'\nimport { resolvePaletteVarsSx, resolveSchemeSx } from '../utils/scheme-sx'\n\nconst DefaultComponent = styled('div')({})\n\nexport interface LeafProps extends HTMLAttributes<any> {\n children?: any\n node: Aglyn.NodeSchema\n sx?: JSX.SxProps\n}\n\nexport const Leaf = observer(\n forwardRef<any, LeafProps>((props, ref) => {\n const { children, node, sx, className, style, ...rest } = props\n\n // Pull sx/className/style out of the node's props so the spreads below\n // can never clobber the merged values composed explicitly afterwards\n // (AGL-569: `props.sx` used to overwrite the node-level sx entirely).\n //\n // The visibility directives (AGL-1314) come out here too. The compose\n // step consumes and strips them, so a rendered page never carries one —\n // but the component EDITOR renders definition nodes ungrafted, on\n // purpose (the author has to see and select the part a page will hide),\n // and there the raw `hideIf` would spread onto the element as an\n // unknown `hideif` DOM attribute.\n const {\n sx: propsSx,\n className: propsClassName,\n style: propsStyle,\n [NODE_HIDE_IF_PROP]: _hideIf,\n [NODE_HIDE_UNLESS_PROP]: _hideUnless,\n // Element animation (AGL-2486): the reserved animation props come\n // out here for the same reason the visibility directives above do —\n // they are directives to the RENDERER, and spreading them onto the\n // element would land `aglynanimation=\"slide-up\"` as an unknown DOM\n // attribute. Destructured rather than `delete`d after the fact so the\n // `none` case is stripped too (it resolves to no animation, but it is\n // still a prop an author saved) and so the props object keeps one\n // shape.\n [NODE_ANIMATION_PROP]: _animation,\n [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger,\n [NODE_ANIMATION_DURATION_PROP]: _animationDuration,\n [NODE_ANIMATION_DELAY_PROP]: _animationDelay,\n [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat,\n [NODE_ANIMATION_EASE_PROP]: _animationEase,\n [NODE_ANIMATION_STAGGER_PROP]: _animationStagger,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep,\n // A pinned color scheme (AGL-3284) is a directive to the renderer, like\n // the two groups above: consumed below, never handed to the component.\n [NODE_COLOR_SCHEME_PROP]: _colorScheme,\n ...resolvedProps\n } = (node?.resolvedProps ?? node?.props ?? {}) as Record<string, any>\n\n // Resolves to a class, a `data-` attribute and two custom properties; the\n // keyframes themselves live in the tenant's stylesheet, so this costs no\n // JS on any surface. The besigner canvas never ships that stylesheet\n // (same posture as the AGL-562 hidden class), so an author sees the\n // element in its normal, selectable, un-animated state while editing.\n const animation = resolveElementAnimation({\n [NODE_ANIMATION_PROP]: _animation,\n [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger,\n [NODE_ANIMATION_DURATION_PROP]: _animationDuration,\n [NODE_ANIMATION_DELAY_PROP]: _animationDelay,\n [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat,\n [NODE_ANIMATION_EASE_PROP]: _animationEase,\n [NODE_ANIMATION_STAGGER_PROP]: _animationStagger,\n [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep,\n })\n // A component whose first-party plugin does not run on the rendered site\n // is drawn exactly as an unregistered one is (AGL-3033): the registry is\n // process-global and outlives the site that loaded the bundle, and the\n // site's own browser never loads it. Its schema goes with it, so the\n // void-element and positional flags cannot tell the server a different\n // story from the client either.\n const enabledPlugins = useContext(EnabledPluginsContext)\n const registeredSchema = components.getSchema(node?.componentId)\n const offForSite = isSwitchedOffForRenderedSite(\n registeredSchema?.pluginId,\n enabledPlugins,\n )\n const Factory = offForSite ? undefined : components.getFactory(node?.componentId)\n // A signed marketplace plugin's element (AGL-3390) renders on the server,\n // and the browser registers its component a moment later. Inside the\n // element's own boundary (below) it waits for that load rather than\n // hydrating the server's HTML as an unregistered element, which would\n // not match it.\n const realmElement = isNamespacedComponentId(node?.componentId)\n const realmBoundary = useContext(RealmBoundaryContext)\n const realmLoadFor = useContext(RealmElementsContext)\n if (realmElement && realmBoundary === node?.$id && !Factory && !offForSite) {\n const loading = realmLoadFor?.(node.componentId)\n if (loading) use(loading)\n }\n const Component = isValidElementType(Factory) ? Factory : DefaultComponent\n\n // Self-closing components (AGL-579): a component whose schema flags it\n // selfClosing renders a void DOM element (e.g. Image -> <img>), and React\n // throws during SSR when ANY children value reaches one — even the empty\n // `[undefined, false]` the JSX below always produces. Rendering the whole\n // page 500s off one image node (blog covers, AGL-579), so honor the flag\n // here: no JSX children, and strip a stray `children` prop too.\n const schema = offForSite ? undefined : registeredSchema\n const selfClosing = Boolean(\n (schema?.flags?.selfClosing ?? 0) & FEATURE_FLAG.ENABLED,\n )\n if (selfClosing) delete resolvedProps['children']\n\n const textContent = selfClosing ? null : resolvedProps?.['children']\n\n const mergedClassName =\n [propsClassName, node?.className, className, animation?.className]\n .filter(Boolean)\n .join(' ') || undefined\n // The animation's custom properties go in FIRST so an author who typed\n // `--aglyn-anim-duration` into the Custom CSS tab still wins.\n const mergedStyle =\n animation || propsStyle || style\n ? { ...animation?.style, ...propsStyle, ...style }\n : undefined\n\n // Canvas-only hook (AGL-581): the besigner provides a transform that\n // re-targets viewport media queries at the artboard device width.\n // Undefined everywhere else, keeping the tenant path unchanged.\n const transformSx = useContext(LeafSxTransformContext)\n // Scheme-scoped styles (AGL-588): sites swap a single-mode theme for\n // light/dark (tenant HostThemeProvider, canvas useAglynSiteTheme), so\n // '@scheme dark' sx slices resolve here against the ACTIVE theme's\n // palette mode — the one signal that is correct in both places.\n const theme = useTheme() as {\n palette?: { mode?: string } & Record<string, unknown>\n } | null\n const activeScheme = theme?.palette?.mode === 'dark' ? 'dark' : 'light'\n // \"Always light\" / \"Always dark\" (AGL-3284). When the pinned scheme is not\n // the active one, the element re-renders itself under the site's theme\n // for that scheme, so its OWN sx — not only its descendants' — resolves\n // palette tokens and `@scheme dark` slices for the pinned scheme. The\n // inner render then sees the pinned scheme as active and takes the plain\n // path; the mode check below is what guarantees that, because a site with\n // one theme for both schemes (a single `fallback`) hands back a theme\n // whose mode never changes, and re-wrapping it would never terminate.\n // No provider (an email render, a bare test) means nothing to force.\n // Every hook above runs on both paths, so the early return keeps the\n // hook order stable when an author flips the setting.\n const pinnedScheme = resolveElementColorScheme(_colorScheme)\n const schemeThemes = useSiteSchemeThemes()\n const forcedTheme =\n pinnedScheme && pinnedScheme !== activeScheme && schemeThemes\n ? schemeThemes(pinnedScheme)\n : undefined\n // Each realm element hydrates in a boundary of its own (AGL-3390), so one\n // waiting for its bundle holds only itself. Rendered on the server too:\n // the browser's tree has to have the same boundary to hydrate into.\n if (realmElement && realmBoundary !== node?.$id) {\n return (\n <Suspense fallback={null}>\n <RealmBoundaryContext.Provider value={node?.$id}>\n <Leaf {...props} ref={ref} />\n </RealmBoundaryContext.Provider>\n </Suspense>\n )\n }\n if (forcedTheme && forcedTheme.palette?.mode === pinnedScheme) {\n return (\n <ThemeProvider theme={forcedTheme}>\n <Leaf {...props} ref={ref} />\n </ThemeProvider>\n )\n }\n // MUI array composition: later entries win on key conflicts, so the\n // node-level sx (Styles panel output) overrides props.sx.\n //\n // Palette token references (AGL-1331): the Background Fill field\n // persists a token-bound gradient stop as\n // `var(--mui-palette-primary-main, #00B0FF)`, because `backgroundImage`\n // is NOT one of the sx keys MUI resolves against the palette. They are\n // substituted here, against the site theme, so the canvas cannot pick\n // up the console's `--mui-palette-*` and the tenant (whose theme has no\n // CSS variables at all) still tracks palette changes. Values carrying\n // no reference come back by identity.\n // Author CSS (AGL-1725): `node.sx` is the Styles panel's output, and it\n // is free text — `backgroundImage` is a first-class field and the Custom\n // CSS tab is free-solo, so any property and any value can be typed. On a\n // published site that lands in the visitor's document as a real `url()`,\n // which no input validator and no lint rule can see. Scrubbed HERE, at\n // the last point before the merge, so it also catches values already\n // stored; `sx` and `props.sx` are OUR components' own styles and are\n // deliberately left alone. The scrub is scheme-only and returns its\n // input by identity when nothing is refused, so the overwhelmingly\n // common case (no `url()` at all) costs one walk and no new object.\n // Responsive type ramp: LAST of the three sx passes, and it has to be —\n // it moves a scalar `fontSize` into the `xs` slice so the author's\n // explicit size sorts after the variant's `responsiveFontSizes` at-rules,\n // and the scheme pass above is what collapses a dark-scheme slice down\n // into that same top level. Running it earlier would leave a dark\n // override's font size unpinned.\n //\n // A pinned element paints its scheme's page background and text color\n // (AGL-3284), UNDER every other style so an author's own background wins.\n // Without it an \"Always dark\" band with no background of its own is\n // light text on the light page behind it, and text that sets no color\n // inherits the page's dark body color. `color-scheme` makes the browser's\n // own controls and scrollbars inside the band match. Only a pinned\n // element carries this, so an unpinned one renders exactly as before —\n // and so does a pinned one on a surface with no site themes to pin to.\n const authorSx = sanitizeAuthorSx(node?.sx)\n const composedSx = pinRampedTypographySx(\n resolvePaletteVarsSx(\n resolveSchemeSx(\n pinnedScheme && schemeThemes\n ? mergeSxProps(\n {\n colorScheme: pinnedScheme,\n color: 'text.primary',\n bgcolor: 'background.default',\n } as any,\n sx as any,\n propsSx as any,\n authorSx as any,\n )\n : mergeSxProps(sx as any, propsSx as any, authorSx as any),\n activeScheme,\n ),\n theme?.palette,\n ),\n )\n /**\n * Author visibility — the eye on the hierarchy row.\n *\n * LAST, and deliberately so. It has to override the element's own\n * display, not replace it: an author who hides a Stack laid out with\n * `display: flex` gets that flex back the moment they show it again,\n * because the stored style was never touched. Writing `display: none`\n * into `node.sx` would have destroyed the value it overwrote, and there\n * would be nothing left to restore.\n *\n * The same rule on both surfaces. A hidden element is absent from the\n * published page and from the canvas — \"hidden\" that still renders in the\n * editor is a preview of a page nobody will ever see.\n */\n const mergedSx = node?.hidden\n ? mergeSxProps(composedSx as any, { display: 'none' } as any)\n : composedSx\n\n // Shared leaf attributes; self-closing components must receive NO\n // children at all (AGL-579) — a separate element expression keeps the\n // childless case genuinely childless instead of `[undefined, false]`.\n const leafProps = {\n ref,\n 'data-aglyn': `leaf:${node?.$id}`,\n // Before the spreads: the animation trigger/repeat attributes are ours,\n // but an element that genuinely declared one of these should win.\n ...animation?.attributes,\n ...resolvedProps,\n ...rest,\n className: mergedClassName,\n style: mergedStyle,\n sx: transformSx\n ? (transformSx(mergedSx, node?.$id) as typeof mergedSx)\n : mergedSx,\n }\n\n // Node identity (AGL-659): components get their node id through a\n // context rather than a prop, so a block can look up the server-seeded\n // slice of `pageData` that belongs to IT — two grids on one page have\n // different queries and must not share a seed. Nothing is added to any\n // component's props, so no unknown attribute reaches the DOM.\n // Positional children (AGL-1237): a component that splits its children\n // by index — MUI's Accordion is `[summary, ...rest]` — must receive one\n // React child per node child. The default single `<Branch>` element reads\n // as ONE child to `Children.toArray`, so the first slot swallowed the\n // whole subtree and every later slot got nothing.\n const positional = Boolean(\n (schema?.flags?.positionalChildren ?? 0) & FEATURE_FLAG.ENABLED,\n )\n const childNodes = positional ? (node?.children ?? []) : null\n\n const element = selfClosing ? (\n <Component {...leafProps} />\n ) : positional ? (\n <RendererComponents.Consumer>\n {({ StemComponent }) => (\n <Component {...leafProps}>\n {childNodes!.map((child: any, key: number) => (\n <StemComponent key={child?.$id ?? key} node={child} />\n ))}\n {textContent != null && (\n <AglynText>{textContent as any}</AglynText>\n )}\n </Component>\n )}\n </RendererComponents.Consumer>\n ) : (\n <Component {...leafProps}>\n {children}\n\n {textContent != null && (\n <AglynText>{textContent as any}</AglynText>\n )}\n </Component>\n )\n\n return (\n <NodeIdentityContext.Provider value={node?.$id ?? ''}>\n {element}\n </NodeIdentityContext.Provider>\n )\n }),\n)\nLeaf.displayName = 'Leaf'\nLeaf['aglyn'] = true\n\nexport default Leaf\n"],"names":["components","sanitizeAuthorSx","pinRampedTypographySx","NODE_HIDE_IF_PROP","NODE_HIDE_UNLESS_PROP","NODE_ANIMATION_DELAY_PROP","NODE_ANIMATION_DURATION_PROP","NODE_ANIMATION_EASE_PROP","NODE_ANIMATION_PROP","NODE_ANIMATION_REPEAT_PROP","NODE_ANIMATION_STAGGER_PROP","NODE_ANIMATION_STAGGER_STEP_PROP","NODE_ANIMATION_TRIGGER_PROP","resolveElementAnimation","EnabledPluginsContext","isSwitchedOffForRenderedSite","NodeIdentityContext","NODE_COLOR_SCHEME_PROP","resolveElementColorScheme","FEATURE_FLAG","AglynText","styled","ThemeProvider","useSiteSchemeThemes","useTheme","mergeSxProps","observer","isNamespacedComponentId","RealmElementsContext","forwardRef","Suspense","use","useContext","isValidElementType","RendererComponents","LeafSxTransformContext","RealmBoundaryContext","resolvePaletteVarsSx","resolveSchemeSx","DefaultComponent","Leaf","props","ref","node","schema","theme","forcedTheme","children","sx","className","style","rest","resolvedProps","propsSx","propsClassName","propsStyle","_hideIf","_hideUnless","_animation","_animationTrigger","_animationDuration","_animationDelay","_animationRepeat","_animationEase","_animationStagger","_animationStaggerStep","_colorScheme","animation","enabledPlugins","registeredSchema","getSchema","componentId","offForSite","pluginId","Factory","undefined","getFactory","realmElement","realmBoundary","realmLoadFor","$id","loading","Component","selfClosing","Boolean","flags","ENABLED","textContent","mergedClassName","filter","join","mergedStyle","transformSx","activeScheme","palette","mode","pinnedScheme","schemeThemes","fallback","Provider","value","authorSx","composedSx","colorScheme","color","bgcolor","mergedSx","hidden","display","leafProps","attributes","positional","positionalChildren","childNodes","element","Consumer","StemComponent","map","child","key","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,QAAQ;;;;;AAER,SAASA,UAAU,QAAQ,qBAAoB;AAC/C,SAASC,gBAAgB,QAAQ,oCAAmC;AACpE,SAASC,qBAAqB,QAAQ,kDAAiD;AACvF,SACEC,iBAAiB,EACjBC,qBAAqB,QAChB,iDAAgD;AACvD,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,mBAAmB,EACnBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,gCAAgC,EAChCC,2BAA2B,EAC3BC,uBAAuB,QAClB,2CAA0C;AACjD,SACEC,qBAAqB,EACrBC,4BAA4B,QACvB,iDAAgD;AACvD,SAASC,mBAAmB,QAAQ,uCAAsC;AAC1E,SACEC,sBAAsB,EACtBC,yBAAyB,QACpB,8CAA6C;AACpD,SAASC,YAAY,QAAQ,2CAA0C;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,SAASC,SAAS,QAAQ,6CAA4C;AACtE,SACEC,MAAM,EACNC,aA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yBAAAA,MAAOtC,GAAG,mBAAIuC;;oBAEnChC,eAAe,sBACd,KAACnE;kCAAWmE;;;;uBAMpB,MAACL,wBAAc2B;;YACZ9D;YAEAwC,eAAe,sBACd,KAACnE;0BAAWmE;;;;IAKlB,qBACE,KAACvE,oBAAoBmF,QAAQ;QAACC,KAAK,WAAEzD,wBAAAA,KAAMqC,GAAG,oBAAI;kBAC/CkC;;AAGP,IACD;AACD1E,KAAKgF,WAAW,GAAG;AACnBhF,IAAI,CAAC,QAAQ,GAAG;AAEhB,eAAeA,KAAI"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The node id of the realm element whose Suspense boundary a leaf is
|
|
3
|
+
* rendering inside (AGL-3390). A namespaced element renders its boundary
|
|
4
|
+
* once and then itself inside it; this is how the inner render knows it is
|
|
5
|
+
* the inner one, without a prop that could reach the DOM.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RealmBoundaryContext: import("react").Context<string>;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
*/ import { createContext } from "react";
|
|
17
|
+
/**
|
|
18
|
+
* The node id of the realm element whose Suspense boundary a leaf is
|
|
19
|
+
* rendering inside (AGL-3390). A namespaced element renders its boundary
|
|
20
|
+
* once and then itself inside it; this is how the inner render knows it is
|
|
21
|
+
* the inner one, without a prop that could reach the DOM.
|
|
22
|
+
*/ export const RealmBoundaryContext = createContext(undefined);
|
|
23
|
+
RealmBoundaryContext.displayName = 'RealmBoundaryContext';
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=realm-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/contexts/realm-boundary.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 { createContext } from 'react'\n\n/**\n * The node id of the realm element whose Suspense boundary a leaf is\n * rendering inside (AGL-3390). A namespaced element renders its boundary\n * once and then itself inside it; this is how the inner render knows it is\n * the inner one, without a prop that could reach the DOM.\n */\nexport const RealmBoundaryContext = createContext<string | undefined>(undefined)\nRealmBoundaryContext.displayName = 'RealmBoundaryContext'\n"],"names":["createContext","RealmBoundaryContext","undefined","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD,SAASA,aAAa,QAAQ,QAAO;AAErC;;;;;CAKC,GACD,OAAO,MAAMC,uBAAuBD,cAAkCE,WAAU;AAChFD,qBAAqBE,WAAW,GAAG"}
|