@pro-laico/payload-dev-tools 0.0.0

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 (91) hide show
  1. package/LICENSE.md +22 -0
  2. package/README.md +9 -0
  3. package/dist/components/DevToolbar.d.ts +27 -0
  4. package/dist/components/DevToolbar.d.ts.map +1 -0
  5. package/dist/components/DevToolbar.js +32 -0
  6. package/dist/components/DevToolbar.js.map +1 -0
  7. package/dist/components/DevToolbarClient.d.ts +16 -0
  8. package/dist/components/DevToolbarClient.d.ts.map +1 -0
  9. package/dist/components/DevToolbarClient.js +983 -0
  10. package/dist/components/DevToolbarClient.js.map +1 -0
  11. package/dist/components/resolveDevChrome.d.ts +33 -0
  12. package/dist/components/resolveDevChrome.d.ts.map +1 -0
  13. package/dist/components/resolveDevChrome.js +42 -0
  14. package/dist/components/resolveDevChrome.js.map +1 -0
  15. package/dist/components/resolveDevChrome.spec.d.ts +2 -0
  16. package/dist/components/resolveDevChrome.spec.d.ts.map +1 -0
  17. package/dist/components/resolveDevChrome.spec.js +98 -0
  18. package/dist/components/resolveDevChrome.spec.js.map +1 -0
  19. package/dist/components/styles.d.ts +5 -0
  20. package/dist/components/styles.d.ts.map +1 -0
  21. package/dist/components/styles.js +110 -0
  22. package/dist/components/styles.js.map +1 -0
  23. package/dist/cookies.d.ts +12 -0
  24. package/dist/cookies.d.ts.map +1 -0
  25. package/dist/cookies.js +12 -0
  26. package/dist/cookies.js.map +1 -0
  27. package/dist/endpoints/activateIconSet.d.ts +10 -0
  28. package/dist/endpoints/activateIconSet.d.ts.map +1 -0
  29. package/dist/endpoints/activateIconSet.js +55 -0
  30. package/dist/endpoints/activateIconSet.js.map +1 -0
  31. package/dist/endpoints/dev.d.ts +12 -0
  32. package/dist/endpoints/dev.d.ts.map +1 -0
  33. package/dist/endpoints/dev.js +31 -0
  34. package/dist/endpoints/dev.js.map +1 -0
  35. package/dist/endpoints/stage.d.ts +14 -0
  36. package/dist/endpoints/stage.d.ts.map +1 -0
  37. package/dist/endpoints/stage.js +42 -0
  38. package/dist/endpoints/stage.js.map +1 -0
  39. package/dist/harness.d.ts +40 -0
  40. package/dist/harness.d.ts.map +1 -0
  41. package/dist/harness.js +30 -0
  42. package/dist/harness.js.map +1 -0
  43. package/dist/index.d.ts +7 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +9 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/lib/getPayloadClient.d.ts +15 -0
  48. package/dist/lib/getPayloadClient.d.ts.map +1 -0
  49. package/dist/lib/getPayloadClient.js +29 -0
  50. package/dist/lib/getPayloadClient.js.map +1 -0
  51. package/dist/lib/snapshot.d.ts +89 -0
  52. package/dist/lib/snapshot.d.ts.map +1 -0
  53. package/dist/lib/snapshot.js +183 -0
  54. package/dist/lib/snapshot.js.map +1 -0
  55. package/dist/next/client.d.ts +27 -0
  56. package/dist/next/client.d.ts.map +1 -0
  57. package/dist/next/client.js +275 -0
  58. package/dist/next/client.js.map +1 -0
  59. package/dist/next/createDevPage.d.ts +37 -0
  60. package/dist/next/createDevPage.d.ts.map +1 -0
  61. package/dist/next/createDevPage.js +287 -0
  62. package/dist/next/createDevPage.js.map +1 -0
  63. package/dist/next/pageStyles.d.ts +5 -0
  64. package/dist/next/pageStyles.d.ts.map +1 -0
  65. package/dist/next/pageStyles.js +83 -0
  66. package/dist/next/pageStyles.js.map +1 -0
  67. package/dist/next/specimen.d.ts +24 -0
  68. package/dist/next/specimen.d.ts.map +1 -0
  69. package/dist/next/specimen.js +48 -0
  70. package/dist/next/specimen.js.map +1 -0
  71. package/dist/next/views.d.ts +31 -0
  72. package/dist/next/views.d.ts.map +1 -0
  73. package/dist/next/views.js +431 -0
  74. package/dist/next/views.js.map +1 -0
  75. package/dist/next.d.ts +5 -0
  76. package/dist/next.d.ts.map +1 -0
  77. package/dist/next.js +6 -0
  78. package/dist/next.js.map +1 -0
  79. package/dist/options.d.ts +17 -0
  80. package/dist/options.d.ts.map +1 -0
  81. package/dist/options.js +3 -0
  82. package/dist/options.js.map +1 -0
  83. package/dist/plugin.d.ts +20 -0
  84. package/dist/plugin.d.ts.map +1 -0
  85. package/dist/plugin.js +51 -0
  86. package/dist/plugin.js.map +1 -0
  87. package/dist/toolbar.d.ts +8 -0
  88. package/dist/toolbar.d.ts.map +1 -0
  89. package/dist/toolbar.js +8 -0
  90. package/dist/toolbar.js.map +1 -0
  91. package/package.json +77 -0
package/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Pro Laico LLC <contact@prolaico.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # @pro-laico/payload-dev-tools
2
+
3
+ A utility to help you build [Payload CMS](https://payloadcms.com/) projects faster: a floating dev toolbar, `/dev` pages inside your app, and a machine-readable app snapshot for AI agents. Dev-only, disappears in production.
4
+
5
+ ```bash
6
+ pnpm add @pro-laico/payload-dev-tools
7
+ ```
8
+
9
+ **[Documentation →](https://payload-plugins.prolaico.com/docs/plugins/payload-dev-tools)**
@@ -0,0 +1,27 @@
1
+ import { type Test } from '../harness';
2
+ import { type DevLink } from './DevToolbarClient';
3
+ export type DevToolbarProps = {
4
+ /** Component tests (from `defineTest`) — the Tests view opens each test's page
5
+ * (`/dev/tests/<key>`) and toggles which version it shows. Render fns stay server-side; the
6
+ * client only sees labels. */
7
+ tests?: Test[];
8
+ /** Extra rows for the Pages view (your own labs, external dashboards…) — the dev pages and the
9
+ * admin are built in. */
10
+ links?: DevLink[];
11
+ /** Force the toolbar on/off. Defaults to `NODE_ENV === 'development'` — it renders nothing in
12
+ * production, so no conditional is needed at the call site. */
13
+ enabled?: boolean;
14
+ };
15
+ /**
16
+ * The floating dev toolbar — the one controller for the dev experience, one line of wiring:
17
+ *
18
+ * <DevToolbar /> // in your (frontend) layout, inside <body>
19
+ * <DevToolbar tests={[heroTest]} /> // optionally, with the test harness
20
+ *
21
+ * It injects its own stylesheet (no Tailwind, no CSS import) and feeds itself from
22
+ * `GET /api/dev`. Because it lives in the layout, the panel survives client-side navigation —
23
+ * browse `/dev` → icons → fonts → tests without it closing. The dev pages themselves render
24
+ * content only; navigation and version-switching live here.
25
+ */
26
+ export declare function DevToolbar({ tests, links, enabled }: DevToolbarProps): import("react").JSX.Element | null;
27
+ //# sourceMappingURL=DevToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevToolbar.d.ts","sourceRoot":"","sources":["../../src/components/DevToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,YAAY,CAAA;AAClD,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,oBAAoB,CAAA;AAGnE,MAAM,MAAM,eAAe,GAAG;IAC5B;;mCAE+B;IAC/B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;IACd;8BAC0B;IAC1B,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;IACjB;oEACgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAU,EAAE,KAAU,EAAE,OAAO,EAAE,EAAE,eAAe,sCAU9E"}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { toTestMeta } from "../harness.js";
3
+ import { DevToolbarClient } from "./DevToolbarClient.js";
4
+ import { PDT_CSS } from "./styles.js";
5
+ /**
6
+ * The floating dev toolbar — the one controller for the dev experience, one line of wiring:
7
+ *
8
+ * <DevToolbar /> // in your (frontend) layout, inside <body>
9
+ * <DevToolbar tests={[heroTest]} /> // optionally, with the test harness
10
+ *
11
+ * It injects its own stylesheet (no Tailwind, no CSS import) and feeds itself from
12
+ * `GET /api/dev`. Because it lives in the layout, the panel survives client-side navigation —
13
+ * browse `/dev` → icons → fonts → tests without it closing. The dev pages themselves render
14
+ * content only; navigation and version-switching live here.
15
+ */ export function DevToolbar({ tests = [], links = [], enabled }) {
16
+ if (!(enabled ?? process.env.NODE_ENV === 'development')) return null;
17
+ return /*#__PURE__*/ _jsxs(_Fragment, {
18
+ children: [
19
+ /*#__PURE__*/ _jsx("style", {
20
+ dangerouslySetInnerHTML: {
21
+ __html: PDT_CSS
22
+ }
23
+ }),
24
+ /*#__PURE__*/ _jsx(DevToolbarClient, {
25
+ tests: toTestMeta(tests),
26
+ links: links
27
+ })
28
+ ]
29
+ });
30
+ }
31
+
32
+ //# sourceMappingURL=DevToolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/DevToolbar.tsx"],"sourcesContent":["import { type Test, toTestMeta } from '../harness'\nimport { type DevLink, DevToolbarClient } from './DevToolbarClient'\nimport { PDT_CSS } from './styles'\n\nexport type DevToolbarProps = {\n /** Component tests (from `defineTest`) — the Tests view opens each test's page\n * (`/dev/tests/<key>`) and toggles which version it shows. Render fns stay server-side; the\n * client only sees labels. */\n tests?: Test[]\n /** Extra rows for the Pages view (your own labs, external dashboards…) — the dev pages and the\n * admin are built in. */\n links?: DevLink[]\n /** Force the toolbar on/off. Defaults to `NODE_ENV === 'development'` — it renders nothing in\n * production, so no conditional is needed at the call site. */\n enabled?: boolean\n}\n\n/**\n * The floating dev toolbar — the one controller for the dev experience, one line of wiring:\n *\n * <DevToolbar /> // in your (frontend) layout, inside <body>\n * <DevToolbar tests={[heroTest]} /> // optionally, with the test harness\n *\n * It injects its own stylesheet (no Tailwind, no CSS import) and feeds itself from\n * `GET /api/dev`. Because it lives in the layout, the panel survives client-side navigation —\n * browse `/dev` → icons → fonts → tests without it closing. The dev pages themselves render\n * content only; navigation and version-switching live here.\n */\nexport function DevToolbar({ tests = [], links = [], enabled }: DevToolbarProps) {\n if (!(enabled ?? process.env.NODE_ENV === 'development')) return null\n\n return (\n <>\n {/* dangerouslySetInnerHTML: our own static CSS — React would escape selector characters as a text child */}\n <style dangerouslySetInnerHTML={{ __html: PDT_CSS }} />\n <DevToolbarClient tests={toTestMeta(tests)} links={links} />\n </>\n )\n}\n"],"names":["toTestMeta","DevToolbarClient","PDT_CSS","DevToolbar","tests","links","enabled","process","env","NODE_ENV","style","dangerouslySetInnerHTML","__html"],"mappings":";AAAA,SAAoBA,UAAU,QAAQ,gBAAY;AAClD,SAAuBC,gBAAgB,QAAQ,wBAAoB;AACnE,SAASC,OAAO,QAAQ,cAAU;AAelC;;;;;;;;;;CAUC,GACD,OAAO,SAASC,WAAW,EAAEC,QAAQ,EAAE,EAAEC,QAAQ,EAAE,EAAEC,OAAO,EAAmB;IAC7E,IAAI,CAAEA,CAAAA,WAAWC,QAAQC,GAAG,CAACC,QAAQ,KAAK,aAAY,GAAI,OAAO;IAEjE,qBACE;;0BAEE,KAACC;gBAAMC,yBAAyB;oBAAEC,QAAQV;gBAAQ;;0BAClD,KAACD;gBAAiBG,OAAOJ,WAAWI;gBAAQC,OAAOA;;;;AAGzD"}
@@ -0,0 +1,16 @@
1
+ import type { TestMeta } from '../harness';
2
+ export type DevLink = {
3
+ href: string;
4
+ title: string;
5
+ };
6
+ /**
7
+ * The toolbar panel — THE controller for the dev experience. Navigation happens through it (the
8
+ * dev pages render content only, no nav of their own), the panel stays open across route changes
9
+ * (it lives in the layout, and rows are client-side `<Link>`s), and the Tests view both opens a
10
+ * test's page and toggles which version that page shows.
11
+ */
12
+ export declare function DevToolbarClient({ tests, links }: {
13
+ tests: TestMeta[];
14
+ links: DevLink[];
15
+ }): import("react").JSX.Element | null;
16
+ //# sourceMappingURL=DevToolbarClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevToolbarClient.d.ts","sourceRoot":"","sources":["../../src/components/DevToolbarClient.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAG1C,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAiDrD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAAC,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,sCAigBzF"}