@aglyn/shared-ui-jsx 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 (261) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +63 -0
  4. package/src/index.d.ts +48 -0
  5. package/src/index.js +179 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/aglyn-text.d.ts +86 -0
  8. package/src/lib/components/aglyn-text.js +44 -0
  9. package/src/lib/components/aglyn-text.js.map +1 -0
  10. package/src/lib/components/app-link.d.ts +74 -0
  11. package/src/lib/components/app-link.js +139 -0
  12. package/src/lib/components/app-link.js.map +1 -0
  13. package/src/lib/components/aspect-ratio.d.ts +59 -0
  14. package/src/lib/components/aspect-ratio.js +153 -0
  15. package/src/lib/components/aspect-ratio.js.map +1 -0
  16. package/src/lib/components/background-image.component.d.ts +30 -0
  17. package/src/lib/components/background-image.component.js +42 -0
  18. package/src/lib/components/background-image.component.js.map +1 -0
  19. package/src/lib/components/card-columns.d.ts +86 -0
  20. package/src/lib/components/card-columns.js +148 -0
  21. package/src/lib/components/card-columns.js.map +1 -0
  22. package/src/lib/components/card-display.d.ts +36 -0
  23. package/src/lib/components/card-display.js +158 -0
  24. package/src/lib/components/card-display.js.map +1 -0
  25. package/src/lib/components/card-list-item.d.ts +35 -0
  26. package/src/lib/components/card-list-item.js +137 -0
  27. package/src/lib/components/card-list-item.js.map +1 -0
  28. package/src/lib/components/children-function-prop.d.ts +25 -0
  29. package/src/lib/components/children-function-prop.js +29 -0
  30. package/src/lib/components/children-function-prop.js.map +1 -0
  31. package/src/lib/components/confirmation-provider.component.d.ts +19 -0
  32. package/src/lib/components/confirmation-provider.component.js +83 -0
  33. package/src/lib/components/confirmation-provider.component.js.map +1 -0
  34. package/src/lib/components/container.d.ts +25 -0
  35. package/src/lib/components/container.js +62 -0
  36. package/src/lib/components/container.js.map +1 -0
  37. package/src/lib/components/data-table.component.d.ts +54 -0
  38. package/src/lib/components/data-table.component.js +211 -0
  39. package/src/lib/components/data-table.component.js.map +1 -0
  40. package/src/lib/components/dialog-confirm.d.ts +36 -0
  41. package/src/lib/components/dialog-confirm.js +74 -0
  42. package/src/lib/components/dialog-confirm.js.map +1 -0
  43. package/src/lib/components/ellipsis-pulse.component.d.ts +22 -0
  44. package/src/lib/components/ellipsis-pulse.component.js +51 -0
  45. package/src/lib/components/ellipsis-pulse.component.js.map +1 -0
  46. package/src/lib/components/emotion-cache-provider.d.ts +31 -0
  47. package/src/lib/components/emotion-cache-provider.js +40 -0
  48. package/src/lib/components/emotion-cache-provider.js.map +1 -0
  49. package/src/lib/components/empty-state.component.d.ts +63 -0
  50. package/src/lib/components/empty-state.component.js +214 -0
  51. package/src/lib/components/empty-state.component.js.map +1 -0
  52. package/src/lib/components/error-boundary.component.d.ts +28 -0
  53. package/src/lib/components/error-boundary.component.js +86 -0
  54. package/src/lib/components/error-boundary.component.js.map +1 -0
  55. package/src/lib/components/grid-buttons.d.ts +26 -0
  56. package/src/lib/components/grid-buttons.js +45 -0
  57. package/src/lib/components/grid-buttons.js.map +1 -0
  58. package/src/lib/components/grid-items.d.ts +103 -0
  59. package/src/lib/components/grid-items.js +336 -0
  60. package/src/lib/components/grid-items.js.map +1 -0
  61. package/src/lib/components/grid-list.d.ts +37 -0
  62. package/src/lib/components/grid-list.js +156 -0
  63. package/src/lib/components/grid-list.js.map +1 -0
  64. package/src/lib/components/help-tip.component.d.ts +30 -0
  65. package/src/lib/components/help-tip.component.js +139 -0
  66. package/src/lib/components/help-tip.component.js.map +1 -0
  67. package/src/lib/components/link-navigation-reporter.d.ts +24 -0
  68. package/src/lib/components/link-navigation-reporter.js +64 -0
  69. package/src/lib/components/link-navigation-reporter.js.map +1 -0
  70. package/src/lib/components/list-pagination.component.d.ts +57 -0
  71. package/src/lib/components/list-pagination.component.js +90 -0
  72. package/src/lib/components/list-pagination.component.js.map +1 -0
  73. package/src/lib/components/list-table.component.d.ts +155 -0
  74. package/src/lib/components/list-table.component.js +369 -0
  75. package/src/lib/components/list-table.component.js.map +1 -0
  76. package/src/lib/components/loading-layout-app.component.d.ts +35 -0
  77. package/src/lib/components/loading-layout-app.component.js +42 -0
  78. package/src/lib/components/loading-layout-app.component.js.map +1 -0
  79. package/src/lib/components/loading-modal-overlay.d.ts +30 -0
  80. package/src/lib/components/loading-modal-overlay.js +156 -0
  81. package/src/lib/components/loading-modal-overlay.js.map +1 -0
  82. package/src/lib/components/loading-modal.d.ts +19 -0
  83. package/src/lib/components/loading-modal.js +113 -0
  84. package/src/lib/components/loading-modal.js.map +1 -0
  85. package/src/lib/components/loading-text.component.d.ts +21 -0
  86. package/src/lib/components/loading-text.component.js +40 -0
  87. package/src/lib/components/loading-text.component.js.map +1 -0
  88. package/src/lib/components/mdi-icon/index.d.ts +2 -0
  89. package/src/lib/components/mdi-icon/index.js +4 -0
  90. package/src/lib/components/mdi-icon/index.js.map +1 -0
  91. package/src/lib/components/mdi-icon/md-icon-stack.d.ts +31 -0
  92. package/src/lib/components/mdi-icon/md-icon-stack.js +101 -0
  93. package/src/lib/components/mdi-icon/md-icon-stack.js.map +1 -0
  94. package/src/lib/components/mdi-icon/md-icon.d.ts +32 -0
  95. package/src/lib/components/mdi-icon/md-icon.js +147 -0
  96. package/src/lib/components/mdi-icon/md-icon.js.map +1 -0
  97. package/src/lib/components/mdi-icon/mdi-icon-from-id.d.ts +23 -0
  98. package/src/lib/components/mdi-icon/mdi-icon-from-id.js +35 -0
  99. package/src/lib/components/mdi-icon/mdi-icon-from-id.js.map +1 -0
  100. package/src/lib/components/mdi-icon/mdi-icon.d.ts +24 -0
  101. package/src/lib/components/mdi-icon/mdi-icon.js +46 -0
  102. package/src/lib/components/mdi-icon/mdi-icon.js.map +1 -0
  103. package/src/lib/components/measured-figures.component.d.ts +64 -0
  104. package/src/lib/components/measured-figures.component.js +161 -0
  105. package/src/lib/components/measured-figures.component.js.map +1 -0
  106. package/src/lib/components/menu.d.ts +45 -0
  107. package/src/lib/components/menu.js +229 -0
  108. package/src/lib/components/menu.js.map +1 -0
  109. package/src/lib/components/mui-shadow-dom.d.ts +38 -0
  110. package/src/lib/components/mui-shadow-dom.js +161 -0
  111. package/src/lib/components/mui-shadow-dom.js.map +1 -0
  112. package/src/lib/components/navigation-drawer.component.d.ts +31 -0
  113. package/src/lib/components/navigation-drawer.component.js +76 -0
  114. package/src/lib/components/navigation-drawer.component.js.map +1 -0
  115. package/src/lib/components/navigation-intent.d.ts +18 -0
  116. package/src/lib/components/navigation-intent.js +56 -0
  117. package/src/lib/components/navigation-intent.js.map +1 -0
  118. package/src/lib/components/navigation-view/index.d.ts +18 -0
  119. package/src/lib/components/navigation-view/index.js +19 -0
  120. package/src/lib/components/navigation-view/index.js.map +1 -0
  121. package/src/lib/components/navigation-view/navigation-view.d.ts +35 -0
  122. package/src/lib/components/navigation-view/navigation-view.js +175 -0
  123. package/src/lib/components/navigation-view/navigation-view.js.map +1 -0
  124. package/src/lib/components/next-link.d.ts +27 -0
  125. package/src/lib/components/next-link.js +88 -0
  126. package/src/lib/components/next-link.js.map +1 -0
  127. package/src/lib/components/popper-styled.component.d.ts +25 -0
  128. package/src/lib/components/popper-styled.component.js +129 -0
  129. package/src/lib/components/popper-styled.component.js.map +1 -0
  130. package/src/lib/components/quota-readout.component.d.ts +69 -0
  131. package/src/lib/components/quota-readout.component.js +52 -0
  132. package/src/lib/components/quota-readout.component.js.map +1 -0
  133. package/src/lib/components/resizeable-stack.d.ts +4 -0
  134. package/src/lib/components/resizeable-stack.js +23 -0
  135. package/src/lib/components/resizeable-stack.js.map +1 -0
  136. package/src/lib/components/row-actions-menu.component.d.ts +53 -0
  137. package/src/lib/components/row-actions-menu.component.js +132 -0
  138. package/src/lib/components/row-actions-menu.component.js.map +1 -0
  139. package/src/lib/components/ruler-guides.component.d.ts +35 -0
  140. package/src/lib/components/ruler-guides.component.js +166 -0
  141. package/src/lib/components/ruler-guides.component.js.map +1 -0
  142. package/src/lib/components/sandbox-frame.d.ts +42 -0
  143. package/src/lib/components/sandbox-frame.js +122 -0
  144. package/src/lib/components/sandbox-frame.js.map +1 -0
  145. package/src/lib/components/scroll-reaction.d.ts +59 -0
  146. package/src/lib/components/scroll-reaction.js +43 -0
  147. package/src/lib/components/scroll-reaction.js.map +1 -0
  148. package/src/lib/components/scroll-table.component.d.ts +124 -0
  149. package/src/lib/components/scroll-table.component.js +103 -0
  150. package/src/lib/components/scroll-table.component.js.map +1 -0
  151. package/src/lib/components/shadow-dom/index.d.ts +18 -0
  152. package/src/lib/components/shadow-dom/index.js +19 -0
  153. package/src/lib/components/shadow-dom/index.js.map +1 -0
  154. package/src/lib/components/shadow-dom/shadow-dom.d.ts +42 -0
  155. package/src/lib/components/shadow-dom/shadow-dom.js +123 -0
  156. package/src/lib/components/shadow-dom/shadow-dom.js.map +1 -0
  157. package/src/lib/components/splash-screen.d.ts +33 -0
  158. package/src/lib/components/splash-screen.js +105 -0
  159. package/src/lib/components/splash-screen.js.map +1 -0
  160. package/src/lib/components/sr-only.d.ts +20 -0
  161. package/src/lib/components/sr-only.js +25 -0
  162. package/src/lib/components/sr-only.js.map +1 -0
  163. package/src/lib/components/status-screen-plain.component.d.ts +27 -0
  164. package/src/lib/components/status-screen-plain.component.js +178 -0
  165. package/src/lib/components/status-screen-plain.component.js.map +1 -0
  166. package/src/lib/components/usage-meter.component.d.ts +30 -0
  167. package/src/lib/components/usage-meter.component.js +92 -0
  168. package/src/lib/components/usage-meter.component.js.map +1 -0
  169. package/src/lib/components/variable-text-field.component.d.ts +50 -0
  170. package/src/lib/components/variable-text-field.component.js +188 -0
  171. package/src/lib/components/variable-text-field.component.js.map +1 -0
  172. package/src/lib/components/zoomable-panning-component/index.d.ts +1 -0
  173. package/src/lib/components/zoomable-panning-component/index.js +3 -0
  174. package/src/lib/components/zoomable-panning-component/index.js.map +1 -0
  175. package/src/lib/components/zoomable-panning-component/util.d.ts +58 -0
  176. package/src/lib/components/zoomable-panning-component/util.js +114 -0
  177. package/src/lib/components/zoomable-panning-component/util.js.map +1 -0
  178. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.d.ts +132 -0
  179. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.js +728 -0
  180. package/src/lib/components/zoomable-panning-component/zoomable-panning-component.js.map +1 -0
  181. package/src/lib/const/aglyn-besigner-logo-full.d.ts +39 -0
  182. package/src/lib/const/aglyn-besigner-logo-full.js +146 -0
  183. package/src/lib/const/aglyn-besigner-logo-full.js.map +1 -0
  184. package/src/lib/const/aglyn-console-logo-full.d.ts +34 -0
  185. package/src/lib/const/aglyn-console-logo-full.js +142 -0
  186. package/src/lib/const/aglyn-console-logo-full.js.map +1 -0
  187. package/src/lib/const/aglyn-logo-class-keys.d.ts +30 -0
  188. package/src/lib/const/aglyn-logo-class-keys.js +32 -0
  189. package/src/lib/const/aglyn-logo-class-keys.js.map +1 -0
  190. package/src/lib/const/aglyn-logo-full.d.ts +29 -0
  191. package/src/lib/const/aglyn-logo-full.js +111 -0
  192. package/src/lib/const/aglyn-logo-full.js.map +1 -0
  193. package/src/lib/const/list-filter.d.ts +260 -0
  194. package/src/lib/const/list-filter.js +409 -0
  195. package/src/lib/const/list-filter.js.map +1 -0
  196. package/src/lib/const/prebuilt-components.d.ts +17 -0
  197. package/src/lib/const/prebuilt-components.js +22 -0
  198. package/src/lib/const/prebuilt-components.js.map +1 -0
  199. package/src/lib/const/svg-icons.d.ts +75 -0
  200. package/src/lib/const/svg-icons.js +313 -0
  201. package/src/lib/const/svg-icons.js.map +1 -0
  202. package/src/lib/const/table-pagination.d.ts +106 -0
  203. package/src/lib/const/table-pagination.js +106 -0
  204. package/src/lib/const/table-pagination.js.map +1 -0
  205. package/src/lib/contexts/confirmation.context.d.ts +996 -0
  206. package/src/lib/contexts/confirmation.context.js +49 -0
  207. package/src/lib/contexts/confirmation.context.js.map +1 -0
  208. package/src/lib/contexts/loading.context.d.ts +93 -0
  209. package/src/lib/contexts/loading.context.js +126 -0
  210. package/src/lib/contexts/loading.context.js.map +1 -0
  211. package/src/lib/hocs/create-hoc-with-context-consumer.d.ts +36 -0
  212. package/src/lib/hocs/create-hoc-with-context-consumer.js +44 -0
  213. package/src/lib/hocs/create-hoc-with-context-consumer.js.map +1 -0
  214. package/src/lib/hocs/with-hoc.d.ts +32 -0
  215. package/src/lib/hocs/with-hoc.js +37 -0
  216. package/src/lib/hocs/with-hoc.js.map +1 -0
  217. package/src/lib/hooks/mdi-icon/use-mdi-icon.d.ts +20 -0
  218. package/src/lib/hooks/mdi-icon/use-mdi-icon.js +48 -0
  219. package/src/lib/hooks/mdi-icon/use-mdi-icon.js.map +1 -0
  220. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.d.ts +26 -0
  221. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.js +73 -0
  222. package/src/lib/hooks/mdi-icon/use-mdi-icons-fuzzy.js.map +1 -0
  223. package/src/lib/hooks/mdi-icon/use-mdi-icons.d.ts +19 -0
  224. package/src/lib/hooks/mdi-icon/use-mdi-icons.js +49 -0
  225. package/src/lib/hooks/mdi-icon/use-mdi-icons.js.map +1 -0
  226. package/src/lib/hooks/router-events.d.ts +56 -0
  227. package/src/lib/hooks/router-events.js +88 -0
  228. package/src/lib/hooks/router-events.js.map +1 -0
  229. package/src/lib/hooks/use-async-effect.d.ts +24 -0
  230. package/src/lib/hooks/use-async-effect.js +44 -0
  231. package/src/lib/hooks/use-async-effect.js.map +1 -0
  232. package/src/lib/hooks/use-callback-param-ref.d.ts +19 -0
  233. package/src/lib/hooks/use-callback-param-ref.js +29 -0
  234. package/src/lib/hooks/use-callback-param-ref.js.map +1 -0
  235. package/src/lib/hooks/use-id.d.ts +21 -0
  236. package/src/lib/hooks/use-id.js +28 -0
  237. package/src/lib/hooks/use-id.js.map +1 -0
  238. package/src/lib/hooks/use-isomorphic-layout-effect.d.ts +19 -0
  239. package/src/lib/hooks/use-isomorphic-layout-effect.js +20 -0
  240. package/src/lib/hooks/use-isomorphic-layout-effect.js.map +1 -0
  241. package/src/lib/hooks/use-merge-refs.d.ts +38 -0
  242. package/src/lib/hooks/use-merge-refs.js +52 -0
  243. package/src/lib/hooks/use-merge-refs.js.map +1 -0
  244. package/src/lib/hooks/use-subscribable.d.ts +29 -0
  245. package/src/lib/hooks/use-subscribable.js +50 -0
  246. package/src/lib/hooks/use-subscribable.js.map +1 -0
  247. package/src/lib/types.d.ts +18 -0
  248. package/src/lib/types.js +18 -0
  249. package/src/lib/types.js.map +1 -0
  250. package/src/lib/utils/make-link-elements.d.ts +24 -0
  251. package/src/lib/utils/make-link-elements.js +32 -0
  252. package/src/lib/utils/make-link-elements.js.map +1 -0
  253. package/src/lib/utils/make-meta-elements.d.ts +24 -0
  254. package/src/lib/utils/make-meta-elements.js +32 -0
  255. package/src/lib/utils/make-meta-elements.js.map +1 -0
  256. package/src/lib/utils/scroll-overflow.d.ts +120 -0
  257. package/src/lib/utils/scroll-overflow.js +115 -0
  258. package/src/lib/utils/scroll-overflow.js.map +1 -0
  259. package/src/lib/utils/vendor.d.ts +17 -0
  260. package/src/lib/utils/vendor.js +18 -0
  261. package/src/lib/utils/vendor.js.map +1 -0
@@ -0,0 +1,161 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2023 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { createLayeredEmotionCache } from "@aglyn/shared-ui-theme";
20
+ import { Portal } from "@mui/material";
21
+ import { kebabCase } from "change-case";
22
+ import { createContext, forwardRef, useContext, useEffect, useRef, useState } from "react";
23
+ import { useMergeRefs } from "../hooks/use-merge-refs.js";
24
+ import EmotionCacheProvider from "./emotion-cache-provider.js";
25
+ const tags = new Map();
26
+ const cacheMap = new WeakMap();
27
+ const ShadowDomContext = /*#__PURE__*/ createContext(null);
28
+ export function useMuiShadowDomContext() {
29
+ return useContext(ShadowDomContext);
30
+ }
31
+ function handleError({ error, styleSheets, container }) {
32
+ switch(error.name){
33
+ case 'NotSupportedError':
34
+ styleSheets.length > 0 && (container.adoptedStyleSheets = styleSheets);
35
+ break;
36
+ default:
37
+ throw error;
38
+ }
39
+ }
40
+ export function withMuiShadowRoot(Tag, options) {
41
+ const { render } = options;
42
+ const ShadowRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
43
+ const { mode = 'open', delegatesFocus, styleSheets = [], ssr, children } = props, rest = _object_without_properties_loose(props, [
44
+ "mode",
45
+ "delegatesFocus",
46
+ "styleSheets",
47
+ "ssr",
48
+ "children"
49
+ ]);
50
+ const local = useRef(null);
51
+ const [container, setContainer] = useState(null);
52
+ const key = `node_${mode}${delegatesFocus}`;
53
+ useEffect(()=>{
54
+ const node = local.current;
55
+ if (!node) return void 0;
56
+ try {
57
+ let shadowRoot = null;
58
+ if (ssr) shadowRoot = node.shadowRoot;
59
+ else {
60
+ shadowRoot = local.current.attachShadow({
61
+ mode,
62
+ delegatesFocus
63
+ });
64
+ shadowRoot.adoptedStyleSheets = styleSheets;
65
+ }
66
+ setContainer(shadowRoot);
67
+ } catch (error) {
68
+ handleError({
69
+ error,
70
+ styleSheets,
71
+ container
72
+ });
73
+ }
74
+ }, [
75
+ styleSheets,
76
+ ssr,
77
+ mode,
78
+ delegatesFocus,
79
+ container
80
+ ]);
81
+ return /*#__PURE__*/ _jsx(Tag, _extends({
82
+ ref: useMergeRefs(ref, local)
83
+ }, rest, {
84
+ children: (container || ssr) && /*#__PURE__*/ _jsx(ShadowDomContext.Provider, {
85
+ value: container,
86
+ children: ssr ? /*#__PURE__*/ _jsx("template", _extends({}, {
87
+ shadowroot: 'open'
88
+ }, {
89
+ children: render({
90
+ container,
91
+ ssr,
92
+ children
93
+ })
94
+ })) : /*#__PURE__*/ _jsx(Portal, {
95
+ container: ()=>container,
96
+ children: render({
97
+ container,
98
+ ssr,
99
+ children
100
+ })
101
+ })
102
+ })
103
+ }), key);
104
+ });
105
+ ShadowRoot.displayName = 'ShadowRoot';
106
+ return ShadowRoot;
107
+ }
108
+ export function createMuiShadowDomProxy(target = {}, key = 'core', render = ({ children })=>children) {
109
+ return new Proxy(target, {
110
+ get: function get(_, name) {
111
+ const tag = kebabCase(String(name));
112
+ const id = `${key}-${tag}`;
113
+ if (!tags.has(id)) {
114
+ tags.set(id, withMuiShadowRoot(tag, {
115
+ render
116
+ }));
117
+ }
118
+ return tags.get(id);
119
+ }
120
+ });
121
+ }
122
+ export const MuiShadowDomRenderer = (props)=>{
123
+ // AGL-1316: the `ssr` branch (renderToString + emotion style extraction) was
124
+ // removed — it was dormant (no consumer passes `ssr`) and its static
125
+ // `react-dom/server` import shipped the full server renderer in the shared
126
+ // client chunk. Reintroduce via `await import('react-dom/server')` if ever needed.
127
+ const { container, children } = props;
128
+ const cache = !cacheMap.has(container) ? (()=>{
129
+ if (cacheMap.has(container)) return cacheMap.get(container);
130
+ // AGL-2486: LAYERED, exactly as the published document is. The
131
+ // canvas renders site content through this cache; the tenant renders
132
+ // the same content through `AppRouterCacheProvider`, whose
133
+ // `enableCssLayer` wraps every rule in `@layer mui`. When this cache
134
+ // was plain (measured: 183 unlayered `.msd-*` rules in the canvas
135
+ // shadow root, against the tenant's 72 layer blocks and zero
136
+ // unlayered `.mui-*`), any CSS that does NOT pass through emotion — a
137
+ // Custom HTML `css` block, a realm plugin's stylesheet — beat every
138
+ // component and `sx` rule on the published page regardless of
139
+ // specificity, while merely competing on specificity here. That is
140
+ // "what you see is not what you publish". See
141
+ // `createLayeredEmotionCache` for the measurements and for why the
142
+ // editor is the side that had to move.
143
+ const cache = createLayeredEmotionCache({
144
+ container,
145
+ key: 'msd',
146
+ prepend: true
147
+ });
148
+ cacheMap.set(container, cache);
149
+ return cache;
150
+ })() : cacheMap.get(container);
151
+ return /*#__PURE__*/ _jsx(EmotionCacheProvider, {
152
+ emotionCache: cache,
153
+ children: /*#__PURE__*/ _jsx(_Fragment, {
154
+ children: children
155
+ })
156
+ });
157
+ };
158
+ export const MuiShadowDom = createMuiShadowDomProxy({}, 'mui', MuiShadowDomRenderer);
159
+ export default MuiShadowDom;
160
+
161
+ //# sourceMappingURL=mui-shadow-dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/mui-shadow-dom.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 { createLayeredEmotionCache } from '@aglyn/shared-ui-theme'\nimport { Portal } from '@mui/material'\nimport { kebabCase } from 'change-case'\nimport {\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react'\nimport { useMergeRefs } from '../hooks/use-merge-refs'\nimport EmotionCacheProvider from './emotion-cache-provider'\n\nexport type MuiShadowRendererProps = {\n container?: Node\n ssr?: boolean\n children?: JSX.Children\n}\nexport type MuiShadowRenderer = (props: MuiShadowRendererProps) => JSX.Node\nexport type CreateShadowRootOptions = {\n render: MuiShadowRenderer\n}\n\nexport interface MuiShadowRootProps {\n mode?: 'open' | 'closed'\n delegatesFocus?: boolean\n styleSheets?: globalThis.CSSStyleSheet[]\n ssr?: boolean\n children?: JSX.Children\n}\n\nconst tags = new Map()\nconst cacheMap = new WeakMap()\nconst ShadowDomContext = createContext<Node>(null)\n\nexport function useMuiShadowDomContext() {\n return useContext(ShadowDomContext)\n}\n\nfunction handleError({ error, styleSheets, container }: { error: any; styleSheets: CSSStyleSheet[]; container: any }) {\n switch (error.name) {\n case 'NotSupportedError':\n styleSheets.length > 0 && (container.adoptedStyleSheets = styleSheets)\n break\n default:\n throw error\n }\n}\n\nexport function withMuiShadowRoot(\n Tag: any | keyof JSX.IntrinsicElements,\n options: CreateShadowRootOptions,\n) {\n const { render } = options\n\n const ShadowRoot = forwardRef<Element, MuiShadowRootProps>((props, ref) => {\n const {\n mode = 'open',\n delegatesFocus,\n styleSheets = [],\n ssr,\n children,\n ...rest\n } = props\n const local = useRef<Element | null>(null)\n const [container, setContainer] = useState<ShadowRoot | null>(null)\n const key = `node_${mode}${delegatesFocus}`\n\n useEffect(() => {\n const node = local.current\n if (!node) return void 0\n try {\n let shadowRoot: ShadowRoot = null\n\n if (ssr) shadowRoot = node.shadowRoot\n else {\n shadowRoot = local.current.attachShadow({ mode, delegatesFocus })\n shadowRoot.adoptedStyleSheets = styleSheets\n }\n\n setContainer(shadowRoot)\n } catch (error) {\n handleError({ error, styleSheets, container })\n }\n }, [styleSheets, ssr, mode, delegatesFocus, container])\n\n return (\n <Tag key={key} ref={useMergeRefs(ref, local)} {...rest}>\n {(container || ssr) && (\n <ShadowDomContext.Provider value={container}>\n {ssr ? (\n <template {...({ shadowroot: 'open' } as any)}>\n {render({\n container,\n ssr,\n children,\n })}\n </template>\n ) : (\n <Portal container={() => container as unknown as Element}>\n {render({\n container,\n ssr,\n children,\n })}\n </Portal>\n )}\n </ShadowDomContext.Provider>\n )}\n </Tag>\n )\n })\n ShadowRoot.displayName = 'ShadowRoot'\n\n return ShadowRoot\n}\n\nexport function createMuiShadowDomProxy(\n target: Partial<JSX.IntrinsicElementMap> = {},\n key = 'core',\n render: MuiShadowRenderer = ({ children }) => children,\n) {\n return new Proxy(target, {\n get: function get(_, name) {\n const tag = kebabCase(String(name))\n const id = `${key}-${tag}`\n\n if (!tags.has(id)) {\n tags.set(id, withMuiShadowRoot(tag, { render }))\n }\n return tags.get(id)\n },\n })\n}\n\nexport const MuiShadowDomRenderer = (props: MuiShadowRendererProps) => {\n // AGL-1316: the `ssr` branch (renderToString + emotion style extraction) was\n // removed — it was dormant (no consumer passes `ssr`) and its static\n // `react-dom/server` import shipped the full server renderer in the shared\n // client chunk. Reintroduce via `await import('react-dom/server')` if ever needed.\n const { container, children } = props\n const cache = !cacheMap.has(container)\n ? (() => {\n if (cacheMap.has(container)) return cacheMap.get(container)\n // AGL-2486: LAYERED, exactly as the published document is. The\n // canvas renders site content through this cache; the tenant renders\n // the same content through `AppRouterCacheProvider`, whose\n // `enableCssLayer` wraps every rule in `@layer mui`. When this cache\n // was plain (measured: 183 unlayered `.msd-*` rules in the canvas\n // shadow root, against the tenant's 72 layer blocks and zero\n // unlayered `.mui-*`), any CSS that does NOT pass through emotion — a\n // Custom HTML `css` block, a realm plugin's stylesheet — beat every\n // component and `sx` rule on the published page regardless of\n // specificity, while merely competing on specificity here. That is\n // \"what you see is not what you publish\". See\n // `createLayeredEmotionCache` for the measurements and for why the\n // editor is the side that had to move.\n const cache = createLayeredEmotionCache({\n container,\n key: 'msd',\n prepend: true,\n })\n cacheMap.set(container, cache)\n return cache\n })()\n : cacheMap.get(container)\n\n return (\n <EmotionCacheProvider emotionCache={cache}>\n <>{children}</>\n </EmotionCacheProvider>\n )\n}\n\nexport const MuiShadowDom = createMuiShadowDomProxy(\n {},\n 'mui',\n MuiShadowDomRenderer,\n)\n\nexport default MuiShadowDom\n"],"names":["createLayeredEmotionCache","Portal","kebabCase","createContext","forwardRef","useContext","useEffect","useRef","useState","useMergeRefs","EmotionCacheProvider","tags","Map","cacheMap","WeakMap","ShadowDomContext","useMuiShadowDomContext","handleError","error","styleSheets","container","name","length","adoptedStyleSheets","withMuiShadowRoot","Tag","options","render","ShadowRoot","props","ref","mode","delegatesFocus","ssr","children","rest","local","setContainer","key","node","current","shadowRoot","attachShadow","Provider","value","template","shadowroot","displayName","createMuiShadowDomProxy","target","Proxy","get","_","tag","String","id","has","set","MuiShadowDomRenderer","cache","prepend","emotionCache","MuiShadowDom"],"mappings":"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"}
@@ -0,0 +1,31 @@
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 AppBarProps, type BoxProps, type DrawerProps, type StackProps, type ToolbarProps } from '@mui/material';
18
+ import { type Ref } from 'react';
19
+ export interface NavigationDrawerProps extends Partial<DrawerProps> {
20
+ appBarLeft?: JSX.Node;
21
+ appBarRight?: JSX.Node;
22
+ contentRef?: Ref<any>;
23
+ AppBarProps?: Partial<AppBarProps>;
24
+ ToolbarProps?: Partial<ToolbarProps>;
25
+ ContentProps?: BoxProps;
26
+ AppBarLeftProps?: StackProps;
27
+ AppBarRightProps?: StackProps;
28
+ childrenAfterToolbar?: JSX.Node;
29
+ }
30
+ export declare const NavigationDrawerComponent: import("react").ForwardRefExoticComponent<Omit<NavigationDrawerProps, "ref"> & import("react").RefAttributes<any>>;
31
+ export default NavigationDrawerComponent;
@@ -0,0 +1,76 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2023 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import NavigationView from "./navigation-view/navigation-view.js";
20
+ import { generateComponentClassKeys, mergeSxProps } from "@aglyn/shared-ui-theme";
21
+ import { Drawer } from "@mui/material";
22
+ import clsx from "clsx";
23
+ import { forwardRef } from "react";
24
+ const classKeys = generateComponentClassKeys('AglynNavigationDrawer', [
25
+ 'root',
26
+ 'appBar',
27
+ 'toolbar',
28
+ 'appBarLeft',
29
+ 'appBarRight',
30
+ 'content'
31
+ ]);
32
+ export const NavigationDrawerComponent = /*#__PURE__*/ forwardRef(function RefRenderFn(props, forwardRef) {
33
+ const { sx, children, className, contentRef, appBarLeft, appBarRight, AppBarProps, ToolbarProps, ContentProps, AppBarLeftProps, AppBarRightProps, childrenAfterToolbar } = props, rest = _object_without_properties_loose(props, [
34
+ "sx",
35
+ "children",
36
+ "className",
37
+ "contentRef",
38
+ "appBarLeft",
39
+ "appBarRight",
40
+ "AppBarProps",
41
+ "ToolbarProps",
42
+ "ContentProps",
43
+ "AppBarLeftProps",
44
+ "AppBarRightProps",
45
+ "childrenAfterToolbar"
46
+ ]);
47
+ return /*#__PURE__*/ _jsx(Drawer, _extends({
48
+ ref: forwardRef,
49
+ className: clsx(classKeys.root, className),
50
+ sx: mergeSxProps(_extends({}, props.variant !== 'temporary' && {
51
+ width: (theme)=>`${theme.breakpoints.values.sm}px`,
52
+ flexShrink: 0,
53
+ maxWidth: '100%'
54
+ }, {
55
+ '& .MuiDrawer-paper': {
56
+ width: (theme)=>`${theme.breakpoints.values.sm}px`,
57
+ maxWidth: '100%'
58
+ }
59
+ }), sx)
60
+ }, rest, {
61
+ children: /*#__PURE__*/ _jsx(NavigationView, {
62
+ AppBarProps: AppBarProps,
63
+ appBarLeft: appBarLeft,
64
+ appBarRight: appBarRight,
65
+ AppBarLeftProps: AppBarLeftProps,
66
+ AppBarRightProps: AppBarRightProps,
67
+ childrenAfterToolbar: childrenAfterToolbar,
68
+ children: children
69
+ })
70
+ }));
71
+ });
72
+ NavigationDrawerComponent.displayName = 'NavigationDrawerComponent';
73
+ NavigationDrawerComponent.aglyn = true;
74
+ export default NavigationDrawerComponent;
75
+
76
+ //# sourceMappingURL=navigation-drawer.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/navigation-drawer.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\nimport NavigationView from './navigation-view/navigation-view'\nimport {\n generateComponentClassKeys,\n mergeSxProps,\n} from '@aglyn/shared-ui-theme'\n\nimport {\n type AppBarProps,\n type BoxProps,\n Drawer,\n type DrawerProps,\n type StackProps,\n type ToolbarProps,\n} from '@mui/material'\nimport clsx from 'clsx'\nimport { forwardRef, type Ref } from 'react'\n\nconst classKeys = generateComponentClassKeys('AglynNavigationDrawer', [\n 'root',\n 'appBar',\n 'toolbar',\n 'appBarLeft',\n 'appBarRight',\n 'content',\n])\n\n/* eslint-disable-next-line */\nexport interface NavigationDrawerProps extends Partial<DrawerProps> {\n appBarLeft?: JSX.Node\n appBarRight?: JSX.Node\n contentRef?: Ref<any>\n AppBarProps?: Partial<AppBarProps>\n ToolbarProps?: Partial<ToolbarProps>\n ContentProps?: BoxProps\n AppBarLeftProps?: StackProps\n AppBarRightProps?: StackProps\n childrenAfterToolbar?: JSX.Node\n}\n\nexport const NavigationDrawerComponent = forwardRef<any, NavigationDrawerProps>(\n function RefRenderFn(props, forwardRef) {\n const {\n sx,\n children,\n className,\n contentRef,\n appBarLeft,\n appBarRight,\n AppBarProps,\n ToolbarProps,\n ContentProps,\n AppBarLeftProps,\n AppBarRightProps,\n childrenAfterToolbar,\n ...rest\n } = props\n\n return (\n <Drawer\n ref={forwardRef}\n className={clsx(classKeys.root, className)}\n sx={mergeSxProps(\n {\n // Root width reserves layout space for DOCKED drawers only.\n // For `temporary`, the root IS the fixed modal container, and\n // sizing it breaks MUI's container-relative Slide math (the\n // close animation ran toward the wrong edge): the paper alone\n // carries the width there.\n ...(props.variant !== 'temporary' && {\n width: (theme) => `${theme.breakpoints.values.sm}px`,\n flexShrink: 0,\n maxWidth: '100%',\n }),\n '& .MuiDrawer-paper': {\n width: (theme) => `${theme.breakpoints.values.sm}px`,\n maxWidth: '100%',\n },\n },\n sx,\n )}\n {...rest}\n >\n <NavigationView\n AppBarProps={AppBarProps}\n appBarLeft={appBarLeft}\n appBarRight={appBarRight}\n AppBarLeftProps={AppBarLeftProps}\n AppBarRightProps={AppBarRightProps}\n childrenAfterToolbar={childrenAfterToolbar}\n >\n {children}\n </NavigationView>\n </Drawer>\n )\n },\n)\n\nNavigationDrawerComponent.displayName = 'NavigationDrawerComponent'\nNavigationDrawerComponent.aglyn = true\n\nexport default NavigationDrawerComponent\n"],"names":["NavigationView","generateComponentClassKeys","mergeSxProps","Drawer","clsx","forwardRef","classKeys","NavigationDrawerComponent","RefRenderFn","props","sx","children","className","contentRef","appBarLeft","appBarRight","AppBarProps","ToolbarProps","ContentProps","AppBarLeftProps","AppBarRightProps","childrenAfterToolbar","rest","ref","root","variant","width","theme","breakpoints","values","sm","flexShrink","maxWidth","displayName","aglyn"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,OAAOA,oBAAoB,uCAAmC;AAC9D,SACEC,0BAA0B,EAC1BC,YAAY,QACP,yBAAwB;AAE/B,SAGEC,MAAM,QAID,gBAAe;AACtB,OAAOC,UAAU,OAAM;AACvB,SAASC,UAAU,QAAkB,QAAO;AAE5C,MAAMC,YAAYL,2BAA2B,yBAAyB;IACpE;IACA;IACA;IACA;IACA;IACA;CACD;AAeD,OAAO,MAAMM,0CAA4BF,WACvC,SAASG,YAAYC,KAAK,EAAEJ,UAAU;IACpC,MAAM,EACJK,EAAE,EACFC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,eAAe,EACfC,gBAAgB,EAChBC,oBAAoB,EAErB,GAAGZ,OADCa,wCACDb;;;;;;;;;;;;;;IAEJ,qBACE,KAACN;QACCoB,KAAKlB;QACLO,WAAWR,KAAKE,UAAUkB,IAAI,EAAEZ;QAChCF,IAAIR,aACF,aAMMO,MAAMgB,OAAO,KAAK,eAAe;YACnCC,OAAO,CAACC,QAAU,GAAGA,MAAMC,WAAW,CAACC,MAAM,CAACC,EAAE,CAAC,EAAE,CAAC;YACpDC,YAAY;YACZC,UAAU;QACZ;YACA,sBAAsB;gBACpBN,OAAO,CAACC,QAAU,GAAGA,MAAMC,WAAW,CAACC,MAAM,CAACC,EAAE,CAAC,EAAE,CAAC;gBACpDE,UAAU;YACZ;YAEFtB;OAEEY;kBAEJ,cAAA,KAACtB;YACCgB,aAAaA;YACbF,YAAYA;YACZC,aAAaA;YACbI,iBAAiBA;YACjBC,kBAAkBA;YAClBC,sBAAsBA;sBAErBV;;;AAIT,GACD;AAEDJ,0BAA0B0B,WAAW,GAAG;AACxC1B,0BAA0B2B,KAAK,GAAG;AAElC,eAAe3B,0BAAyB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Runs `react` the first time the visitor reaches for a link, and never on a
3
+ * visit that reaches for none (AGL-2710).
4
+ *
5
+ * Work a navigation will need — a chunk to fetch, a plugin to register — has
6
+ * to start before the click or it lands in front of the very thing it was
7
+ * meant to cover. Starting it on a timer after first paint achieves that, and
8
+ * charges every page view for it: on a page billed per view, bytes fetched at
9
+ * idle cost exactly what bytes fetched eagerly cost, plus the round trip.
10
+ *
11
+ * Pointing at, touching or tabbing to a link is the earliest honest evidence
12
+ * that a navigation may happen, and it precedes the click by long enough to
13
+ * cover the work. One delegated listener rather than a handler per link, so
14
+ * anchors rendered by a plugin or a hand-built menu count too; the capture
15
+ * phase, so a link that stops propagation in its own handlers cannot suppress
16
+ * it. Returns the detach function a caller's effect should return.
17
+ */
18
+ export declare function onFirstNavigationIntent(react: () => void): () => void;
@@ -0,0 +1,56 @@
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
+ */ 'use client';
17
+ /** Events that precede a click on a link, in pointer, touch and keyboard order. */ const INTENT_EVENTS = [
18
+ 'pointerover',
19
+ 'touchstart',
20
+ 'focusin'
21
+ ];
22
+ /**
23
+ * Runs `react` the first time the visitor reaches for a link, and never on a
24
+ * visit that reaches for none (AGL-2710).
25
+ *
26
+ * Work a navigation will need — a chunk to fetch, a plugin to register — has
27
+ * to start before the click or it lands in front of the very thing it was
28
+ * meant to cover. Starting it on a timer after first paint achieves that, and
29
+ * charges every page view for it: on a page billed per view, bytes fetched at
30
+ * idle cost exactly what bytes fetched eagerly cost, plus the round trip.
31
+ *
32
+ * Pointing at, touching or tabbing to a link is the earliest honest evidence
33
+ * that a navigation may happen, and it precedes the click by long enough to
34
+ * cover the work. One delegated listener rather than a handler per link, so
35
+ * anchors rendered by a plugin or a hand-built menu count too; the capture
36
+ * phase, so a link that stops propagation in its own handlers cannot suppress
37
+ * it. Returns the detach function a caller's effect should return.
38
+ */ export function onFirstNavigationIntent(react) {
39
+ const target = globalThis.document;
40
+ if (!target) return ()=>undefined;
41
+ const onIntent = (event)=>{
42
+ const node = event.target;
43
+ // `closest` reaches the anchor from whatever inside it was pointed at —
44
+ // a label, an icon, a nested span.
45
+ if (!(node instanceof Element) || !node.closest('a[href]')) return;
46
+ detach();
47
+ react();
48
+ };
49
+ const detach = ()=>{
50
+ for (const name of INTENT_EVENTS)target.removeEventListener(name, onIntent, true);
51
+ };
52
+ for (const name of INTENT_EVENTS)target.addEventListener(name, onIntent, true);
53
+ return detach;
54
+ }
55
+
56
+ //# sourceMappingURL=navigation-intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/navigation-intent.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'use client'\n\n/** Events that precede a click on a link, in pointer, touch and keyboard order. */\nconst INTENT_EVENTS = ['pointerover', 'touchstart', 'focusin'] as const\n\n/**\n * Runs `react` the first time the visitor reaches for a link, and never on a\n * visit that reaches for none (AGL-2710).\n *\n * Work a navigation will need — a chunk to fetch, a plugin to register — has\n * to start before the click or it lands in front of the very thing it was\n * meant to cover. Starting it on a timer after first paint achieves that, and\n * charges every page view for it: on a page billed per view, bytes fetched at\n * idle cost exactly what bytes fetched eagerly cost, plus the round trip.\n *\n * Pointing at, touching or tabbing to a link is the earliest honest evidence\n * that a navigation may happen, and it precedes the click by long enough to\n * cover the work. One delegated listener rather than a handler per link, so\n * anchors rendered by a plugin or a hand-built menu count too; the capture\n * phase, so a link that stops propagation in its own handlers cannot suppress\n * it. Returns the detach function a caller's effect should return.\n */\nexport function onFirstNavigationIntent(react: () => void): () => void {\n const target = globalThis.document\n if (!target) return () => undefined\n const onIntent = (event: Event) => {\n const node = event.target\n // `closest` reaches the anchor from whatever inside it was pointed at —\n // a label, an icon, a nested span.\n if (!(node instanceof Element) || !node.closest('a[href]')) return\n detach()\n react()\n }\n const detach = () => {\n for (const name of INTENT_EVENTS)\n target.removeEventListener(name, onIntent, true)\n }\n for (const name of INTENT_EVENTS)\n target.addEventListener(name, onIntent, true)\n return detach\n}\n"],"names":["INTENT_EVENTS","onFirstNavigationIntent","react","target","globalThis","document","undefined","onIntent","event","node","Element","closest","detach","name","removeEventListener","addEventListener"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,iFAAiF,GACjF,MAAMA,gBAAgB;IAAC;IAAe;IAAc;CAAU;AAE9D;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,wBAAwBC,KAAiB;IACvD,MAAMC,SAASC,WAAWC,QAAQ;IAClC,IAAI,CAACF,QAAQ,OAAO,IAAMG;IAC1B,MAAMC,WAAW,CAACC;QAChB,MAAMC,OAAOD,MAAML,MAAM;QACzB,wEAAwE;QACxE,mCAAmC;QACnC,IAAI,CAAEM,CAAAA,gBAAgBC,OAAM,KAAM,CAACD,KAAKE,OAAO,CAAC,YAAY;QAC5DC;QACAV;IACF;IACA,MAAMU,SAAS;QACb,KAAK,MAAMC,QAAQb,cACjBG,OAAOW,mBAAmB,CAACD,MAAMN,UAAU;IAC/C;IACA,KAAK,MAAMM,QAAQb,cACjBG,OAAOY,gBAAgB,CAACF,MAAMN,UAAU;IAC1C,OAAOK;AACT"}
@@ -0,0 +1,18 @@
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
+ export * from './navigation-view';
18
+ export { default } from './navigation-view';
@@ -0,0 +1,19 @@
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
+ */ export * from "./navigation-view.js";
17
+ export { default } from "./navigation-view.js";
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../libs/shared/ui/jsx/src/lib/components/navigation-view/index.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\nexport * from './navigation-view'\nexport { default } from './navigation-view'\n"],"names":["default"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,uBAAmB;AACjC,SAASA,OAAO,QAAQ,uBAAmB"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type AppBarProps, type StackProps } from '@mui/material';
18
+ export interface NavigationAppBarProps extends AppBarProps {
19
+ scrollView?: Node | Window;
20
+ disableHideOnScroll?: boolean;
21
+ disableElevateOnScroll?: boolean;
22
+ }
23
+ export declare const NavigationAppBar: import("react").ForwardRefExoticComponent<Omit<NavigationAppBarProps, "ref"> & import("react").RefAttributes<any>>;
24
+ export interface NavigationViewProps extends StackProps {
25
+ appBarLeft?: JSX.Children;
26
+ appBarRight?: JSX.Children;
27
+ childrenAfterToolbar?: JSX.Children;
28
+ bottomAppBar?: JSX.Children;
29
+ AppBarProps?: Partial<NavigationAppBarProps>;
30
+ AppBarLeftProps?: Partial<StackProps>;
31
+ AppBarRightProps?: Partial<StackProps>;
32
+ ContentProps?: Partial<StackProps>;
33
+ }
34
+ export declare const NavigationView: import("react").ForwardRefExoticComponent<Omit<NavigationViewProps, "ref"> & import("react").RefAttributes<any>>;
35
+ export default NavigationView;
@@ -0,0 +1,175 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ /**
5
+ * @license
6
+ * Copyright 2026 Aglyn LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */ import { generateComponentClassKeys } from "@aglyn/shared-ui-theme";
20
+ import { mergeSxProps } from "@aglyn/shared-ui-theme";
21
+ import { AppBar, Stack, styled, Toolbar } from "@mui/material";
22
+ import { motion } from "framer-motion";
23
+ import { forwardRef, useState } from "react";
24
+ import ScrollReaction from "../scroll-reaction.js";
25
+ const classKeys = generateComponentClassKeys('AglynNavigationDrawer', [
26
+ 'root',
27
+ 'appBar',
28
+ 'toolbar',
29
+ 'appBarLeft',
30
+ 'appBarRight',
31
+ 'content',
32
+ 'bottomAppBar'
33
+ ]);
34
+ const StyledAppBar = styled(AppBar)(({ theme })=>{
35
+ const tv = theme.vars || theme;
36
+ return {
37
+ borderBottomWidth: 1,
38
+ borderBottomStyle: 'solid',
39
+ borderBottomColor: tv.palette.divider,
40
+ zIndex: theme.zIndex.appBar,
41
+ transition: theme.transitions.create([
42
+ 'background-image',
43
+ 'box-shadow'
44
+ ], {
45
+ easing: theme.transitions.easing.sharp,
46
+ duration: theme.transitions.duration.standard
47
+ })
48
+ };
49
+ });
50
+ export const NavigationAppBar = /*#__PURE__*/ forwardRef((props, forwardRef)=>{
51
+ const { disableHideOnScroll, disableElevateOnScroll, scrollView, children } = props, rest = _object_without_properties_loose(props, [
52
+ "disableHideOnScroll",
53
+ "disableElevateOnScroll",
54
+ "scrollView",
55
+ "children"
56
+ ]);
57
+ return /*#__PURE__*/ _jsx(ScrollReaction, {
58
+ threshold: 50,
59
+ target: scrollView,
60
+ children: ({ activeWithoutHysteresis, activeWithHysteresis })=>/*#__PURE__*/ _jsx(StyledAppBar, _extends({
61
+ ref: forwardRef,
62
+ color: "default",
63
+ position: "relative",
64
+ variant: "elevation",
65
+ elevation: activeWithoutHysteresis && !disableElevateOnScroll ? 4 : 0,
66
+ enableColorOnDark: true,
67
+ component: disableHideOnScroll ? 'header' : motion.header,
68
+ animate: disableHideOnScroll ? undefined : {
69
+ height: !activeWithHysteresis ? null : 0,
70
+ overflow: 'hidden'
71
+ }
72
+ }, rest, {
73
+ children: children
74
+ }))
75
+ });
76
+ });
77
+ export const NavigationView = /*#__PURE__*/ forwardRef((props, forwardRef)=>{
78
+ const { sx, children, appBarLeft, appBarRight, childrenAfterToolbar, bottomAppBar, AppBarProps, AppBarLeftProps, AppBarRightProps, ContentProps } = props, rest = _object_without_properties_loose(props, [
79
+ "sx",
80
+ "children",
81
+ "appBarLeft",
82
+ "appBarRight",
83
+ "childrenAfterToolbar",
84
+ "bottomAppBar",
85
+ "AppBarProps",
86
+ "AppBarLeftProps",
87
+ "AppBarRightProps",
88
+ "ContentProps"
89
+ ]);
90
+ const [scrollView, setScrollView] = useState(null);
91
+ return /*#__PURE__*/ _jsxs(Stack, _extends({
92
+ ref: forwardRef,
93
+ direction: "column",
94
+ spacing: 0
95
+ }, rest, {
96
+ sx: mergeSxProps({
97
+ alignItems: 'stretch',
98
+ justifyContent: 'flex-start',
99
+ flexGrow: 1,
100
+ height: 1,
101
+ width: 1,
102
+ overflow: 'hidden'
103
+ }, sx),
104
+ children: [
105
+ /*#__PURE__*/ _jsxs(NavigationAppBar, _extends({
106
+ scrollView: scrollView,
107
+ className: classKeys.appBar
108
+ }, AppBarProps, {
109
+ children: [
110
+ /*#__PURE__*/ _jsx(Toolbar, {
111
+ className: classKeys.toolbar,
112
+ children: /*#__PURE__*/ _jsxs(Stack, {
113
+ direction: "row",
114
+ spacing: 2,
115
+ sx: {
116
+ alignItems: 'center',
117
+ justifyContent: 'space-between',
118
+ width: 1
119
+ },
120
+ children: [
121
+ /*#__PURE__*/ _jsx(Stack, _extends({
122
+ direction: "row",
123
+ className: classKeys.appBarLeft
124
+ }, AppBarLeftProps, {
125
+ sx: mergeSxProps({
126
+ alignItems: 'center',
127
+ justifyContent: 'flex-start'
128
+ }, AppBarLeftProps == null ? void 0 : AppBarLeftProps.sx),
129
+ children: appBarLeft
130
+ })),
131
+ /*#__PURE__*/ _jsx(Stack, _extends({
132
+ direction: "row",
133
+ className: classKeys.appBarRight
134
+ }, AppBarRightProps, {
135
+ sx: mergeSxProps({
136
+ alignItems: 'center',
137
+ justifyContent: 'flex-start'
138
+ }, AppBarRightProps == null ? void 0 : AppBarRightProps.sx),
139
+ children: appBarRight
140
+ }))
141
+ ]
142
+ })
143
+ }),
144
+ childrenAfterToolbar
145
+ ]
146
+ })),
147
+ /*#__PURE__*/ _jsx(Stack, _extends({
148
+ ref: setScrollView,
149
+ component: "main",
150
+ direction: "column",
151
+ className: classKeys.content
152
+ }, ContentProps, {
153
+ sx: mergeSxProps({
154
+ overflow: 'auto',
155
+ flexGrow: 1,
156
+ height: 1,
157
+ width: 1,
158
+ bgcolor: 'background.default',
159
+ zIndex: 1
160
+ }, ContentProps == null ? void 0 : ContentProps.sx),
161
+ children: children
162
+ })),
163
+ /*#__PURE__*/ _jsx(Stack, {
164
+ component: "footer",
165
+ direction: "column",
166
+ className: classKeys.bottomAppBar,
167
+ children: bottomAppBar
168
+ })
169
+ ]
170
+ }));
171
+ });
172
+ NavigationView.displayName = 'NavigationView';
173
+ export default NavigationView;
174
+
175
+ //# sourceMappingURL=navigation-view.js.map