@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,30 @@
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 ComponentType, type RefAttributes } from 'react';
18
+ import type { BranchProps } from '../components/branch';
19
+ import type { LeafProps } from '../components/leaf';
20
+ import type { StemProps } from '../components/stem';
21
+ import type { TrunkProps } from '../components/trunk';
22
+ type RenderComponent<P> = ComponentType<P & RefAttributes<any>> | JSX.ForwardRefExoticComponent<P & RefAttributes<any>>;
23
+ export interface RenderComponentsContext {
24
+ TrunkComponent: RenderComponent<TrunkProps>;
25
+ StemComponent: RenderComponent<StemProps>;
26
+ BranchComponent: JSX.FunctionComponent<BranchProps>;
27
+ LeafComponent: RenderComponent<LeafProps>;
28
+ }
29
+ export declare const RendererComponents: import("react").Context<RenderComponentsContext>;
30
+ export default RendererComponents;
@@ -0,0 +1,27 @@
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
+ */ import { createContext } from "react";
17
+ export const RendererComponents = /*#__PURE__*/ createContext({
18
+ TrunkComponent: null,
19
+ StemComponent: null,
20
+ BranchComponent: null,
21
+ LeafComponent: null
22
+ });
23
+ RendererComponents.displayName = 'RendererComponents';
24
+ RendererComponents['aglyn'] = true;
25
+ export default RendererComponents;
26
+
27
+ //# sourceMappingURL=renderer-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/contexts/renderer-components.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\nimport {\n type ComponentType,\n createContext,\n type RefAttributes,\n} from 'react'\nimport type { BranchProps } from '../components/branch'\nimport type { LeafProps } from '../components/leaf'\nimport type { StemProps } from '../components/stem'\nimport type { TrunkProps } from '../components/trunk'\n\n// ComponentType unions cover both plain function components and the\n// FunctionComponent that mobx observer() returns when wrapping forwardRef.\ntype RenderComponent<P> =\n | ComponentType<P & RefAttributes<any>>\n | JSX.ForwardRefExoticComponent<P & RefAttributes<any>>\n\nexport interface RenderComponentsContext {\n TrunkComponent: RenderComponent<TrunkProps>\n StemComponent: RenderComponent<StemProps>\n BranchComponent: JSX.FunctionComponent<BranchProps>\n LeafComponent: RenderComponent<LeafProps>\n}\nexport const RendererComponents = createContext<RenderComponentsContext>({\n TrunkComponent: null,\n StemComponent: null,\n BranchComponent: null,\n LeafComponent: null,\n})\nRendererComponents.displayName = 'RendererComponents'\nRendererComponents['aglyn'] = true\n\nexport default RendererComponents\n"],"names":["createContext","RendererComponents","TrunkComponent","StemComponent","BranchComponent","LeafComponent","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAEEA,aAAa,QAER,QAAO;AAkBd,OAAO,MAAMC,mCAAqBD,cAAuC;IACvEE,gBAAgB;IAChBC,eAAe;IACfC,iBAAiB;IACjBC,eAAe;AACjB,GAAE;AACFJ,mBAAmBK,WAAW,GAAG;AACjCL,kBAAkB,CAAC,QAAQ,GAAG;AAE9B,eAAeA,mBAAkB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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 { HostTheme, HostThemeScheme } from '@aglyn/shared-data-types';
18
+ export type UseAglynSiteThemeOptions = {
19
+ container?: Element | Node;
20
+ /** Persisted host theme customization; omitted → default light theme (legacy behavior). */
21
+ theme?: HostTheme;
22
+ scheme?: HostThemeScheme;
23
+ /**
24
+ * Which site this is — its attached domain, or its subdomain (AGL-3068).
25
+ *
26
+ * It decides the BASE the site's overrides are layered onto, which is the
27
+ * one thing the editor cannot derive from the theme document: the operator's
28
+ * own hosts keep the platform brand, every customer site resolves the
29
+ * neutral tenant default, and the published page has already made that
30
+ * choice from its own address. Unnamed resolves what a customer site
31
+ * resolves.
32
+ *
33
+ * `useAglynSiteTheme` falls back to `HostSiteKeyContext`, so a surface
34
+ * inside the console's host routes needs to pass nothing.
35
+ */
36
+ host?: string;
37
+ };
38
+ /**
39
+ * The theme a site renders with on the canvas and in Preview: the host's
40
+ * overrides layered onto the base that site publishes on, with MUI's portals
41
+ * pointed at the container. {@link useAglynSiteTheme} memoizes it; anything
42
+ * that renders a site outside React's hooks — the AI plugin's device-width
43
+ * audit of its golden pages (AGL-3020) — builds the same theme here.
44
+ */
45
+ export declare function createAglynSiteTheme(options?: UseAglynSiteThemeOptions): import("@mui/material").Theme;
46
+ export declare function useAglynSiteTheme(options?: UseAglynSiteThemeOptions): import("@mui/material").Theme;
47
+ export default useAglynSiteTheme;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 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 { _ as _extends } from "@swc/helpers/_/_extends";
17
+ import { createResponsiveTheme, hostThemeToThemeOptions, mergeThemeOptions, siteBaseOptions, useHostSiteKey } from "@aglyn/shared-ui-theme";
18
+ import { useMemo } from "react";
19
+ /**
20
+ * The theme a site renders with on the canvas and in Preview: the host's
21
+ * overrides layered onto the base that site publishes on, with MUI's portals
22
+ * pointed at the container. {@link useAglynSiteTheme} memoizes it; anything
23
+ * that renders a site outside React's hooks — the AI plugin's device-width
24
+ * audit of its golden pages (AGL-3020) — builds the same theme here.
25
+ */ export function createAglynSiteTheme(options = {}) {
26
+ var _options_scheme;
27
+ var _themeOptions_components, _themeOptions_components_MuiPopover, _themeOptions_components1, _themeOptions_components2, _themeOptions_components_MuiPopper, _themeOptions_components3, _themeOptions_components4, _themeOptions_components_MuiModal, _themeOptions_components5;
28
+ const container = options.container;
29
+ const hostTheme = options.theme;
30
+ const scheme = (_options_scheme = options.scheme) != null ? _options_scheme : 'light';
31
+ // Layer the host's overrides onto the base the PUBLISHED PAGE uses, chosen
32
+ // from the same site key the tenant chooses from (AGL-1180/AGL-1205,
33
+ // AGL-3068). `hostThemeToThemeOptions` emits only what the host explicitly
34
+ // set, so building from it alone leaves every untouched slot on MUI's stock
35
+ // palette — and a site that keeps its theme all-`Default` has nothing else.
36
+ // Which base is not a constant: the operator's own hosts wear the platform
37
+ // brand and a customer site wears the neutral tenant default, so a canvas
38
+ // that always took the brand painted Aglyn cyan over a site that publishes
39
+ // in blue, including its contrast.
40
+ const themeOptions = mergeThemeOptions(siteBaseOptions(options.host, scheme), hostThemeToThemeOptions(hostTheme, scheme));
41
+ // createResponsiveTheme, not plain createTheme (AGL-593): the tenant
42
+ // builds host themes through it (HostThemeProvider), which bakes
43
+ // responsive font sizes into the typography variants — the canvas
44
+ // must carry the same media-keyed typography or device preview has
45
+ // nothing to re-resolve and canvas/tenant text sizes disagree.
46
+ return createResponsiveTheme({
47
+ themeOptions: _extends({}, themeOptions, {
48
+ components: _extends({}, themeOptions.components, {
49
+ // Spread the existing entry per component: now that the brand base
50
+ // is merged in, replacing these wholesale would drop any
51
+ // `styleOverrides` it ships for them. Only `defaultProps.container`
52
+ // is ours to set — it points MUI's portals at the canvas container.
53
+ MuiPopover: _extends({}, (_themeOptions_components = themeOptions.components) == null ? void 0 : _themeOptions_components.MuiPopover, {
54
+ defaultProps: _extends({}, (_themeOptions_components1 = themeOptions.components) == null ? void 0 : (_themeOptions_components_MuiPopover = _themeOptions_components1.MuiPopover) == null ? void 0 : _themeOptions_components_MuiPopover.defaultProps, {
55
+ container: container
56
+ })
57
+ }),
58
+ MuiPopper: _extends({}, (_themeOptions_components2 = themeOptions.components) == null ? void 0 : _themeOptions_components2.MuiPopper, {
59
+ defaultProps: _extends({}, (_themeOptions_components3 = themeOptions.components) == null ? void 0 : (_themeOptions_components_MuiPopper = _themeOptions_components3.MuiPopper) == null ? void 0 : _themeOptions_components_MuiPopper.defaultProps, {
60
+ container: container
61
+ })
62
+ }),
63
+ MuiModal: _extends({}, (_themeOptions_components4 = themeOptions.components) == null ? void 0 : _themeOptions_components4.MuiModal, {
64
+ defaultProps: _extends({}, (_themeOptions_components5 = themeOptions.components) == null ? void 0 : (_themeOptions_components_MuiModal = _themeOptions_components5.MuiModal) == null ? void 0 : _themeOptions_components_MuiModal.defaultProps, {
65
+ container: container
66
+ })
67
+ })
68
+ })
69
+ })
70
+ });
71
+ }
72
+ export function useAglynSiteTheme(options = {}) {
73
+ var _options_scheme, _options_host;
74
+ const container = options.container;
75
+ const hostTheme = options.theme;
76
+ const scheme = (_options_scheme = options.scheme) != null ? _options_scheme : 'light';
77
+ // The surface names its site, or the route it is on does. Every besigner
78
+ // panel and preview reads the same context, so the base is decided once per
79
+ // editor rather than per component.
80
+ const contextHost = useHostSiteKey();
81
+ const host = (_options_host = options.host) != null ? _options_host : contextHost;
82
+ return useMemo(()=>createAglynSiteTheme({
83
+ container,
84
+ theme: hostTheme,
85
+ scheme,
86
+ host
87
+ }), [
88
+ container,
89
+ hostTheme,
90
+ scheme,
91
+ host
92
+ ]);
93
+ }
94
+ export default useAglynSiteTheme;
95
+
96
+ //# sourceMappingURL=use-aglyn-site-theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/hooks/use-aglyn-site-theme.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2022 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 type { HostTheme, HostThemeScheme } from '@aglyn/shared-data-types'\nimport {\n createResponsiveTheme,\n hostThemeToThemeOptions,\n mergeThemeOptions,\n siteBaseOptions,\n useHostSiteKey,\n} from '@aglyn/shared-ui-theme'\nimport { useMemo } from 'react'\n\nexport type UseAglynSiteThemeOptions = {\n // Node covers ShadowRoot containers, which MUI accepts at runtime but\n // types as Element only.\n container?: Element | Node\n /** Persisted host theme customization; omitted → default light theme (legacy behavior). */\n theme?: HostTheme\n scheme?: HostThemeScheme\n /**\n * Which site this is — its attached domain, or its subdomain (AGL-3068).\n *\n * It decides the BASE the site's overrides are layered onto, which is the\n * one thing the editor cannot derive from the theme document: the operator's\n * own hosts keep the platform brand, every customer site resolves the\n * neutral tenant default, and the published page has already made that\n * choice from its own address. Unnamed resolves what a customer site\n * resolves.\n *\n * `useAglynSiteTheme` falls back to `HostSiteKeyContext`, so a surface\n * inside the console's host routes needs to pass nothing.\n */\n host?: string\n}\n\n/**\n * The theme a site renders with on the canvas and in Preview: the host's\n * overrides layered onto the base that site publishes on, with MUI's portals\n * pointed at the container. {@link useAglynSiteTheme} memoizes it; anything\n * that renders a site outside React's hooks — the AI plugin's device-width\n * audit of its golden pages (AGL-3020) — builds the same theme here.\n */\nexport function createAglynSiteTheme(options: UseAglynSiteThemeOptions = {}) {\n const container = options.container as Element | undefined\n const hostTheme = options.theme\n const scheme = options.scheme ?? 'light'\n // Layer the host's overrides onto the base the PUBLISHED PAGE uses, chosen\n // from the same site key the tenant chooses from (AGL-1180/AGL-1205,\n // AGL-3068). `hostThemeToThemeOptions` emits only what the host explicitly\n // set, so building from it alone leaves every untouched slot on MUI's stock\n // palette — and a site that keeps its theme all-`Default` has nothing else.\n // Which base is not a constant: the operator's own hosts wear the platform\n // brand and a customer site wears the neutral tenant default, so a canvas\n // that always took the brand painted Aglyn cyan over a site that publishes\n // in blue, including its contrast.\n const themeOptions = mergeThemeOptions(\n siteBaseOptions(options.host, scheme),\n hostThemeToThemeOptions(hostTheme, scheme),\n )\n // createResponsiveTheme, not plain createTheme (AGL-593): the tenant\n // builds host themes through it (HostThemeProvider), which bakes\n // responsive font sizes into the typography variants — the canvas\n // must carry the same media-keyed typography or device preview has\n // nothing to re-resolve and canvas/tenant text sizes disagree.\n return createResponsiveTheme({\n themeOptions: {\n ...themeOptions,\n components: {\n ...themeOptions.components,\n // Spread the existing entry per component: now that the brand base\n // is merged in, replacing these wholesale would drop any\n // `styleOverrides` it ships for them. Only `defaultProps.container`\n // is ours to set — it points MUI's portals at the canvas container.\n MuiPopover: {\n ...themeOptions.components?.MuiPopover,\n defaultProps: {\n ...themeOptions.components?.MuiPopover?.defaultProps,\n container: container,\n },\n },\n MuiPopper: {\n ...themeOptions.components?.MuiPopper,\n defaultProps: {\n ...themeOptions.components?.MuiPopper?.defaultProps,\n container: container,\n },\n },\n MuiModal: {\n ...themeOptions.components?.MuiModal,\n defaultProps: {\n ...themeOptions.components?.MuiModal?.defaultProps,\n container: container,\n },\n },\n },\n },\n })\n}\n\nexport function useAglynSiteTheme(options: UseAglynSiteThemeOptions = {}) {\n const container = options.container\n const hostTheme = options.theme\n const scheme = options.scheme ?? 'light'\n // The surface names its site, or the route it is on does. Every besigner\n // panel and preview reads the same context, so the base is decided once per\n // editor rather than per component.\n const contextHost = useHostSiteKey()\n const host = options.host ?? contextHost\n\n return useMemo(\n () => createAglynSiteTheme({ container, theme: hostTheme, scheme, host }),\n [container, hostTheme, scheme, host],\n )\n}\nexport default useAglynSiteTheme\n"],"names":["createResponsiveTheme","hostThemeToThemeOptions","mergeThemeOptions","siteBaseOptions","useHostSiteKey","useMemo","createAglynSiteTheme","options","themeOptions","container","hostTheme","theme","scheme","host","components","MuiPopover","defaultProps","MuiPopper","MuiModal","useAglynSiteTheme","contextHost"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SACEA,qBAAqB,EACrBC,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,QACT,yBAAwB;AAC/B,SAASC,OAAO,QAAQ,QAAO;AAyB/B;;;;;;CAMC,GACD,OAAO,SAASC,qBAAqBC,UAAoC,CAAC,CAAC;QAG1DA;QA6BJC,0BAEEA,qCAAAA,2BAKFA,2BAEEA,oCAAAA,2BAKFA,2BAEEA,mCAAAA;IA/Cb,MAAMC,YAAYF,QAAQE,SAAS;IACnC,MAAMC,YAAYH,QAAQI,KAAK;IAC/B,MAAMC,UAASL,kBAAAA,QAAQK,MAAM,YAAdL,kBAAkB;IACjC,2EAA2E;IAC3E,qEAAqE;IACrE,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,2EAA2E;IAC3E,mCAAmC;IACnC,MAAMC,eAAeN,kBACnBC,gBAAgBI,QAAQM,IAAI,EAAED,SAC9BX,wBAAwBS,WAAWE;IAErC,qEAAqE;IACrE,iEAAiE;IACjE,kEAAkE;IAClE,mEAAmE;IACnE,+DAA+D;IAC/D,OAAOZ,sBAAsB;QAC3BQ,cAAc,aACTA;YACHM,YAAY,aACPN,aAAaM,UAAU;gBAC1B,mEAAmE;gBACnE,yDAAyD;gBACzD,oEAAoE;gBACpE,oEAAoE;gBACpEC,YAAY,cACPP,2BAAAA,aAAaM,UAAU,qBAAvBN,yBAAyBO,UAAU;oBACtCC,cAAc,cACTR,4BAAAA,aAAaM,UAAU,sBAAvBN,sCAAAA,0BAAyBO,UAAU,qBAAnCP,oCAAqCQ,YAAY;wBACpDP,WAAWA;;;gBAGfQ,WAAW,cACNT,4BAAAA,aAAaM,UAAU,qBAAvBN,0BAAyBS,SAAS;oBACrCD,cAAc,cACTR,4BAAAA,aAAaM,UAAU,sBAAvBN,qCAAAA,0BAAyBS,SAAS,qBAAlCT,mCAAoCQ,YAAY;wBACnDP,WAAWA;;;gBAGfS,UAAU,cACLV,4BAAAA,aAAaM,UAAU,qBAAvBN,0BAAyBU,QAAQ;oBACpCF,cAAc,cACTR,4BAAAA,aAAaM,UAAU,sBAAvBN,oCAAAA,0BAAyBU,QAAQ,qBAAjCV,kCAAmCQ,YAAY;wBAClDP,WAAWA;;;;;IAKrB;AACF;AAEA,OAAO,SAASU,kBAAkBZ,UAAoC,CAAC,CAAC;QAGvDA,iBAKFA;IAPb,MAAME,YAAYF,QAAQE,SAAS;IACnC,MAAMC,YAAYH,QAAQI,KAAK;IAC/B,MAAMC,UAASL,kBAAAA,QAAQK,MAAM,YAAdL,kBAAkB;IACjC,yEAAyE;IACzE,4EAA4E;IAC5E,oCAAoC;IACpC,MAAMa,cAAchB;IACpB,MAAMS,QAAON,gBAAAA,QAAQM,IAAI,YAAZN,gBAAgBa;IAE7B,OAAOf,QACL,IAAMC,qBAAqB;YAAEG;YAAWE,OAAOD;YAAWE;YAAQC;QAAK,IACvE;QAACJ;QAAWC;QAAWE;QAAQC;KAAK;AAExC;AACA,eAAeM,kBAAiB"}
@@ -0,0 +1,25 @@
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 { AglynExoticComponent } from '@aglyn/aglyn/foundation/definitions/components.types';
19
+ import { type ErrorBoundaryProps } from '@aglyn/shared-ui-jsx/components/error-boundary.component';
20
+ export type ComponentRegisterPayload<P extends JSX.AnyProps = any> = {
21
+ schema: Aglyn.ComponentSchema<P>;
22
+ component: AglynExoticComponent<P>;
23
+ };
24
+ export declare function createAglynComponent<P extends JSX.AnyProps = any, C = any>(schema: Aglyn.ComponentSchema<P>, component: C | any, options?: Partial<ErrorBoundaryProps>): ComponentRegisterPayload<P>;
25
+ export default createAglynComponent;
@@ -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: a VALUE namespace import of the core barrel is opaque to a
17
+ // bundler — it cannot know which exports are read, so every module the barrel
18
+ // reaches is pinned into the published page's first load. The values this file
19
+ // needs are named below, where the bundler can see them.
20
+ import { _ as _extends } from "@swc/helpers/_/_extends";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { FEATURE_FLAG } from "@aglyn/aglyn/foundation/constants/shared";
23
+ import { AGLYN_OF, COMPONENT_ELEMENT_TYPE } from "@aglyn/aglyn/foundation/constants/symbol";
24
+ // Deep import, NOT the barrel — see the note in `leaf.tsx`.
25
+ import { withErrorBoundary } from "@aglyn/shared-ui-jsx/components/error-boundary.component";
26
+ import { styled } from "@aglyn/shared-ui-theme";
27
+ import { cloneDeep } from "@aglyn/shared-util-tools";
28
+ import { hoistNonReactStatics, pascalCase } from "@aglyn/shared-util-vendor";
29
+ import { forwardRef } from "react";
30
+ export function createAglynComponent(schema, component, options) {
31
+ const _schema = cloneDeep(schema);
32
+ const { $id, pluginId, flags, styledOptions } = _schema;
33
+ const pascalId = `${pluginId ? pascalCase(pluginId) + '-' : ''}${pascalCase($id)}`;
34
+ const Component = (flags == null ? void 0 : flags.emotion) === FEATURE_FLAG.DISABLED ? component : styled(component, styledOptions)({});
35
+ const AglynComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
36
+ return /*#__PURE__*/ _jsx(Component, _extends({
37
+ ref: ref
38
+ }, props));
39
+ });
40
+ AglynComponent.displayName = `AglynComponent(${pascalId})`;
41
+ AglynComponent['$id'] = $id;
42
+ AglynComponent['pluginId'] = pluginId;
43
+ AglynComponent['aglyn'] = true;
44
+ AglynComponent[AGLYN_OF] = COMPONENT_ELEMENT_TYPE;
45
+ hoistNonReactStatics(AglynComponent, component);
46
+ return {
47
+ component: withErrorBoundary(AglynComponent, options),
48
+ schema: cloneDeep(schema)
49
+ };
50
+ }
51
+ export default createAglynComponent;
52
+
53
+ //# sourceMappingURL=create-aglyn-component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/utils/create-aglyn-component.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: a VALUE namespace import of the core barrel is opaque to a\n// bundler — it cannot know which exports are read, so every module the barrel\n// reaches is pinned into the published page's first load. The values this file\n// needs are named below, where the bundler can see them.\nimport type * as Aglyn from '@aglyn/aglyn'\nimport type { AglynExoticComponent } from '@aglyn/aglyn/foundation/definitions/components.types'\nimport { FEATURE_FLAG } from '@aglyn/aglyn/foundation/constants/shared'\nimport {\n AGLYN_OF,\n COMPONENT_ELEMENT_TYPE,\n} from '@aglyn/aglyn/foundation/constants/symbol'\n// Deep import, NOT the barrel — see the note in `leaf.tsx`.\nimport {\n type ErrorBoundaryProps,\n withErrorBoundary,\n} from '@aglyn/shared-ui-jsx/components/error-boundary.component'\nimport { styled } from '@aglyn/shared-ui-theme'\nimport { cloneDeep } from '@aglyn/shared-util-tools'\nimport { hoistNonReactStatics, pascalCase } from '@aglyn/shared-util-vendor'\nimport { forwardRef } from 'react'\n\nexport type ComponentRegisterPayload<P extends JSX.AnyProps = any> = {\n schema: Aglyn.ComponentSchema<P>\n component: AglynExoticComponent<P>\n}\n\nexport function createAglynComponent<P extends JSX.AnyProps = any, C = any>(\n schema: Aglyn.ComponentSchema<P>,\n component: C | any,\n options?: Partial<ErrorBoundaryProps>,\n): ComponentRegisterPayload<P> {\n const _schema = cloneDeep(schema)\n const { $id, pluginId, flags, styledOptions } = _schema\n const pascalId = `${pluginId ? pascalCase(pluginId) + '-' : ''}${pascalCase(\n $id,\n )}`\n\n const Component =\n flags?.emotion === FEATURE_FLAG.DISABLED\n ? component\n : styled(component, styledOptions)({})\n\n const AglynComponent = forwardRef<any, P>((props, ref) => {\n return <Component ref={ref} {...props} />\n }) as AglynExoticComponent<P>\n\n AglynComponent.displayName = `AglynComponent(${pascalId})`\n AglynComponent['$id'] = $id\n AglynComponent['pluginId'] = pluginId\n AglynComponent['aglyn'] = true\n AglynComponent[AGLYN_OF] = COMPONENT_ELEMENT_TYPE\n hoistNonReactStatics(AglynComponent, component)\n\n return {\n component: withErrorBoundary(\n AglynComponent,\n options,\n ) as AglynExoticComponent<P>,\n schema: cloneDeep(schema),\n }\n}\n\nexport default createAglynComponent\n"],"names":["FEATURE_FLAG","AGLYN_OF","COMPONENT_ELEMENT_TYPE","withErrorBoundary","styled","cloneDeep","hoistNonReactStatics","pascalCase","forwardRef","createAglynComponent","schema","component","options","_schema","$id","pluginId","flags","styledOptions","pascalId","Component","emotion","DISABLED","AglynComponent","props","ref","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,wEAAwE;AACxE,8EAA8E;AAC9E,+EAA+E;AAC/E,yDAAyD;;;AAGzD,SAASA,YAAY,QAAQ,2CAA0C;AACvE,SACEC,QAAQ,EACRC,sBAAsB,QACjB,2CAA0C;AACjD,4DAA4D;AAC5D,SAEEC,iBAAiB,QACZ,2DAA0D;AACjE,SAASC,MAAM,QAAQ,yBAAwB;AAC/C,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,oBAAoB,EAAEC,UAAU,QAAQ,4BAA2B;AAC5E,SAASC,UAAU,QAAQ,QAAO;AAOlC,OAAO,SAASC,qBACdC,MAAgC,EAChCC,SAAkB,EAClBC,OAAqC;IAErC,MAAMC,UAAUR,UAAUK;IAC1B,MAAM,EAAEI,GAAG,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,EAAE,GAAGJ;IAChD,MAAMK,WAAW,GAAGH,WAAWR,WAAWQ,YAAY,MAAM,KAAKR,WAC/DO,MACC;IAEH,MAAMK,YACJH,CAAAA,yBAAAA,MAAOI,OAAO,MAAKpB,aAAaqB,QAAQ,GACpCV,YACAP,OAAOO,WAAWM,eAAe,CAAC;IAExC,MAAMK,+BAAiBd,WAAmB,CAACe,OAAOC;QAChD,qBAAO,KAACL;YAAUK,KAAKA;WAASD;IAClC;IAEAD,eAAeG,WAAW,GAAG,CAAC,eAAe,EAAEP,SAAS,CAAC,CAAC;IAC1DI,cAAc,CAAC,MAAM,GAAGR;IACxBQ,cAAc,CAAC,WAAW,GAAGP;IAC7BO,cAAc,CAAC,QAAQ,GAAG;IAC1BA,cAAc,CAACrB,SAAS,GAAGC;IAC3BI,qBAAqBgB,gBAAgBX;IAErC,OAAO;QACLA,WAAWR,kBACTmB,gBACAV;QAEFF,QAAQL,UAAUK;IACpB;AACF;AAEA,eAAeD,qBAAoB"}
@@ -0,0 +1,31 @@
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
+ * Scheme-scoped node sx (AGL-588) — implementation moved to
19
+ * `@aglyn/aglyn` (`app-utils/scheme-sx`) for AGL-1306: the instance
20
+ * override layer merges sx inside `composeReusableComponentNodes`, which
21
+ * lives there and cannot import this renderer back. This path stays as
22
+ * the renderer's export so its many consumers (the designer's responsive
23
+ * and style-group utils, the canvas leaf) are untouched.
24
+ */
25
+ export { SX_SCHEME_DARK_KEY, isResponsiveSxObject, mergeSchemeValue, resolveSchemeSx, resolveSchemeSx as default, type SxScheme, } from '@aglyn/aglyn/app-utils/scheme-sx';
26
+ /**
27
+ * Palette `var()` substitution (AGL-1331) rides along beside the scheme
28
+ * pass: both resolve persisted sx against the ACTIVE theme, and the leaf
29
+ * applies them together.
30
+ */
31
+ export { resolvePaletteVars, resolvePaletteVarsSx, } from '@aglyn/aglyn/app-utils/palette-sx';
@@ -0,0 +1,30 @@
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
+ * Scheme-scoped node sx (AGL-588) — implementation moved to
18
+ * `@aglyn/aglyn` (`app-utils/scheme-sx`) for AGL-1306: the instance
19
+ * override layer merges sx inside `composeReusableComponentNodes`, which
20
+ * lives there and cannot import this renderer back. This path stays as
21
+ * the renderer's export so its many consumers (the designer's responsive
22
+ * and style-group utils, the canvas leaf) are untouched.
23
+ */ export { SX_SCHEME_DARK_KEY, isResponsiveSxObject, mergeSchemeValue, resolveSchemeSx, resolveSchemeSx as default } from "@aglyn/aglyn/app-utils/scheme-sx";
24
+ /**
25
+ * Palette `var()` substitution (AGL-1331) rides along beside the scheme
26
+ * pass: both resolve persisted sx against the ACTIVE theme, and the leaf
27
+ * applies them together.
28
+ */ export { resolvePaletteVars, resolvePaletteVarsSx } from "@aglyn/aglyn/app-utils/palette-sx";
29
+
30
+ //# sourceMappingURL=scheme-sx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn-node-renderer/src/lib/utils/scheme-sx.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Scheme-scoped node sx (AGL-588) — implementation moved to\n * `@aglyn/aglyn` (`app-utils/scheme-sx`) for AGL-1306: the instance\n * override layer merges sx inside `composeReusableComponentNodes`, which\n * lives there and cannot import this renderer back. This path stays as\n * the renderer's export so its many consumers (the designer's responsive\n * and style-group utils, the canvas leaf) are untouched.\n */\nexport {\n SX_SCHEME_DARK_KEY,\n isResponsiveSxObject,\n mergeSchemeValue,\n resolveSchemeSx,\n resolveSchemeSx as default,\n type SxScheme,\n} from '@aglyn/aglyn/app-utils/scheme-sx'\n\n/**\n * Palette `var()` substitution (AGL-1331) rides along beside the scheme\n * pass: both resolve persisted sx against the ACTIVE theme, and the leaf\n * applies them together.\n */\nexport {\n resolvePaletteVars,\n resolvePaletteVarsSx,\n} from '@aglyn/aglyn/app-utils/palette-sx'\n"],"names":["SX_SCHEME_DARK_KEY","isResponsiveSxObject","mergeSchemeValue","resolveSchemeSx","default","resolvePaletteVars","resolvePaletteVarsSx"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GACD,SACEA,kBAAkB,EAClBC,oBAAoB,EACpBC,gBAAgB,EAChBC,eAAe,EACfA,mBAAmBC,OAAO,QAErB,mCAAkC;AAEzC;;;;CAIC,GACD,SACEC,kBAAkB,EAClBC,oBAAoB,QACf,oCAAmC"}