@publish.os/nextjs 0.0.1-alpha.5 → 0.0.1-alpha.6

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 (214) hide show
  1. package/README.md +1 -1
  2. package/dist/config/createNextConfig.js +3 -3
  3. package/dist/index.js +7 -5
  4. package/dist/kernel/components/blocks/color-palette.js +35 -4
  5. package/dist/kernel/components/blocks/logo-block.js +1 -1
  6. package/dist/kernel/components/blocks/nav-breadcrumb.js +2 -12
  7. package/dist/kernel/components/mdx/components/image.js +1 -1
  8. package/dist/kernel/components/ui/breadcrumb-trail.d.ts +3 -1
  9. package/dist/kernel/components/ui/breadcrumb-trail.js +1 -0
  10. package/dist/kernel/components/ui/breadcrumb.d.ts +1 -5
  11. package/dist/kernel/components/ui/breadcrumb.js +1 -16
  12. package/dist/kernel/components/ui/menu.js +5 -5
  13. package/dist/kernel/components/ui/navigation-menu.js +2 -2
  14. package/dist/kernel/components/ui/popover.js +5 -11
  15. package/dist/kernel/components/ui/select.js +5 -5
  16. package/dist/kernel/components/ui/text.js +109 -106
  17. package/dist/kernel/components/ui/tooltip.js +2 -2
  18. package/dist/kernel/defaults.registry.d.ts +60 -69
  19. package/dist/kernel/defaults.registry.js +59 -67
  20. package/dist/kernel/routes/agent/markdown.js +2 -2
  21. package/dist/kernel/routes/metadata/feed.js +2 -2
  22. package/dist/kernel/routes/metadata/llms.js +4 -2
  23. package/dist/kernel/routes/metadata/og-image.d.ts +1 -1
  24. package/dist/kernel/routes/metadata/robots.js +2 -2
  25. package/dist/kernel/routes/metadata/sitemap.js +2 -2
  26. package/dist/utils/cn.d.ts +1 -1
  27. package/package.json +2 -6
  28. package/release/package.json +3 -2
  29. package/release/release.json +5 -5
  30. package/release/{pnpm-lock.yaml → runtime-pnpm-lock.yaml} +135 -34
  31. package/dist/cache/tags.cjs +0 -79
  32. package/dist/cache/tags.d.cts +0 -13
  33. package/dist/config/createNextConfig.cjs +0 -52
  34. package/dist/config/createNextConfig.d.cts +0 -8
  35. package/dist/config.cjs +0 -78
  36. package/dist/config.d.cts +0 -101
  37. package/dist/config.d.ts +0 -101
  38. package/dist/config.js +0 -48
  39. package/dist/index.cjs +0 -1266
  40. package/dist/index.d.cts +0 -18
  41. package/dist/kernel/components/blocks/AgentActions.cjs +0 -425
  42. package/dist/kernel/components/blocks/AgentActions.d.cts +0 -52
  43. package/dist/kernel/components/blocks/animated-icon-swap.cjs +0 -101
  44. package/dist/kernel/components/blocks/animated-icon-swap.d.cts +0 -16
  45. package/dist/kernel/components/blocks/color-palette.cjs +0 -413
  46. package/dist/kernel/components/blocks/color-palette.d.cts +0 -7
  47. package/dist/kernel/components/blocks/design-system-preview.cjs +0 -593
  48. package/dist/kernel/components/blocks/design-system-preview.d.cts +0 -29
  49. package/dist/kernel/components/blocks/link-playground.cjs +0 -816
  50. package/dist/kernel/components/blocks/link-playground.d.cts +0 -5
  51. package/dist/kernel/components/blocks/logo-block.cjs +0 -156
  52. package/dist/kernel/components/blocks/logo-block.d.cts +0 -21
  53. package/dist/kernel/components/blocks/nav-breadcrumb.cjs +0 -122
  54. package/dist/kernel/components/blocks/nav-breadcrumb.d.cts +0 -11
  55. package/dist/kernel/components/blocks/navbar.cjs +0 -154
  56. package/dist/kernel/components/blocks/navbar.d.cts +0 -16
  57. package/dist/kernel/components/blocks/navigation-progress-playground.cjs +0 -735
  58. package/dist/kernel/components/blocks/navigation-progress-playground.d.cts +0 -5
  59. package/dist/kernel/components/blocks/navigation-progress.cjs +0 -270
  60. package/dist/kernel/components/blocks/navigation-progress.d.cts +0 -16
  61. package/dist/kernel/components/blocks/next-prev.cjs +0 -142
  62. package/dist/kernel/components/blocks/next-prev.d.cts +0 -11
  63. package/dist/kernel/components/blocks/page-list.cjs +0 -59
  64. package/dist/kernel/components/blocks/page-list.d.cts +0 -11
  65. package/dist/kernel/components/blocks/search.cjs +0 -717
  66. package/dist/kernel/components/blocks/search.d.cts +0 -77
  67. package/dist/kernel/components/blocks/sidebar-node.cjs +0 -309
  68. package/dist/kernel/components/blocks/sidebar-node.d.cts +0 -8
  69. package/dist/kernel/components/blocks/sidebar.cjs +0 -317
  70. package/dist/kernel/components/blocks/sidebar.d.cts +0 -33
  71. package/dist/kernel/components/blocks/theme-toggle.cjs +0 -31
  72. package/dist/kernel/components/blocks/theme-toggle.d.cts +0 -6
  73. package/dist/kernel/components/blocks/toc.cjs +0 -356
  74. package/dist/kernel/components/blocks/toc.d.cts +0 -10
  75. package/dist/kernel/components/mdx/components/blockquote.cjs +0 -66
  76. package/dist/kernel/components/mdx/components/blockquote.d.cts +0 -6
  77. package/dist/kernel/components/mdx/components/callout.cjs +0 -137
  78. package/dist/kernel/components/mdx/components/callout.d.cts +0 -18
  79. package/dist/kernel/components/mdx/components/code-block.cjs +0 -39
  80. package/dist/kernel/components/mdx/components/code-block.d.cts +0 -9
  81. package/dist/kernel/components/mdx/components/figure-caption.cjs +0 -63
  82. package/dist/kernel/components/mdx/components/figure-caption.d.cts +0 -6
  83. package/dist/kernel/components/mdx/components/figure.cjs +0 -78
  84. package/dist/kernel/components/mdx/components/figure.d.cts +0 -10
  85. package/dist/kernel/components/mdx/components/footnotes.cjs +0 -66
  86. package/dist/kernel/components/mdx/components/footnotes.d.cts +0 -6
  87. package/dist/kernel/components/mdx/components/heading-copy-link.cjs +0 -108
  88. package/dist/kernel/components/mdx/components/heading-copy-link.d.cts +0 -23
  89. package/dist/kernel/components/mdx/components/heading.cjs +0 -166
  90. package/dist/kernel/components/mdx/components/heading.d.cts +0 -8
  91. package/dist/kernel/components/mdx/components/hr.cjs +0 -34
  92. package/dist/kernel/components/mdx/components/hr.d.cts +0 -9
  93. package/dist/kernel/components/mdx/components/image-zoom.cjs +0 -49
  94. package/dist/kernel/components/mdx/components/image-zoom.d.cts +0 -10
  95. package/dist/kernel/components/mdx/components/image.cjs +0 -192
  96. package/dist/kernel/components/mdx/components/image.d.cts +0 -21
  97. package/dist/kernel/components/mdx/components/inline-code.cjs +0 -66
  98. package/dist/kernel/components/mdx/components/inline-code.d.cts +0 -6
  99. package/dist/kernel/components/mdx/components/kbd.cjs +0 -34
  100. package/dist/kernel/components/mdx/components/kbd.d.cts +0 -10
  101. package/dist/kernel/components/mdx/components/link.cjs +0 -49
  102. package/dist/kernel/components/mdx/components/link.d.cts +0 -11
  103. package/dist/kernel/components/mdx/components/paragraph.cjs +0 -87
  104. package/dist/kernel/components/mdx/components/paragraph.d.cts +0 -5
  105. package/dist/kernel/components/mdx/components/pre.cjs +0 -66
  106. package/dist/kernel/components/mdx/components/pre.d.cts +0 -6
  107. package/dist/kernel/components/mdx/components/strikethrough.cjs +0 -63
  108. package/dist/kernel/components/mdx/components/strikethrough.d.cts +0 -6
  109. package/dist/kernel/components/mdx/components/table.cjs +0 -59
  110. package/dist/kernel/components/mdx/components/table.d.cts +0 -10
  111. package/dist/kernel/components/mdx/components/task-list.cjs +0 -88
  112. package/dist/kernel/components/mdx/components/task-list.d.cts +0 -8
  113. package/dist/kernel/components/mdx/components/video-player.cjs +0 -173
  114. package/dist/kernel/components/mdx/components/video-player.d.cts +0 -18
  115. package/dist/kernel/components/mdx/components/video.cjs +0 -185
  116. package/dist/kernel/components/mdx/components/video.d.cts +0 -15
  117. package/dist/kernel/components/mdx/error-boundary.cjs +0 -62
  118. package/dist/kernel/components/mdx/error-boundary.d.cts +0 -8
  119. package/dist/kernel/components/mdx/error-fallback.cjs +0 -58
  120. package/dist/kernel/components/mdx/error-fallback.d.cts +0 -9
  121. package/dist/kernel/components/mdx/mdx.cjs +0 -141
  122. package/dist/kernel/components/mdx/mdx.d.cts +0 -22
  123. package/dist/kernel/components/mdx/rehype-heading-ids.cjs +0 -113
  124. package/dist/kernel/components/mdx/rehype-heading-ids.d.cts +0 -10
  125. package/dist/kernel/components/mdx/types.cjs +0 -18
  126. package/dist/kernel/components/mdx/types.d.cts +0 -18
  127. package/dist/kernel/components/ui/accordion.cjs +0 -104
  128. package/dist/kernel/components/ui/accordion.d.cts +0 -16
  129. package/dist/kernel/components/ui/breadcrumb-trail.cjs +0 -238
  130. package/dist/kernel/components/ui/breadcrumb-trail.d.cts +0 -13
  131. package/dist/kernel/components/ui/breadcrumb.cjs +0 -399
  132. package/dist/kernel/components/ui/breadcrumb.d.cts +0 -52
  133. package/dist/kernel/components/ui/button-group.cjs +0 -143
  134. package/dist/kernel/components/ui/button-group.d.cts +0 -19
  135. package/dist/kernel/components/ui/button.cjs +0 -139
  136. package/dist/kernel/components/ui/button.d.cts +0 -22
  137. package/dist/kernel/components/ui/card.cjs +0 -133
  138. package/dist/kernel/components/ui/card.d.cts +0 -17
  139. package/dist/kernel/components/ui/dialog.cjs +0 -149
  140. package/dist/kernel/components/ui/dialog.d.cts +0 -22
  141. package/dist/kernel/components/ui/drawer.cjs +0 -163
  142. package/dist/kernel/components/ui/drawer.d.cts +0 -24
  143. package/dist/kernel/components/ui/input.cjs +0 -96
  144. package/dist/kernel/components/ui/input.d.cts +0 -18
  145. package/dist/kernel/components/ui/kbd.cjs +0 -105
  146. package/dist/kernel/components/ui/kbd.d.cts +0 -13
  147. package/dist/kernel/components/ui/link.cjs +0 -253
  148. package/dist/kernel/components/ui/link.d.cts +0 -31
  149. package/dist/kernel/components/ui/menu.cjs +0 -301
  150. package/dist/kernel/components/ui/menu.d.cts +0 -70
  151. package/dist/kernel/components/ui/meta-key.cjs +0 -34
  152. package/dist/kernel/components/ui/meta-key.d.cts +0 -12
  153. package/dist/kernel/components/ui/navigation-menu.cjs +0 -253
  154. package/dist/kernel/components/ui/navigation-menu.d.cts +0 -47
  155. package/dist/kernel/components/ui/popover.cjs +0 -168
  156. package/dist/kernel/components/ui/popover.d.cts +0 -24
  157. package/dist/kernel/components/ui/progress.cjs +0 -112
  158. package/dist/kernel/components/ui/progress.d.cts +0 -16
  159. package/dist/kernel/components/ui/scroll-area.cjs +0 -413
  160. package/dist/kernel/components/ui/scroll-area.d.cts +0 -58
  161. package/dist/kernel/components/ui/select.cjs +0 -244
  162. package/dist/kernel/components/ui/select.d.cts +0 -40
  163. package/dist/kernel/components/ui/separator.cjs +0 -73
  164. package/dist/kernel/components/ui/separator.d.cts +0 -8
  165. package/dist/kernel/components/ui/table.cjs +0 -131
  166. package/dist/kernel/components/ui/table.d.cts +0 -11
  167. package/dist/kernel/components/ui/tabs.cjs +0 -450
  168. package/dist/kernel/components/ui/tabs.d.cts +0 -82
  169. package/dist/kernel/components/ui/tag.cjs +0 -104
  170. package/dist/kernel/components/ui/tag.d.cts +0 -14
  171. package/dist/kernel/components/ui/text.cjs +0 -184
  172. package/dist/kernel/components/ui/text.d.cts +0 -17
  173. package/dist/kernel/components/ui/theme-toggle.cjs +0 -108
  174. package/dist/kernel/components/ui/theme-toggle.d.cts +0 -10
  175. package/dist/kernel/components/ui/toast.cjs +0 -154
  176. package/dist/kernel/components/ui/toast.d.cts +0 -26
  177. package/dist/kernel/components/ui/tooltip.cjs +0 -127
  178. package/dist/kernel/components/ui/tooltip.d.cts +0 -20
  179. package/dist/kernel/defaults.registry.cjs +0 -541
  180. package/dist/kernel/defaults.registry.d.cts +0 -469
  181. package/dist/kernel/routes/agent/markdown.cjs +0 -202
  182. package/dist/kernel/routes/agent/markdown.d.cts +0 -58
  183. package/dist/kernel/routes/layouts/group.cjs +0 -181
  184. package/dist/kernel/routes/layouts/group.d.cts +0 -20
  185. package/dist/kernel/routes/metadata/feed.cjs +0 -293
  186. package/dist/kernel/routes/metadata/feed.d.cts +0 -20
  187. package/dist/kernel/routes/metadata/llms.cjs +0 -239
  188. package/dist/kernel/routes/metadata/llms.d.cts +0 -26
  189. package/dist/kernel/routes/metadata/og-image.cjs +0 -630
  190. package/dist/kernel/routes/metadata/og-image.d.cts +0 -62
  191. package/dist/kernel/routes/metadata/robots.cjs +0 -148
  192. package/dist/kernel/routes/metadata/robots.d.cts +0 -6
  193. package/dist/kernel/routes/metadata/sitemap.cjs +0 -192
  194. package/dist/kernel/routes/metadata/sitemap.d.cts +0 -8
  195. package/dist/kernel/routes/pages/group.cjs +0 -263
  196. package/dist/kernel/routes/pages/group.d.cts +0 -17
  197. package/dist/kernel/routes/pages/leaf.cjs +0 -421
  198. package/dist/kernel/routes/pages/leaf.d.cts +0 -36
  199. package/dist/kernel/routes/pages/root.cjs +0 -229
  200. package/dist/kernel/routes/pages/root.d.cts +0 -16
  201. package/dist/keyboard-shortcuts.cjs +0 -345
  202. package/dist/keyboard-shortcuts.d.cts +0 -34
  203. package/dist/resolvers/manifest-resolver.cjs +0 -111
  204. package/dist/resolvers/manifest-resolver.d.cts +0 -13
  205. package/dist/search.cjs +0 -411
  206. package/dist/search.d.cts +0 -20
  207. package/dist/types.cjs +0 -30
  208. package/dist/types.d.cts +0 -269
  209. package/dist/utils/cn.cjs +0 -49
  210. package/dist/utils/cn.d.cts +0 -15
  211. package/dist/utils/heading-ids.cjs +0 -119
  212. package/dist/utils/heading-ids.d.cts +0 -15
  213. package/dist/utils/pretty-date.cjs +0 -55
  214. package/dist/utils/pretty-date.d.cts +0 -6
@@ -1,735 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/kernel/components/blocks/navigation-progress-playground.tsx
22
- var navigation_progress_playground_exports = {};
23
- __export(navigation_progress_playground_exports, {
24
- NavigationProgressPlayground: () => NavigationProgressPlayground
25
- });
26
- module.exports = __toCommonJS(navigation_progress_playground_exports);
27
- var import_button = require("../ui/button.js");
28
- var import_progress = require("../ui/progress.js");
29
- var import_tabs = require("../ui/tabs.js");
30
-
31
- // src/utils/cn.ts
32
- var import_clsx = require("clsx");
33
- var import_tailwind_merge = require("tailwind-merge");
34
- var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
35
- extend: {
36
- classGroups: {
37
- z: [
38
- "z-content",
39
- "z-nav",
40
- "z-overlay",
41
- "z-modal",
42
- "z-search",
43
- "z-toast",
44
- "z-progress"
45
- ]
46
- }
47
- }
48
- });
49
- function cn(...inputs) {
50
- return twMerge((0, import_clsx.clsx)(inputs));
51
- }
52
-
53
- // src/kernel/components/blocks/navigation-progress-playground.tsx
54
- var import_react = require("react");
55
- var import_jsx_runtime = require("react/jsx-runtime");
56
- var presets = {
57
- current: {
58
- description: "Current PublishOS navigation-progress settings.",
59
- label: "Current",
60
- settings: {
61
- initialProgress: 0,
62
- targetProgress: 98,
63
- fastPhaseEnd: 38,
64
- minDuration: 48,
65
- maxDuration: 1800,
66
- exitDuration: 188,
67
- timeout: 8e3,
68
- sampleMinDuration: 700,
69
- sampleMaxDuration: 1800,
70
- settleDelay: 100,
71
- transitionDuration: 320,
72
- curvePower: 3,
73
- height: 2,
74
- fill: "var(--progress-bar-fill, var(--accent-1, #111111))",
75
- track: "var(--progress-bar-background, transparent)",
76
- progressEase: "cubic-bezier(0.21, 0.65, 0.35, 1)",
77
- exitEase: "cubic-bezier(0.55, 0.06, 0.68, 0.19)",
78
- transformOrigin: "left",
79
- exitTransformOrigin: "right"
80
- }
81
- },
82
- aave: {
83
- description: "Aave docs inspired: thin, calm, left-origin purple bar.",
84
- label: "Aave",
85
- settings: {
86
- initialProgress: 0,
87
- targetProgress: 92,
88
- fastPhaseEnd: 38,
89
- minDuration: 140,
90
- maxDuration: 1800,
91
- exitDuration: 260,
92
- timeout: 7e3,
93
- sampleMinDuration: 750,
94
- sampleMaxDuration: 1900,
95
- settleDelay: 80,
96
- transitionDuration: 320,
97
- curvePower: 2.2,
98
- height: 2,
99
- fill: "color(display-p3 0.5960784314 0.5882352941 1 / 1)",
100
- track: "transparent",
101
- progressEase: "cubic-bezier(0.21, 0.65, 0.35, 1)",
102
- exitEase: "cubic-bezier(0.55, 0.06, 0.68, 0.19)",
103
- transformOrigin: "left",
104
- exitTransformOrigin: "right"
105
- }
106
- },
107
- tuned: {
108
- description: "A snappier PublishOS candidate with a shorter long tail.",
109
- label: "Tuned",
110
- settings: {
111
- initialProgress: 8,
112
- targetProgress: 94,
113
- fastPhaseEnd: 34,
114
- minDuration: 90,
115
- maxDuration: 4200,
116
- exitDuration: 180,
117
- timeout: 8e3,
118
- sampleMinDuration: 550,
119
- sampleMaxDuration: 1600,
120
- settleDelay: 70,
121
- transitionDuration: 180,
122
- curvePower: 2.6,
123
- height: 2,
124
- fill: "var(--progress-bar-fill, var(--accent-1, #111111))",
125
- track: "var(--progress-bar-background, transparent)",
126
- progressEase: "cubic-bezier(0.12, 0.72, 0, 1)",
127
- exitEase: "cubic-bezier(0.2, 0, 0, 1)",
128
- transformOrigin: "left",
129
- exitTransformOrigin: "right"
130
- }
131
- }
132
- };
133
- var presetOrder = ["current", "aave", "tuned"];
134
- function clamp({
135
- max,
136
- min,
137
- value
138
- }) {
139
- return Math.min(max, Math.max(min, value));
140
- }
141
- function buildOutput(settings) {
142
- return `export const navigationProgressConfig = {
143
- initialProgress: ${settings.initialProgress},
144
- targetProgress: ${settings.targetProgress},
145
- fastPhaseEnd: ${settings.fastPhaseEnd},
146
- minDuration: ${settings.minDuration},
147
- maxDuration: ${settings.maxDuration},
148
- exitDuration: ${settings.exitDuration},
149
- timeout: ${settings.timeout},
150
- };
151
-
152
- const sampleDuration =
153
- ${settings.sampleMinDuration} +
154
- Math.random() * (${settings.sampleMaxDuration} - ${settings.sampleMinDuration});
155
-
156
- /* animation.css */
157
- :root {
158
- --animation-ease-progress: ${settings.progressEase};
159
- --animation-ease-progress-exit: ${settings.exitEase};
160
- --progress-bar-height: ${settings.height}px;
161
- }
162
-
163
- /* NavigationProgress indicator */
164
- style={{
165
- transformOrigin: isExiting ? "${settings.exitTransformOrigin}" : "${settings.transformOrigin}",
166
- transition: isExiting
167
- ? "transform ${settings.exitDuration}ms var(--animation-ease-progress-exit)"
168
- : "transform ${settings.transitionDuration}ms var(--animation-ease-progress)",
169
- }}
170
-
171
- /* Theme tokens */
172
- --progress-bar-fill: ${settings.fill};
173
- --progress-bar-background: ${settings.track};`;
174
- }
175
- function randomDuration({ max, min }) {
176
- const lower = Math.min(min, max);
177
- const upper = Math.max(min, max);
178
- return Math.round(lower + Math.random() * (upper - lower));
179
- }
180
- function NumberControl({
181
- label,
182
- max,
183
- min,
184
- onChange,
185
- step = 1,
186
- unit,
187
- value
188
- }) {
189
- const id = (0, import_react.useId)();
190
- const handleChange = (event) => {
191
- onChange(Number(event.target.value));
192
- };
193
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-2", children: [
194
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
195
- "label",
196
- {
197
- className: "flex items-center justify-between gap-3 text-xs font-medium text-foreground-2",
198
- htmlFor: id,
199
- children: [
200
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label }),
201
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "font-mono text-[11px] text-foreground-3", children: [
202
- value,
203
- unit
204
- ] })
205
- ]
206
- }
207
- ),
208
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-[1fr_4.75rem] items-center gap-3", children: [
209
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
210
- "input",
211
- {
212
- className: "h-1 w-full accent-foreground-1",
213
- id,
214
- max,
215
- min,
216
- onChange: handleChange,
217
- step,
218
- type: "range",
219
- value
220
- }
221
- ),
222
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
- "input",
224
- {
225
- className: "h-8 rounded-button border border-stroke-2 bg-surface-1 px-2 text-right font-mono text-xs text-foreground-1 outline-none focus:border-accent-1",
226
- max,
227
- min,
228
- onChange: handleChange,
229
- step,
230
- type: "number",
231
- value
232
- }
233
- )
234
- ] })
235
- ] });
236
- }
237
- function TextControl({
238
- label,
239
- onChange,
240
- value
241
- }) {
242
- const id = (0, import_react.useId)();
243
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
244
- "label",
245
- {
246
- className: "grid gap-2 text-xs font-medium text-foreground-2",
247
- htmlFor: id,
248
- children: [
249
- label,
250
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
251
- "input",
252
- {
253
- className: "h-8 rounded-button border border-stroke-2 bg-surface-1 px-2 font-mono text-xs text-foreground-1 outline-none focus:border-accent-1",
254
- id,
255
- onChange: (event) => onChange(event.target.value),
256
- spellCheck: false,
257
- value
258
- }
259
- )
260
- ]
261
- }
262
- );
263
- }
264
- function OriginControl({
265
- label,
266
- onChange,
267
- value
268
- }) {
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-2", children: [
270
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-xs font-medium text-foreground-2", children: label }),
271
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-2 rounded-button border border-stroke-2 bg-surface-2 p-1", children: ["left", "right"].map((origin) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
272
- "button",
273
- {
274
- className: cn(
275
- "h-7 rounded-[max(calc(var(--radius-button)_-_0.25rem),0px)] text-xs font-medium text-foreground-3 transition-colors",
276
- origin === value && "bg-surface-1 text-foreground-1 shadow-sm"
277
- ),
278
- onClick: () => onChange(origin),
279
- type: "button",
280
- children: origin
281
- },
282
- origin
283
- )) })
284
- ] });
285
- }
286
- function ControlSection({
287
- children,
288
- title
289
- }) {
290
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "grid gap-4 border-b border-stroke-3 px-4 py-5", children: [
291
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-xs font-semibold uppercase text-foreground-3", children: title }),
292
- children
293
- ] });
294
- }
295
- function ProgressPreview({
296
- isExiting,
297
- progress,
298
- settings
299
- }) {
300
- const isVisible = progress > 0;
301
- const boundedProgress = clamp({ max: 100, min: 0, value: progress });
302
- const indicatorStyle = {
303
- background: settings.fill,
304
- transform: isExiting ? "scaleX(0)" : `scaleX(${boundedProgress / 100})`,
305
- transformOrigin: isExiting ? settings.exitTransformOrigin : settings.transformOrigin,
306
- transition: isExiting ? `transform ${settings.exitDuration}ms ${settings.exitEase}` : `transform ${settings.transitionDuration}ms ${settings.progressEase}`
307
- };
308
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
309
- import_progress.Progress,
310
- {
311
- "aria-label": "Sample page navigation",
312
- className: cn(
313
- "pointer-events-none absolute left-0 right-0 top-0 overflow-hidden transition-opacity duration-200",
314
- isVisible ? "opacity-100" : "opacity-0"
315
- ),
316
- style: { height: settings.height },
317
- value: isVisible ? boundedProgress : null,
318
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
319
- import_progress.ProgressTrack,
320
- {
321
- className: "h-full rounded-none",
322
- style: { background: settings.track },
323
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
324
- import_progress.ProgressIndicator,
325
- {
326
- className: "h-full w-full rounded-none transition-none",
327
- style: indicatorStyle
328
- }
329
- )
330
- }
331
- )
332
- }
333
- );
334
- }
335
- function NavigationProgressPlayground() {
336
- const [settings, setSettings] = (0, import_react.useState)(
337
- presets.tuned.settings
338
- );
339
- const [activePreset, setActivePreset] = (0, import_react.useState)("tuned");
340
- const [progress, setProgress] = (0, import_react.useState)(0);
341
- const [isExiting, setIsExiting] = (0, import_react.useState)(false);
342
- const [isRunning, setIsRunning] = (0, import_react.useState)(false);
343
- const [copyState, setCopyState] = (0, import_react.useState)("idle");
344
- const [sampleDuration, setSampleDuration] = (0, import_react.useState)(null);
345
- const animationFrame = (0, import_react.useRef)(null);
346
- const completionTimer = (0, import_react.useRef)(null);
347
- const settleTimer = (0, import_react.useRef)(null);
348
- const exitTimer = (0, import_react.useRef)(null);
349
- const activeNavigation = (0, import_react.useRef)(false);
350
- const output = (0, import_react.useMemo)(() => buildOutput(settings), [settings]);
351
- const clearTimers = (0, import_react.useCallback)(() => {
352
- if (animationFrame.current) cancelAnimationFrame(animationFrame.current);
353
- if (completionTimer.current) clearTimeout(completionTimer.current);
354
- if (settleTimer.current) clearTimeout(settleTimer.current);
355
- if (exitTimer.current) clearTimeout(exitTimer.current);
356
- animationFrame.current = null;
357
- completionTimer.current = null;
358
- settleTimer.current = null;
359
- exitTimer.current = null;
360
- }, []);
361
- const resetSample = (0, import_react.useCallback)(() => {
362
- clearTimers();
363
- activeNavigation.current = false;
364
- setProgress(0);
365
- setIsExiting(false);
366
- setIsRunning(false);
367
- setSampleDuration(null);
368
- }, [clearTimers]);
369
- const completeSample = (0, import_react.useCallback)(() => {
370
- if (!activeNavigation.current) return;
371
- if (animationFrame.current) {
372
- cancelAnimationFrame(animationFrame.current);
373
- animationFrame.current = null;
374
- }
375
- if (completionTimer.current) {
376
- clearTimeout(completionTimer.current);
377
- completionTimer.current = null;
378
- }
379
- setProgress(100);
380
- settleTimer.current = setTimeout(() => {
381
- if (!activeNavigation.current) return;
382
- setIsExiting(true);
383
- exitTimer.current = setTimeout(() => {
384
- setProgress(0);
385
- setIsExiting(false);
386
- setIsRunning(false);
387
- activeNavigation.current = false;
388
- exitTimer.current = null;
389
- }, settings.exitDuration);
390
- }, settings.settleDelay);
391
- }, [settings.exitDuration, settings.settleDelay]);
392
- const startSample = (0, import_react.useCallback)(() => {
393
- resetSample();
394
- activeNavigation.current = true;
395
- setIsRunning(true);
396
- setIsExiting(false);
397
- setProgress(settings.initialProgress);
398
- const startTime = performance.now();
399
- const routeDuration = randomDuration({
400
- max: settings.sampleMaxDuration,
401
- min: settings.sampleMinDuration
402
- });
403
- setSampleDuration(routeDuration);
404
- const animate = () => {
405
- if (!activeNavigation.current) return;
406
- const elapsed = performance.now() - startTime;
407
- let progressValue;
408
- if (elapsed < settings.minDuration) {
409
- progressValue = settings.initialProgress + elapsed / settings.minDuration * (settings.fastPhaseEnd - settings.initialProgress);
410
- } else {
411
- const remainingProgress = settings.targetProgress - settings.fastPhaseEnd;
412
- const normalizedTime = clamp({
413
- max: 1,
414
- min: 0,
415
- value: (elapsed - settings.minDuration) / (settings.maxDuration - settings.minDuration)
416
- });
417
- const easedTime = 1 - (1 - normalizedTime) ** settings.curvePower;
418
- progressValue = settings.fastPhaseEnd + easedTime * remainingProgress;
419
- }
420
- setProgress(
421
- clamp({ max: settings.targetProgress, min: 0, value: progressValue })
422
- );
423
- animationFrame.current = requestAnimationFrame(animate);
424
- };
425
- animationFrame.current = requestAnimationFrame(animate);
426
- completionTimer.current = setTimeout(completeSample, routeDuration);
427
- }, [completeSample, resetSample, settings]);
428
- (0, import_react.useEffect)(() => resetSample, [resetSample]);
429
- const updateNumber = (key, value) => {
430
- setActivePreset("custom");
431
- setSettings((current) => ({ ...current, [key]: value }));
432
- };
433
- const updateText = (key, value) => {
434
- setActivePreset("custom");
435
- setSettings((current) => ({ ...current, [key]: value }));
436
- };
437
- const updateOrigin = (key, value) => {
438
- setActivePreset("custom");
439
- setSettings((current) => ({ ...current, [key]: value }));
440
- };
441
- const applyPreset = (preset) => {
442
- resetSample();
443
- setActivePreset(preset);
444
- setSettings(presets[preset].settings);
445
- };
446
- const copyOutput = async () => {
447
- await navigator.clipboard.writeText(output);
448
- setCopyState("copied");
449
- window.setTimeout(() => setCopyState("idle"), 1200);
450
- };
451
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-screen bg-[#fafafa] text-foreground-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid min-h-screen lg:grid-cols-[1fr_23rem]", children: [
452
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("main", { className: "relative min-h-screen overflow-hidden", children: [
453
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute left-5 top-5 text-sm font-medium text-[#b4b4b4]", children: "Inline" }),
454
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex min-h-screen items-center justify-center px-8 py-20", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "relative flex h-[15rem] w-full max-w-4xl flex-col items-center justify-center overflow-hidden bg-white shadow-[0_0_28px_rgba(0,0,0,0.012)]", children: [
455
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
456
- ProgressPreview,
457
- {
458
- isExiting,
459
- progress,
460
- settings
461
- }
462
- ),
463
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid justify-items-center gap-6", children: [
464
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-center text-base font-semibold text-black", children: "put progress bars here" }),
465
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-3", children: [
466
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: startSample, size: "sm", children: "Trigger navigation" }),
467
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: resetSample, size: "sm", variant: "outline", children: "Reset" })
468
- ] }),
469
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "font-mono text-xs text-foreground-3", children: isRunning ? `${Math.round(progress)}% / ${sampleDuration ?? 0}ms` : "idle" })
470
- ] })
471
- ] }) })
472
- ] }),
473
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { className: "flex max-h-screen min-h-screen flex-col border-l border-stroke-3 bg-surface-1", children: [
474
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border-b border-stroke-3 px-4 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
475
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
476
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-sm font-semibold text-foreground-1", children: "Navigation Progress" }),
477
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-1 text-xs leading-5 text-foreground-3", children: "Tune, trigger, copy." })
478
- ] }),
479
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: copyOutput, size: "xs", variant: "soft", children: copyState === "copied" ? "Copied" : "Copy" })
480
- ] }) }),
481
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border-b border-stroke-3 px-4 py-4", children: [
482
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-3 gap-1 rounded-button border border-stroke-2 bg-surface-2 p-1", children: presetOrder.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
483
- "button",
484
- {
485
- className: cn(
486
- "h-8 rounded-[max(calc(var(--radius-button)_-_0.25rem),0px)] text-xs font-medium text-foreground-3 transition-colors",
487
- activePreset === preset && "bg-surface-1 text-foreground-1 shadow-sm"
488
- ),
489
- onClick: () => applyPreset(preset),
490
- type: "button",
491
- children: presets[preset].label
492
- },
493
- preset
494
- )) }),
495
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-3 text-xs leading-5 text-foreground-3", children: activePreset === "custom" ? "Custom settings ready to copy into the progress bar." : presets[activePreset].description })
496
- ] }),
497
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.Tabs, { className: "flex min-h-0 flex-1 flex-col", defaultValue: "timing", children: [
498
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "border-b border-stroke-3 px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.TabsList, { className: "grid w-full grid-cols-4", children: [
499
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTab, { className: "px-2 text-xs", value: "timing", children: "Timing" }),
500
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTab, { className: "px-2 text-xs", value: "motion", children: "Motion" }),
501
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTab, { className: "px-2 text-xs", value: "visual", children: "Visual" }),
502
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTab, { className: "px-2 text-xs", value: "output", children: "Output" })
503
- ] }) }),
504
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
505
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.TabsPanel, { value: "timing", children: [
506
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Progress", children: [
507
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
508
- NumberControl,
509
- {
510
- label: "Initial",
511
- max: 40,
512
- min: 0,
513
- onChange: (value) => updateNumber("initialProgress", value),
514
- unit: "%",
515
- value: settings.initialProgress
516
- }
517
- ),
518
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
519
- NumberControl,
520
- {
521
- label: "Fast phase",
522
- max: 80,
523
- min: 0,
524
- onChange: (value) => updateNumber("fastPhaseEnd", value),
525
- unit: "%",
526
- value: settings.fastPhaseEnd
527
- }
528
- ),
529
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
530
- NumberControl,
531
- {
532
- label: "Target",
533
- max: 99,
534
- min: 50,
535
- onChange: (value) => updateNumber("targetProgress", value),
536
- unit: "%",
537
- value: settings.targetProgress
538
- }
539
- )
540
- ] }),
541
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Duration", children: [
542
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
543
- NumberControl,
544
- {
545
- label: "Fast duration",
546
- max: 400,
547
- min: 0,
548
- onChange: (value) => updateNumber("minDuration", value),
549
- unit: "ms",
550
- value: settings.minDuration
551
- }
552
- ),
553
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
554
- NumberControl,
555
- {
556
- label: "Tail duration",
557
- max: 3e4,
558
- min: 500,
559
- onChange: (value) => updateNumber("maxDuration", value),
560
- step: 100,
561
- unit: "ms",
562
- value: settings.maxDuration
563
- }
564
- ),
565
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
566
- NumberControl,
567
- {
568
- label: "Sample min",
569
- max: 5e3,
570
- min: 150,
571
- onChange: (value) => updateNumber("sampleMinDuration", value),
572
- step: 50,
573
- unit: "ms",
574
- value: settings.sampleMinDuration
575
- }
576
- ),
577
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
578
- NumberControl,
579
- {
580
- label: "Sample max",
581
- max: 8e3,
582
- min: 150,
583
- onChange: (value) => updateNumber("sampleMaxDuration", value),
584
- step: 50,
585
- unit: "ms",
586
- value: settings.sampleMaxDuration
587
- }
588
- ),
589
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
590
- NumberControl,
591
- {
592
- label: "Timeout",
593
- max: 2e4,
594
- min: 1e3,
595
- onChange: (value) => updateNumber("timeout", value),
596
- step: 250,
597
- unit: "ms",
598
- value: settings.timeout
599
- }
600
- )
601
- ] })
602
- ] }),
603
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.TabsPanel, { value: "motion", children: [
604
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Transform", children: [
605
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
606
- NumberControl,
607
- {
608
- label: "Transition",
609
- max: 700,
610
- min: 0,
611
- onChange: (value) => updateNumber("transitionDuration", value),
612
- unit: "ms",
613
- value: settings.transitionDuration
614
- }
615
- ),
616
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
617
- NumberControl,
618
- {
619
- label: "Curve power",
620
- max: 6,
621
- min: 1,
622
- onChange: (value) => updateNumber("curvePower", value),
623
- step: 0.1,
624
- value: settings.curvePower
625
- }
626
- ),
627
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
628
- OriginControl,
629
- {
630
- label: "Fill origin",
631
- onChange: (value) => updateOrigin("transformOrigin", value),
632
- value: settings.transformOrigin
633
- }
634
- )
635
- ] }),
636
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Exit", children: [
637
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
638
- NumberControl,
639
- {
640
- label: "Settle delay",
641
- max: 500,
642
- min: 0,
643
- onChange: (value) => updateNumber("settleDelay", value),
644
- unit: "ms",
645
- value: settings.settleDelay
646
- }
647
- ),
648
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
649
- NumberControl,
650
- {
651
- label: "Exit duration",
652
- max: 700,
653
- min: 0,
654
- onChange: (value) => updateNumber("exitDuration", value),
655
- unit: "ms",
656
- value: settings.exitDuration
657
- }
658
- ),
659
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
660
- OriginControl,
661
- {
662
- label: "Exit origin",
663
- onChange: (value) => updateOrigin("exitTransformOrigin", value),
664
- value: settings.exitTransformOrigin
665
- }
666
- )
667
- ] }),
668
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Easing", children: [
669
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
670
- TextControl,
671
- {
672
- label: "Progress ease",
673
- onChange: (value) => updateText("progressEase", value),
674
- value: settings.progressEase
675
- }
676
- ),
677
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
678
- TextControl,
679
- {
680
- label: "Exit ease",
681
- onChange: (value) => updateText("exitEase", value),
682
- value: settings.exitEase
683
- }
684
- )
685
- ] })
686
- ] }),
687
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsPanel, { value: "visual", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ControlSection, { title: "Bar", children: [
688
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
689
- NumberControl,
690
- {
691
- label: "Height",
692
- max: 8,
693
- min: 1,
694
- onChange: (value) => updateNumber("height", value),
695
- unit: "px",
696
- value: settings.height
697
- }
698
- ),
699
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
700
- TextControl,
701
- {
702
- label: "Fill",
703
- onChange: (value) => updateText("fill", value),
704
- value: settings.fill
705
- }
706
- ),
707
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
708
- TextControl,
709
- {
710
- label: "Track",
711
- onChange: (value) => updateText("track", value),
712
- value: settings.track
713
- }
714
- )
715
- ] }) }),
716
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsPanel, { className: "h-full", value: "output", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid h-full grid-rows-[1fr_auto] gap-3 p-4", children: [
717
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
718
- "textarea",
719
- {
720
- className: "min-h-[26rem] resize-none rounded-panel border border-stroke-2 bg-surface-2 p-3 font-mono text-xs leading-5 text-foreground-1 outline-none focus:border-accent-1",
721
- readOnly: true,
722
- value: output
723
- }
724
- ),
725
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: copyOutput, size: "sm", variant: "soft", children: copyState === "copied" ? "Copied output" : "Copy output" })
726
- ] }) })
727
- ] })
728
- ] })
729
- ] })
730
- ] }) });
731
- }
732
- // Annotate the CommonJS export names for ESM import in node:
733
- 0 && (module.exports = {
734
- NavigationProgressPlayground
735
- });