@aglyn/aglyn-node-renderer 1.0.0-beta.143

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.
Files changed (39) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +44 -0
  4. package/src/index.d.ts +1 -0
  5. package/src/index.js +3 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/aglyn-node-renderer.d.ts +33 -0
  8. package/src/lib/aglyn-node-renderer.js +35 -0
  9. package/src/lib/aglyn-node-renderer.js.map +1 -0
  10. package/src/lib/components/branch.d.ts +24 -0
  11. package/src/lib/components/branch.js +45 -0
  12. package/src/lib/components/branch.js.map +1 -0
  13. package/src/lib/components/leaf.d.ts +25 -0
  14. package/src/lib/components/leaf.js +244 -0
  15. package/src/lib/components/leaf.js.map +1 -0
  16. package/src/lib/components/stem.d.ts +22 -0
  17. package/src/lib/components/stem.js +53 -0
  18. package/src/lib/components/stem.js.map +1 -0
  19. package/src/lib/components/tree-root.d.ts +23 -0
  20. package/src/lib/components/tree-root.js +53 -0
  21. package/src/lib/components/tree-root.js.map +1 -0
  22. package/src/lib/components/trunk.d.ts +22 -0
  23. package/src/lib/components/trunk.js +37 -0
  24. package/src/lib/components/trunk.js.map +1 -0
  25. package/src/lib/contexts/leaf-sx-transform.d.ts +34 -0
  26. package/src/lib/contexts/leaf-sx-transform.js +21 -0
  27. package/src/lib/contexts/leaf-sx-transform.js.map +1 -0
  28. package/src/lib/contexts/renderer-components.d.ts +30 -0
  29. package/src/lib/contexts/renderer-components.js +27 -0
  30. package/src/lib/contexts/renderer-components.js.map +1 -0
  31. package/src/lib/hooks/use-aglyn-site-theme.d.ts +47 -0
  32. package/src/lib/hooks/use-aglyn-site-theme.js +96 -0
  33. package/src/lib/hooks/use-aglyn-site-theme.js.map +1 -0
  34. package/src/lib/utils/create-aglyn-component.d.ts +25 -0
  35. package/src/lib/utils/create-aglyn-component.js +53 -0
  36. package/src/lib/utils/create-aglyn-component.js.map +1 -0
  37. package/src/lib/utils/scheme-sx.d.ts +31 -0
  38. package/src/lib/utils/scheme-sx.js +30 -0
  39. package/src/lib/utils/scheme-sx.js.map +1 -0
@@ -0,0 +1,244 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 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
+ */ // Type-only, with every value this file reads named below (AGL-2486's rule,
17
+ // applied to the render path's hottest file): a VALUE namespace import of the
18
+ // core barrel is opaque to a bundler — it cannot know which exports are read,
19
+ // so every module the barrel reaches is pinned into the published page's first
20
+ // load.
21
+ import { _ as _extends } from "@swc/helpers/_/_extends";
22
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
23
+ import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key";
24
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
+ import { components } from "@aglyn/aglyn/aglyn";
26
+ import { sanitizeAuthorSx } from "@aglyn/aglyn/app-utils/author-css";
27
+ import { pinRampedTypographySx } from "@aglyn/aglyn/app-utils/responsive-typography-sx";
28
+ import { NODE_HIDE_IF_PROP, NODE_HIDE_UNLESS_PROP } from "@aglyn/aglyn/app-utils/reusable-component-keys";
29
+ import { 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 } from "@aglyn/aglyn/app-utils/element-animation";
30
+ import { EnabledPluginsContext, isSwitchedOffForRenderedSite } from "@aglyn/aglyn/app-utils/enabled-plugins-context";
31
+ import { NodeIdentityContext } from "@aglyn/aglyn/app-utils/node-identity";
32
+ import { FEATURE_FLAG } from "@aglyn/aglyn/foundation/constants/shared";
33
+ // Deep import, NOT the barrel: `@aglyn/shared-ui-jsx`'s index re-exports the
34
+ // Pages Router hooks (`next/router`), the inline SVG icon set and the whole
35
+ // ~12,000-module MDI catalog, none of which a rendered node needs. This file
36
+ // is on every published page, so the barrel's reach is that page's reach.
37
+ import { AglynText } from "@aglyn/shared-ui-jsx/components/aglyn-text";
38
+ import { styled, useTheme } from "@aglyn/shared-ui-theme";
39
+ import { mergeSxProps } from "@aglyn/shared-ui-theme";
40
+ import { observer } from "mobx-react-lite";
41
+ import { forwardRef, useContext } from "react";
42
+ import { isValidElementType } from "react-is";
43
+ import RendererComponents from "../contexts/renderer-components.js";
44
+ import { LeafSxTransformContext } from "../contexts/leaf-sx-transform.js";
45
+ import { resolvePaletteVarsSx, resolveSchemeSx } from "../utils/scheme-sx.js";
46
+ const DefaultComponent = styled('div')({});
47
+ export const Leaf = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
48
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
49
+ var _schema_flags, _theme_palette, _schema_flags1;
50
+ const { children, node, sx, className, style } = props, rest = _object_without_properties_loose(props, [
51
+ "children",
52
+ "node",
53
+ "sx",
54
+ "className",
55
+ "style"
56
+ ]);
57
+ // Pull sx/className/style out of the node's props so the spreads below
58
+ // can never clobber the merged values composed explicitly afterwards
59
+ // (AGL-569: `props.sx` used to overwrite the node-level sx entirely).
60
+ //
61
+ // The visibility directives (AGL-1314) come out here too. The compose
62
+ // step consumes and strips them, so a rendered page never carries one —
63
+ // but the component EDITOR renders definition nodes ungrafted, on
64
+ // purpose (the author has to see and select the part a page will hide),
65
+ // and there the raw `hideIf` would spread onto the element as an
66
+ // unknown `hideif` DOM attribute.
67
+ const _ref6 = (_ref = (_ref1 = node == null ? void 0 : node.resolvedProps) != null ? _ref1 : node == null ? void 0 : node.props) != null ? _ref : {}, { sx: propsSx, className: propsClassName, style: propsStyle, [NODE_HIDE_IF_PROP]: _hideIf, [NODE_HIDE_UNLESS_PROP]: _hideUnless, // Element animation (AGL-2486): the reserved animation props come
68
+ // out here for the same reason the visibility directives above do —
69
+ // they are directives to the RENDERER, and spreading them onto the
70
+ // element would land `aglynanimation="slide-up"` as an unknown DOM
71
+ // attribute. Destructured rather than `delete`d after the fact so the
72
+ // `none` case is stripped too (it resolves to no animation, but it is
73
+ // still a prop an author saved) and so the props object keeps one
74
+ // shape.
75
+ [NODE_ANIMATION_PROP]: _animation, [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger, [NODE_ANIMATION_DURATION_PROP]: _animationDuration, [NODE_ANIMATION_DELAY_PROP]: _animationDelay, [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat, [NODE_ANIMATION_EASE_PROP]: _animationEase, [NODE_ANIMATION_STAGGER_PROP]: _animationStagger, [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep } = _ref6, resolvedProps = _object_without_properties_loose(_ref6, [
76
+ "sx",
77
+ "className",
78
+ "style",
79
+ NODE_HIDE_IF_PROP,
80
+ NODE_HIDE_UNLESS_PROP,
81
+ NODE_ANIMATION_PROP,
82
+ NODE_ANIMATION_TRIGGER_PROP,
83
+ NODE_ANIMATION_DURATION_PROP,
84
+ NODE_ANIMATION_DELAY_PROP,
85
+ NODE_ANIMATION_REPEAT_PROP,
86
+ NODE_ANIMATION_EASE_PROP,
87
+ NODE_ANIMATION_STAGGER_PROP,
88
+ NODE_ANIMATION_STAGGER_STEP_PROP
89
+ ].map(_to_property_key));
90
+ // Resolves to a class, a `data-` attribute and two custom properties; the
91
+ // keyframes themselves live in the tenant's stylesheet, so this costs no
92
+ // JS on any surface. The besigner canvas never ships that stylesheet
93
+ // (same posture as the AGL-562 hidden class), so an author sees the
94
+ // element in its normal, selectable, un-animated state while editing.
95
+ const animation = resolveElementAnimation({
96
+ [NODE_ANIMATION_PROP]: _animation,
97
+ [NODE_ANIMATION_TRIGGER_PROP]: _animationTrigger,
98
+ [NODE_ANIMATION_DURATION_PROP]: _animationDuration,
99
+ [NODE_ANIMATION_DELAY_PROP]: _animationDelay,
100
+ [NODE_ANIMATION_REPEAT_PROP]: _animationRepeat,
101
+ [NODE_ANIMATION_EASE_PROP]: _animationEase,
102
+ [NODE_ANIMATION_STAGGER_PROP]: _animationStagger,
103
+ [NODE_ANIMATION_STAGGER_STEP_PROP]: _animationStaggerStep
104
+ });
105
+ // A component whose first-party plugin does not run on the rendered site
106
+ // is drawn exactly as an unregistered one is (AGL-3033): the registry is
107
+ // process-global and outlives the site that loaded the bundle, and the
108
+ // site's own browser never loads it. Its schema goes with it, so the
109
+ // void-element and positional flags cannot tell the server a different
110
+ // story from the client either.
111
+ const enabledPlugins = useContext(EnabledPluginsContext);
112
+ const registeredSchema = components.getSchema(node == null ? void 0 : node.componentId);
113
+ const offForSite = isSwitchedOffForRenderedSite(registeredSchema == null ? void 0 : registeredSchema.pluginId, enabledPlugins);
114
+ const Factory = offForSite ? undefined : components.getFactory(node == null ? void 0 : node.componentId);
115
+ const Component = isValidElementType(Factory) ? Factory : DefaultComponent;
116
+ // Self-closing components (AGL-579): a component whose schema flags it
117
+ // selfClosing renders a void DOM element (e.g. Image -> <img>), and React
118
+ // throws during SSR when ANY children value reaches one — even the empty
119
+ // `[undefined, false]` the JSX below always produces. Rendering the whole
120
+ // page 500s off one image node (blog covers, AGL-579), so honor the flag
121
+ // here: no JSX children, and strip a stray `children` prop too.
122
+ const schema = offForSite ? undefined : registeredSchema;
123
+ const selfClosing = Boolean(((_ref2 = schema == null ? void 0 : (_schema_flags = schema.flags) == null ? void 0 : _schema_flags.selfClosing) != null ? _ref2 : 0) & FEATURE_FLAG.ENABLED);
124
+ if (selfClosing) delete resolvedProps['children'];
125
+ const textContent = selfClosing ? null : resolvedProps == null ? void 0 : resolvedProps['children'];
126
+ const mergedClassName = [
127
+ propsClassName,
128
+ node == null ? void 0 : node.className,
129
+ className,
130
+ animation == null ? void 0 : animation.className
131
+ ].filter(Boolean).join(' ') || undefined;
132
+ // The animation's custom properties go in FIRST so an author who typed
133
+ // `--aglyn-anim-duration` into the Custom CSS tab still wins.
134
+ const mergedStyle = animation || propsStyle || style ? _extends({}, animation == null ? void 0 : animation.style, propsStyle, style) : undefined;
135
+ // Canvas-only hook (AGL-581): the besigner provides a transform that
136
+ // re-targets viewport media queries at the artboard device width.
137
+ // Undefined everywhere else, keeping the tenant path unchanged.
138
+ const transformSx = useContext(LeafSxTransformContext);
139
+ // Scheme-scoped styles (AGL-588): sites swap a single-mode theme for
140
+ // light/dark (tenant HostThemeProvider, canvas useAglynSiteTheme), so
141
+ // '@scheme dark' sx slices resolve here against the ACTIVE theme's
142
+ // palette mode — the one signal that is correct in both places.
143
+ const theme = useTheme();
144
+ const activeScheme = (theme == null ? void 0 : (_theme_palette = theme.palette) == null ? void 0 : _theme_palette.mode) === 'dark' ? 'dark' : 'light';
145
+ // MUI array composition: later entries win on key conflicts, so the
146
+ // node-level sx (Styles panel output) overrides props.sx.
147
+ //
148
+ // Palette token references (AGL-1331): the Background Fill field
149
+ // persists a token-bound gradient stop as
150
+ // `var(--mui-palette-primary-main, #00B0FF)`, because `backgroundImage`
151
+ // is NOT one of the sx keys MUI resolves against the palette. They are
152
+ // substituted here, against the site theme, so the canvas cannot pick
153
+ // up the console's `--mui-palette-*` and the tenant (whose theme has no
154
+ // CSS variables at all) still tracks palette changes. Values carrying
155
+ // no reference come back by identity.
156
+ // Author CSS (AGL-1725): `node.sx` is the Styles panel's output, and it
157
+ // is free text — `backgroundImage` is a first-class field and the Custom
158
+ // CSS tab is free-solo, so any property and any value can be typed. On a
159
+ // published site that lands in the visitor's document as a real `url()`,
160
+ // which no input validator and no lint rule can see. Scrubbed HERE, at
161
+ // the last point before the merge, so it also catches values already
162
+ // stored; `sx` and `props.sx` are OUR components' own styles and are
163
+ // deliberately left alone. The scrub is scheme-only and returns its
164
+ // input by identity when nothing is refused, so the overwhelmingly
165
+ // common case (no `url()` at all) costs one walk and no new object.
166
+ // Responsive type ramp: LAST of the three sx passes, and it has to be —
167
+ // it moves a scalar `fontSize` into the `xs` slice so the author's
168
+ // explicit size sorts after the variant's `responsiveFontSizes` at-rules,
169
+ // and the scheme pass above is what collapses a dark-scheme slice down
170
+ // into that same top level. Running it earlier would leave a dark
171
+ // override's font size unpinned.
172
+ const authorSx = sanitizeAuthorSx(node == null ? void 0 : node.sx);
173
+ const composedSx = pinRampedTypographySx(resolvePaletteVarsSx(resolveSchemeSx(mergeSxProps(sx, propsSx, authorSx), activeScheme), theme == null ? void 0 : theme.palette));
174
+ /**
175
+ * Author visibility — the eye on the hierarchy row.
176
+ *
177
+ * LAST, and deliberately so. It has to override the element's own
178
+ * display, not replace it: an author who hides a Stack laid out with
179
+ * `display: flex` gets that flex back the moment they show it again,
180
+ * because the stored style was never touched. Writing `display: none`
181
+ * into `node.sx` would have destroyed the value it overwrote, and there
182
+ * would be nothing left to restore.
183
+ *
184
+ * The same rule on both surfaces. A hidden element is absent from the
185
+ * published page and from the canvas — "hidden" that still renders in the
186
+ * editor is a preview of a page nobody will ever see.
187
+ */ const mergedSx = (node == null ? void 0 : node.hidden) ? mergeSxProps(composedSx, {
188
+ display: 'none'
189
+ }) : composedSx;
190
+ // Shared leaf attributes; self-closing components must receive NO
191
+ // children at all (AGL-579) — a separate element expression keeps the
192
+ // childless case genuinely childless instead of `[undefined, false]`.
193
+ const leafProps = _extends({
194
+ ref,
195
+ 'data-aglyn': `leaf:${node == null ? void 0 : node.$id}`
196
+ }, animation == null ? void 0 : animation.attributes, resolvedProps, rest, {
197
+ className: mergedClassName,
198
+ style: mergedStyle,
199
+ sx: transformSx ? transformSx(mergedSx, node == null ? void 0 : node.$id) : mergedSx
200
+ });
201
+ // Node identity (AGL-659): components get their node id through a
202
+ // context rather than a prop, so a block can look up the server-seeded
203
+ // slice of `pageData` that belongs to IT — two grids on one page have
204
+ // different queries and must not share a seed. Nothing is added to any
205
+ // component's props, so no unknown attribute reaches the DOM.
206
+ // Positional children (AGL-1237): a component that splits its children
207
+ // by index — MUI's Accordion is `[summary, ...rest]` — must receive one
208
+ // React child per node child. The default single `<Branch>` element reads
209
+ // as ONE child to `Children.toArray`, so the first slot swallowed the
210
+ // whole subtree and every later slot got nothing.
211
+ const positional = Boolean(((_ref3 = schema == null ? void 0 : (_schema_flags1 = schema.flags) == null ? void 0 : _schema_flags1.positionalChildren) != null ? _ref3 : 0) & FEATURE_FLAG.ENABLED);
212
+ const childNodes = positional ? (_ref4 = node == null ? void 0 : node.children) != null ? _ref4 : [] : null;
213
+ const element = selfClosing ? /*#__PURE__*/ _jsx(Component, _extends({}, leafProps)) : positional ? /*#__PURE__*/ _jsx(RendererComponents.Consumer, {
214
+ children: ({ StemComponent })=>/*#__PURE__*/ _jsxs(Component, _extends({}, leafProps, {
215
+ children: [
216
+ childNodes.map((child, key)=>{
217
+ var _ref;
218
+ return /*#__PURE__*/ _jsx(StemComponent, {
219
+ node: child
220
+ }, (_ref = child == null ? void 0 : child.$id) != null ? _ref : key);
221
+ }),
222
+ textContent != null && /*#__PURE__*/ _jsx(AglynText, {
223
+ children: textContent
224
+ })
225
+ ]
226
+ }))
227
+ }) : /*#__PURE__*/ _jsxs(Component, _extends({}, leafProps, {
228
+ children: [
229
+ children,
230
+ textContent != null && /*#__PURE__*/ _jsx(AglynText, {
231
+ children: textContent
232
+ })
233
+ ]
234
+ }));
235
+ return /*#__PURE__*/ _jsx(NodeIdentityContext.Provider, {
236
+ value: (_ref5 = node == null ? void 0 : node.$id) != null ? _ref5 : '',
237
+ children: element
238
+ });
239
+ }));
240
+ Leaf.displayName = 'Leaf';
241
+ Leaf['aglyn'] = true;
242
+ export default Leaf;
243
+
244
+ //# sourceMappingURL=leaf.js.map
@@ -0,0 +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 { 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 { styled, useTheme } 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 ...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 // 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 const authorSx = sanitizeAuthorSx(node?.sx)\n const composedSx = pinRampedTypographySx(\n resolvePaletteVarsSx(\n resolveSchemeSx(\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","FEATURE_FLAG","AglynText","styled","useTheme","mergeSxProps","observer","forwardRef","useContext","isValidElementType","RendererComponents","LeafSxTransformContext","resolvePaletteVarsSx","resolveSchemeSx","DefaultComponent","Leaf","props","ref","node","schema","theme","children","sx","className","style","rest","resolvedProps","propsSx","propsClassName","propsStyle","_hideIf","_hideUnless","_animation","_animationTrigger","_animationDuration","_animationDelay","_animationRepeat","_animationEase","_animationStagger","_animationStaggerStep","animation","enabledPlugins","registeredSchema","getSchema","componentId","offForSite","pluginId","Factory","undefined","getFactory","Component","selfClosing","Boolean","flags","ENABLED","textContent","mergedClassName","filter","join","mergedStyle","transformSx","activeScheme","palette","mode","authorSx","composedSx","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,SAASC,YAAY,QAAQ,2CAA0C;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,0EAA0E;AAC1E,SAASC,SAAS,QAAQ,6CAA4C;AACtE,SAASC,MAAM,EAAEC,QAAQ,QAAQ,yBAAwB;AACzD,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,EAAuBC,UAAU,QAAQ,QAAO;AACnE,SAASC,kBAAkB,QAAQ,WAA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,GAAG,EAAE;OAG9B9B,6BAAAA,UAAW+B,UAAU,EACrB7C,eACAD;QACHF,WAAWiC;QACXhC,OAAOmC;QACPrC,IAAIsC,cACCA,YAAYM,UAAUhD,wBAAAA,KAAMoD,GAAG,IAChCJ;;IAGN,kEAAkE;IAClE,uEAAuE;IACvE,sEAAsE;IACtE,uEAAuE;IACvE,8DAA8D;IAC9D,uEAAuE;IACvE,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,kDAAkD;IAClD,MAAMM,aAAapB,QACjB,UAACjC,2BAAAA,iBAAAA,OAAQkC,KAAK,qBAAblC,eAAesD,kBAAkB,oBAAI,KAAKxE,aAAaqD,OAAO;IAEjE,MAAMoB,aAAaF,sBAActD,wBAAAA,KAAMG,QAAQ,oBAAI,EAAE,GAAI;IAEzD,MAAMsD,UAAUxB,4BACd,KAACD,wBAAcmB,cACbG,2BACF,KAAC9D,mBAAmBkE,QAAQ;kBACzB,CAAC,EAAEC,aAAa,EAAE,iBACjB,MAAC3B,wBAAcmB;;oBACZK,WAAYI,GAAG,CAAC,CAACC,OAAYC;;6CAC5B,KAACH;4BAAsC3D,MAAM6D;mCAAzBA,yBAAAA,MAAOT,GAAG,mBAAIU;;oBAEnCzB,eAAe,sBACd,KAACrD;kCAAWqD;;;;uBAMpB,MAACL,wBAAcmB;;YACZhD;YAEAkC,eAAe,sBACd,KAACrD;0BAAWqD;;;;IAKlB,qBACE,KAACvD,oBAAoBiF,QAAQ;QAACC,KAAK,WAAEhE,wBAAAA,KAAMoD,GAAG,oBAAI;kBAC/CK;;AAGP,IACD;AACD5D,KAAKoE,WAAW,GAAG;AACnBpE,IAAI,CAAC,QAAQ,GAAG;AAEhB,eAAeA,KAAI"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type * as Aglyn from '@aglyn/aglyn';
18
+ export interface StemProps {
19
+ node: Aglyn.NodeSchema<any>;
20
+ }
21
+ export declare const Stem: import("react").FunctionComponent<StemProps & import("react").RefAttributes<any>>;
22
+ export default Stem;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 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
+ */ // Type-only: this file names `Aglyn.NodeSchema` and nothing else, and a
17
+ // VALUE namespace import of the core barrel is opaque to a bundler — it
18
+ // cannot know which exports are read, so every module the barrel reaches
19
+ // is pinned into the published page's first load.
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ // Deep import, NOT the barrel — see the note in `leaf.tsx`.
22
+ import { ErrorBoundaryComponent } from "@aglyn/shared-ui-jsx/components/error-boundary.component";
23
+ import { observer } from "mobx-react-lite";
24
+ import { forwardRef } from "react";
25
+ import RendererComponents from "../contexts/renderer-components.js";
26
+ export const Stem = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
27
+ const { node } = props;
28
+ if (!node) {
29
+ console.error(`Error rendering`, node);
30
+ return /*#__PURE__*/ _jsx("div", {
31
+ "data-aglyn": "stem:missing"
32
+ });
33
+ }
34
+ return /*#__PURE__*/ _jsx(ErrorBoundaryComponent, {
35
+ fallback: /*#__PURE__*/ _jsx("div", {
36
+ "data-aglyn": `stem:error:${node.$id}`
37
+ }),
38
+ children: /*#__PURE__*/ _jsx(RendererComponents.Consumer, {
39
+ children: ({ LeafComponent, BranchComponent })=>/*#__PURE__*/ _jsx(LeafComponent, {
40
+ ref: ref,
41
+ node: node,
42
+ children: /*#__PURE__*/ _jsx(BranchComponent, {
43
+ node: node
44
+ })
45
+ })
46
+ })
47
+ });
48
+ }));
49
+ Stem.displayName = 'Stem';
50
+ Stem['aglyn'] = true;
51
+ export default Stem;
52
+
53
+ //# sourceMappingURL=stem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/components/stem.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: this file names `Aglyn.NodeSchema` and nothing else, and a\n// VALUE namespace import of the core barrel is opaque to a bundler — it\n// cannot know which exports are read, so every module the barrel reaches\n// is pinned into the published page's first load.\nimport type * as Aglyn from '@aglyn/aglyn'\n// Deep import, NOT the barrel — see the note in `leaf.tsx`.\nimport { ErrorBoundaryComponent } from '@aglyn/shared-ui-jsx/components/error-boundary.component'\nimport { observer } from 'mobx-react-lite'\nimport { forwardRef } from 'react'\nimport RendererComponents from '../contexts/renderer-components'\n\nexport interface StemProps {\n node: Aglyn.NodeSchema<any>\n}\n\nexport const Stem = observer(\n forwardRef<any, StemProps>((props, ref) => {\n const { node } = props\n\n if (!node) {\n console.error(`Error rendering`, node)\n return <div data-aglyn=\"stem:missing\" />\n }\n\n return (\n <ErrorBoundaryComponent fallback={<div data-aglyn={`stem:error:${node.$id}`} />}>\n <RendererComponents.Consumer>\n {({ LeafComponent, BranchComponent }) => (\n <LeafComponent ref={ref} node={node}>\n <BranchComponent node={node} />\n </LeafComponent>\n )}\n </RendererComponents.Consumer>\n </ErrorBoundaryComponent>\n )\n }),\n)\nStem.displayName = 'Stem'\nStem['aglyn'] = true\n\nexport default Stem\n"],"names":["ErrorBoundaryComponent","observer","forwardRef","RendererComponents","Stem","props","ref","node","console","error","div","data-aglyn","fallback","$id","Consumer","LeafComponent","BranchComponent","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,kDAAkD;;AAElD,4DAA4D;AAC5D,SAASA,sBAAsB,QAAQ,2DAA0D;AACjG,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,QAAQ,QAAO;AAClC,OAAOC,wBAAwB,qCAAiC;AAMhE,OAAO,MAAMC,OAAOH,uBAClBC,WAA2B,CAACG,OAAOC;IACjC,MAAM,EAAEC,IAAI,EAAE,GAAGF;IAEjB,IAAI,CAACE,MAAM;QACTC,QAAQC,KAAK,CAAC,CAAC,eAAe,CAAC,EAAEF;QACjC,qBAAO,KAACG;YAAIC,cAAW;;IACzB;IAEA,qBACE,KAACX;QAAuBY,wBAAU,KAACF;YAAIC,cAAY,CAAC,WAAW,EAAEJ,KAAKM,GAAG,EAAE;;kBACzE,cAAA,KAACV,mBAAmBW,QAAQ;sBACzB,CAAC,EAAEC,aAAa,EAAEC,eAAe,EAAE,iBAClC,KAACD;oBAAcT,KAAKA;oBAAKC,MAAMA;8BAC7B,cAAA,KAACS;wBAAgBT,MAAMA;;;;;AAMnC,IACD;AACDH,KAAKa,WAAW,GAAG;AACnBb,IAAI,CAAC,QAAQ,GAAG;AAEhB,eAAeA,KAAI"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type * as Aglyn from '@aglyn/aglyn';
18
+ import { type RenderComponentsContext } from '../contexts/renderer-components';
19
+ export interface TreeRootProps extends Partial<RenderComponentsContext> {
20
+ node: Aglyn.NodeSchema;
21
+ }
22
+ export declare const TreeRoot: import("react").FunctionComponent<TreeRootProps & import("react").RefAttributes<any>>;
23
+ export default TreeRoot;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 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
+ */ // Type-only: this file names `Aglyn.NodeSchema` and nothing else, and a
17
+ // VALUE namespace import of the core barrel is opaque to a bundler — it
18
+ // cannot know which exports are read, so every module the barrel reaches
19
+ // is pinned into the published page's first load.
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { observer } from "mobx-react-lite";
22
+ import { forwardRef, useMemo } from "react";
23
+ import RendererComponents from "../contexts/renderer-components.js";
24
+ import Branch from "./branch.js";
25
+ import Leaf from "./leaf.js";
26
+ import Stem from "./stem.js";
27
+ import Trunk from "./trunk.js";
28
+ export const TreeRoot = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
29
+ const { node, TrunkComponent, StemComponent, BranchComponent, LeafComponent } = props;
30
+ const Components = useMemo(()=>({
31
+ TrunkComponent: TrunkComponent != null ? TrunkComponent : Trunk,
32
+ StemComponent: StemComponent != null ? StemComponent : Stem,
33
+ BranchComponent: BranchComponent != null ? BranchComponent : Branch,
34
+ LeafComponent: LeafComponent != null ? LeafComponent : Leaf
35
+ }), [
36
+ TrunkComponent,
37
+ StemComponent,
38
+ BranchComponent,
39
+ LeafComponent
40
+ ]);
41
+ return /*#__PURE__*/ _jsx(RendererComponents.Provider, {
42
+ value: Components,
43
+ children: /*#__PURE__*/ _jsx(Components.TrunkComponent, {
44
+ ref: ref,
45
+ node: node
46
+ })
47
+ });
48
+ }));
49
+ TreeRoot.displayName = 'TreeRoot';
50
+ TreeRoot['aglyn'] = true;
51
+ export default TreeRoot;
52
+
53
+ //# sourceMappingURL=tree-root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/components/tree-root.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: this file names `Aglyn.NodeSchema` and nothing else, and a\n// VALUE namespace import of the core barrel is opaque to a bundler — it\n// cannot know which exports are read, so every module the barrel reaches\n// is pinned into the published page's first load.\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { observer } from 'mobx-react-lite'\nimport { forwardRef, useMemo } from 'react'\nimport RendererComponents, {\n type RenderComponentsContext,\n} from '../contexts/renderer-components'\nimport Branch from './branch'\nimport Leaf from './leaf'\nimport Stem from './stem'\nimport Trunk from './trunk'\n\nexport interface TreeRootProps extends Partial<RenderComponentsContext> {\n node: Aglyn.NodeSchema\n}\n\nexport const TreeRoot = observer(\n forwardRef<any, TreeRootProps>((props, ref) => {\n const {\n node,\n TrunkComponent,\n StemComponent,\n BranchComponent,\n LeafComponent,\n } = props\n\n const Components = useMemo<RenderComponentsContext>(\n () => ({\n TrunkComponent: (TrunkComponent ?? Trunk) as RenderComponentsContext['TrunkComponent'],\n StemComponent: (StemComponent ?? Stem) as RenderComponentsContext['StemComponent'],\n BranchComponent: (BranchComponent ?? Branch) as RenderComponentsContext['BranchComponent'],\n LeafComponent: (LeafComponent ?? Leaf) as RenderComponentsContext['LeafComponent'],\n }),\n [TrunkComponent, StemComponent, BranchComponent, LeafComponent],\n )\n\n return (\n <RendererComponents.Provider value={Components}>\n <Components.TrunkComponent ref={ref} node={node} />\n </RendererComponents.Provider>\n )\n }),\n)\nTreeRoot.displayName = 'TreeRoot'\nTreeRoot['aglyn'] = true\n\nexport default TreeRoot\n"],"names":["observer","forwardRef","useMemo","RendererComponents","Branch","Leaf","Stem","Trunk","TreeRoot","props","ref","node","TrunkComponent","StemComponent","BranchComponent","LeafComponent","Components","Provider","value","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,kDAAkD;;AAElD,SAASA,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,EAAEC,OAAO,QAAQ,QAAO;AAC3C,OAAOC,wBAEA,qCAAiC;AACxC,OAAOC,YAAY,cAAU;AAC7B,OAAOC,UAAU,YAAQ;AACzB,OAAOC,UAAU,YAAQ;AACzB,OAAOC,WAAW,aAAS;AAM3B,OAAO,MAAMC,WAAWR,uBACtBC,WAA+B,CAACQ,OAAOC;IACrC,MAAM,EACJC,IAAI,EACJC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,aAAa,EACd,GAAGN;IAEJ,MAAMO,aAAad,QACjB,IAAO,CAAA;YACLU,cAAc,EAAGA,yBAAAA,iBAAkBL;YACnCM,aAAa,EAAGA,wBAAAA,gBAAiBP;YACjCQ,eAAe,EAAGA,0BAAAA,kBAAmBV;YACrCW,aAAa,EAAGA,wBAAAA,gBAAiBV;QACnC,CAAA,GACA;QAACO;QAAgBC;QAAeC;QAAiBC;KAAc;IAGjE,qBACE,KAACZ,mBAAmBc,QAAQ;QAACC,OAAOF;kBAClC,cAAA,KAACA,WAAWJ,cAAc;YAACF,KAAKA;YAAKC,MAAMA;;;AAGjD,IACD;AACDH,SAASW,WAAW,GAAG;AACvBX,QAAQ,CAAC,QAAQ,GAAG;AAEpB,eAAeA,SAAQ"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type * as Aglyn from '@aglyn/aglyn';
18
+ export interface TrunkProps {
19
+ node: Aglyn.NodeSchema<any>;
20
+ }
21
+ export declare const Trunk: import("react").FunctionComponent<TrunkProps & import("react").RefAttributes<any>>;
22
+ export default Trunk;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 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
+ */ // Type-only: this file names `Aglyn.NodeSchema` and nothing else, and a
17
+ // VALUE namespace import of the core barrel is opaque to a bundler — it
18
+ // cannot know which exports are read, so every module the barrel reaches
19
+ // is pinned into the published page's first load.
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
+ import { observer } from "mobx-react-lite";
22
+ import { forwardRef } from "react";
23
+ import RendererComponents from "../contexts/renderer-components.js";
24
+ export const Trunk = observer(/*#__PURE__*/ forwardRef((props, ref)=>{
25
+ const { node } = props;
26
+ return /*#__PURE__*/ _jsx(RendererComponents.Consumer, {
27
+ children: ({ StemComponent })=>/*#__PURE__*/ _jsx(StemComponent, {
28
+ ref: ref,
29
+ node: node
30
+ })
31
+ });
32
+ }));
33
+ Trunk.displayName = 'Trunk';
34
+ Trunk['aglyn'] = true;
35
+ export default Trunk;
36
+
37
+ //# sourceMappingURL=trunk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/components/trunk.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: this file names `Aglyn.NodeSchema` and nothing else, and a\n// VALUE namespace import of the core barrel is opaque to a bundler — it\n// cannot know which exports are read, so every module the barrel reaches\n// is pinned into the published page's first load.\nimport type * as Aglyn from '@aglyn/aglyn'\nimport { observer } from 'mobx-react-lite'\nimport { forwardRef } from 'react'\nimport RendererComponents from '../contexts/renderer-components'\n\nexport interface TrunkProps {\n node: Aglyn.NodeSchema<any>\n}\n\nexport const Trunk = observer(\n forwardRef<any, TrunkProps>((props, ref) => {\n const { node } = props\n\n return (\n <RendererComponents.Consumer>\n {({ StemComponent }) => <StemComponent ref={ref} node={node} />}\n </RendererComponents.Consumer>\n )\n }),\n)\nTrunk.displayName = 'Trunk'\nTrunk['aglyn'] = true\n\nexport default Trunk\n"],"names":["observer","forwardRef","RendererComponents","Trunk","props","ref","node","Consumer","StemComponent","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,wEAAwE;AACxE,wEAAwE;AACxE,yEAAyE;AACzE,kDAAkD;;AAElD,SAASA,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,UAAU,QAAQ,QAAO;AAClC,OAAOC,wBAAwB,qCAAiC;AAMhE,OAAO,MAAMC,QAAQH,uBACnBC,WAA4B,CAACG,OAAOC;IAClC,MAAM,EAAEC,IAAI,EAAE,GAAGF;IAEjB,qBACE,KAACF,mBAAmBK,QAAQ;kBACzB,CAAC,EAAEC,aAAa,EAAE,iBAAK,KAACA;gBAAcH,KAAKA;gBAAKC,MAAMA;;;AAG7D,IACD;AACDH,MAAMM,WAAW,GAAG;AACpBN,KAAK,CAAC,QAAQ,GAAG;AAEjB,eAAeA,MAAK"}
@@ -0,0 +1,34 @@
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
+ * Optional transform applied to the fully merged sx of every rendered
19
+ * Leaf (caller sx + node props.sx + node-level sx) just before it
20
+ * reaches the element (AGL-581). The besigner canvas provides it while
21
+ * an artboard device preview is active, re-targeting viewport media
22
+ * queries (visibility bands, custom width queries) at the simulated
23
+ * device width. Production tenant rendering never mounts the provider,
24
+ * so published sites keep real media-query behavior untouched.
25
+ *
26
+ * `nodeId` (AGL-2486) lets a transform apply to ONE node rather than the
27
+ * whole canvas — the interaction-state hold renders only the SELECTED
28
+ * element as if hovered/pressed/focused, and every other leaf must keep
29
+ * rendering its resting state. Optional and ignored by the device-width
30
+ * transform, which is canvas-wide.
31
+ */
32
+ export type LeafSxTransform = (sx: unknown, nodeId?: string) => unknown;
33
+ export declare const LeafSxTransformContext: import("react").Context<LeafSxTransform>;
34
+ export default LeafSxTransformContext;
@@ -0,0 +1,21 @@
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
+ export const LeafSxTransformContext = /*#__PURE__*/ createContext(undefined);
18
+ LeafSxTransformContext.displayName = 'LeafSxTransformContext';
19
+ export default LeafSxTransformContext;
20
+
21
+ //# sourceMappingURL=leaf-sx-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/contexts/leaf-sx-transform.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 { createContext } from 'react'\n\n/**\n * Optional transform applied to the fully merged sx of every rendered\n * Leaf (caller sx + node props.sx + node-level sx) just before it\n * reaches the element (AGL-581). The besigner canvas provides it while\n * an artboard device preview is active, re-targeting viewport media\n * queries (visibility bands, custom width queries) at the simulated\n * device width. Production tenant rendering never mounts the provider,\n * so published sites keep real media-query behavior untouched.\n *\n * `nodeId` (AGL-2486) lets a transform apply to ONE node rather than the\n * whole canvas — the interaction-state hold renders only the SELECTED\n * element as if hovered/pressed/focused, and every other leaf must keep\n * rendering its resting state. Optional and ignored by the device-width\n * transform, which is canvas-wide.\n */\nexport type LeafSxTransform = (sx: unknown, nodeId?: string) => unknown\n\nexport const LeafSxTransformContext = createContext<\n LeafSxTransform | undefined\n>(undefined)\nLeafSxTransformContext.displayName = 'LeafSxTransformContext'\n\nexport default LeafSxTransformContext\n"],"names":["createContext","LeafSxTransformContext","undefined","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,QAAO;AAmBrC,OAAO,MAAMC,uCAAyBD,cAEpCE,WAAU;AACZD,uBAAuBE,WAAW,GAAG;AAErC,eAAeF,uBAAsB"}