@lukas_holdings/castdom 1.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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +707 -0
  3. package/bin/castdom.js +2 -0
  4. package/dist/astro.cjs +86 -0
  5. package/dist/astro.cjs.map +1 -0
  6. package/dist/astro.d.cts +88 -0
  7. package/dist/astro.d.ts +88 -0
  8. package/dist/astro.js +80 -0
  9. package/dist/astro.js.map +1 -0
  10. package/dist/chunk-COLESJ66.js +57 -0
  11. package/dist/chunk-COLESJ66.js.map +1 -0
  12. package/dist/chunk-EJRNKHL5.js +31 -0
  13. package/dist/chunk-EJRNKHL5.js.map +1 -0
  14. package/dist/chunk-JRQ6EVQP.cjs +35 -0
  15. package/dist/chunk-JRQ6EVQP.cjs.map +1 -0
  16. package/dist/chunk-KGLTVTHU.js +73 -0
  17. package/dist/chunk-KGLTVTHU.js.map +1 -0
  18. package/dist/chunk-O4OOMGGM.cjs +198 -0
  19. package/dist/chunk-O4OOMGGM.cjs.map +1 -0
  20. package/dist/chunk-ONS533CQ.js +104 -0
  21. package/dist/chunk-ONS533CQ.js.map +1 -0
  22. package/dist/chunk-ORY4OMZ5.cjs +110 -0
  23. package/dist/chunk-ORY4OMZ5.cjs.map +1 -0
  24. package/dist/chunk-QLEBTZIB.cjs +64 -0
  25. package/dist/chunk-QLEBTZIB.cjs.map +1 -0
  26. package/dist/chunk-XS5HAU5E.cjs +109 -0
  27. package/dist/chunk-XS5HAU5E.cjs.map +1 -0
  28. package/dist/chunk-YDT4TPB7.cjs +84 -0
  29. package/dist/chunk-YDT4TPB7.cjs.map +1 -0
  30. package/dist/chunk-ZBJB7WVV.js +193 -0
  31. package/dist/chunk-ZBJB7WVV.js.map +1 -0
  32. package/dist/chunk-ZWZ5ZLJE.js +103 -0
  33. package/dist/chunk-ZWZ5ZLJE.js.map +1 -0
  34. package/dist/cli.js +135 -0
  35. package/dist/index.cjs +540 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.cts +176 -0
  38. package/dist/index.d.ts +176 -0
  39. package/dist/index.js +440 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/next.cjs +65 -0
  42. package/dist/next.cjs.map +1 -0
  43. package/dist/next.d.cts +72 -0
  44. package/dist/next.d.ts +72 -0
  45. package/dist/next.js +48 -0
  46. package/dist/next.js.map +1 -0
  47. package/dist/react.cjs +30 -0
  48. package/dist/react.cjs.map +1 -0
  49. package/dist/react.d.cts +70 -0
  50. package/dist/react.d.ts +70 -0
  51. package/dist/react.js +7 -0
  52. package/dist/react.js.map +1 -0
  53. package/dist/renderer-B1R7u2wm.d.ts +30 -0
  54. package/dist/renderer-Bfzjr6l9.d.cts +30 -0
  55. package/dist/ssr.cjs +46 -0
  56. package/dist/ssr.cjs.map +1 -0
  57. package/dist/ssr.d.cts +83 -0
  58. package/dist/ssr.d.ts +83 -0
  59. package/dist/ssr.js +5 -0
  60. package/dist/ssr.js.map +1 -0
  61. package/dist/types-ChD5jENU.d.cts +105 -0
  62. package/dist/types-ChD5jENU.d.ts +105 -0
  63. package/dist/vite.cjs +83 -0
  64. package/dist/vite.cjs.map +1 -0
  65. package/dist/vite.d.cts +81 -0
  66. package/dist/vite.d.ts +81 -0
  67. package/dist/vite.js +77 -0
  68. package/dist/vite.js.map +1 -0
  69. package/package.json +130 -0
package/dist/next.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import { C as CastDOMConfig, S as SkeletonData } from './types-ChD5jENU.js';
2
+ export { CastDOM, CastDOMStyle, useCastDOM } from './react.js';
3
+ import 'react';
4
+
5
+ /**
6
+ * Initialize CastDOM in a Next.js app.
7
+ * Call once in _app.tsx or layout.tsx.
8
+ */
9
+ declare function initCastDOM(manifest: {
10
+ skeletons: SkeletonData[];
11
+ }): void;
12
+ /**
13
+ * Server-side helper for getServerSideProps / getStaticProps.
14
+ * Returns skeleton HTML that can be passed as props.
15
+ *
16
+ * ```ts
17
+ * export async function getServerSideProps() {
18
+ * const { skeletonHTML, skeletonCSS } = getSkeletonProps(["user-card", "feed-item"]);
19
+ * return { props: { skeletonHTML, skeletonCSS } };
20
+ * }
21
+ * ```
22
+ */
23
+ declare function getSkeletonProps(names: string[], config?: Partial<CastDOMConfig>): {
24
+ skeletonHTML: Record<string, string>;
25
+ skeletonCSS: string;
26
+ };
27
+ /**
28
+ * Next.js App Router metadata helper.
29
+ * Generates <head> tags for skeleton critical CSS.
30
+ *
31
+ * ```tsx
32
+ * // app/layout.tsx
33
+ * import { generateCastDOMMetadata } from "castdom/next";
34
+ *
35
+ * export const metadata = generateCastDOMMetadata(["user-card"]);
36
+ * ```
37
+ */
38
+ declare function generateCastDOMHead(skeletonNames: string[], config?: Partial<CastDOMConfig>): string;
39
+ /**
40
+ * Next.js middleware helper — injects skeleton HTML into streaming responses.
41
+ * Use this for automatic skeleton injection without modifying page components.
42
+ *
43
+ * ```ts
44
+ * // middleware.ts
45
+ * import { withCastDOM } from "castdom/next";
46
+ *
47
+ * export default withCastDOM({
48
+ * skeletons: { "/dashboard": "dashboard-skeleton" },
49
+ * });
50
+ * ```
51
+ */
52
+ interface CastDOMMiddlewareConfig {
53
+ /** Map of route patterns to skeleton names */
54
+ skeletons: Record<string, string | string[]>;
55
+ /** Config overrides */
56
+ config?: Partial<CastDOMConfig>;
57
+ }
58
+ /**
59
+ * Create a Next.js config plugin that adds CastDOM webpack config.
60
+ *
61
+ * ```js
62
+ * // next.config.js
63
+ * const { withCastDOMConfig } = require("castdom/next");
64
+ *
65
+ * module.exports = withCastDOMConfig({
66
+ * // your next.js config
67
+ * });
68
+ * ```
69
+ */
70
+ declare function withCastDOMConfig(nextConfig?: Record<string, unknown>): Record<string, unknown>;
71
+
72
+ export { type CastDOMMiddlewareConfig, generateCastDOMHead, getSkeletonProps, initCastDOM, withCastDOMConfig };
package/dist/next.js ADDED
@@ -0,0 +1,48 @@
1
+ export { CastDOM, CastDOMStyle, useCastDOM } from './chunk-ZBJB7WVV.js';
2
+ import './chunk-ONS533CQ.js';
3
+ import { loadManifest, get } from './chunk-KGLTVTHU.js';
4
+ import { renderSkeleton, renderCriticalStyleTag, renderHydrationScript } from './chunk-COLESJ66.js';
5
+ import { generateCriticalCSS } from './chunk-ZWZ5ZLJE.js';
6
+ import './chunk-EJRNKHL5.js';
7
+
8
+ // src/adapters/nextjs.ts
9
+ function initCastDOM(manifest) {
10
+ loadManifest(manifest);
11
+ }
12
+ function getSkeletonProps(names, config) {
13
+ const skeletonHTML = {};
14
+ const skeletons = [];
15
+ for (const name of names) {
16
+ const entry = get(name);
17
+ if (entry) {
18
+ skeletonHTML[name] = renderSkeleton(entry.data, { config });
19
+ skeletons.push(entry.data);
20
+ }
21
+ }
22
+ return {
23
+ skeletonHTML,
24
+ skeletonCSS: generateCriticalCSS(skeletons, config)
25
+ };
26
+ }
27
+ function generateCastDOMHead(skeletonNames, config) {
28
+ const skeletons = [];
29
+ for (const name of skeletonNames) {
30
+ const entry = get(name);
31
+ if (entry) skeletons.push(entry.data);
32
+ }
33
+ if (skeletons.length === 0) return "";
34
+ return [renderCriticalStyleTag(skeletons, config), renderHydrationScript()].join("\n");
35
+ }
36
+ function withCastDOMConfig(nextConfig = {}) {
37
+ return {
38
+ ...nextConfig,
39
+ webpack(config, options) {
40
+ const existingWebpack = typeof nextConfig.webpack === "function" ? nextConfig.webpack(config, options) : config;
41
+ return existingWebpack;
42
+ }
43
+ };
44
+ }
45
+
46
+ export { generateCastDOMHead, getSkeletonProps, initCastDOM, withCastDOMConfig };
47
+ //# sourceMappingURL=next.js.map
48
+ //# sourceMappingURL=next.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/nextjs.ts"],"names":[],"mappings":";;;;;;;;AA8CO,SAAS,YAAY,QAAA,EAA+C;AACzE,EAAA,YAAA,CAAa,QAAQ,CAAA;AACvB;AAaO,SAAS,gBAAA,CACd,OACA,MAAA,EAC+D;AAC/D,EAAA,MAAM,eAAuC,EAAC;AAC9C,EAAA,MAAM,YAA4B,EAAC;AAEnC,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,MAAM,KAAA,GAAQ,IAAgB,IAAI,CAAA;AAClC,IAAA,IAAI,KAAA,EAAO;AACT,MAAA,YAAA,CAAa,IAAI,CAAA,GAAI,cAAA,CAAe,MAAM,IAAA,EAAM,EAAE,QAAQ,CAAA;AAC1D,MAAA,SAAA,CAAU,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,IAC3B;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,YAAA;AAAA,IACA,WAAA,EAAa,mBAAA,CAAoB,SAAA,EAAW,MAAM;AAAA,GACpD;AACF;AAaO,SAAS,mBAAA,CACd,eACA,MAAA,EACQ;AACR,EAAA,MAAM,YAA4B,EAAC;AAEnC,EAAA,KAAA,MAAW,QAAQ,aAAA,EAAe;AAChC,IAAA,MAAM,KAAA,GAAQ,IAAgB,IAAI,CAAA;AAClC,IAAA,IAAI,KAAA,EAAO,SAAA,CAAU,IAAA,CAAK,KAAA,CAAM,IAAI,CAAA;AAAA,EACtC;AAEA,EAAA,IAAI,SAAA,CAAU,MAAA,KAAW,CAAA,EAAG,OAAO,EAAA;AAEnC,EAAA,OAAO,CAAC,uBAAuB,SAAA,EAAW,MAAM,GAAG,qBAAA,EAAuB,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AACvF;AAkCO,SAAS,iBAAA,CAAkB,UAAA,GAAsC,EAAC,EAA4B;AACnG,EAAA,OAAO;AAAA,IACL,GAAG,UAAA;AAAA,IACH,OAAA,CAAQ,QAAiC,OAAA,EAAkC;AAEzE,MAAA,MAAM,eAAA,GACJ,OAAO,UAAA,CAAW,OAAA,KAAY,aACzB,UAAA,CAAW,OAAA,CAAqB,MAAA,EAAQ,OAAO,CAAA,GAChD,MAAA;AAEN,MAAA,OAAO,eAAA;AAAA,IACT;AAAA,GACF;AACF","file":"next.js","sourcesContent":["import type { SkeletonData, CastDOMConfig } from \"../core/types.js\";\nimport { renderSkeleton, renderCriticalStyleTag, renderHydrationScript } from \"../seo/ssr.js\";\nimport { register, loadManifest, get as getFromRegistry } from \"../core/registry.js\";\nimport { generateCriticalCSS } from \"../core/renderer.js\";\n\n/**\n * Next.js adapter for CastDOM.\n *\n * Supports:\n * - App Router (React Server Components)\n * - Pages Router (getServerSideProps / getStaticProps)\n * - Automatic loading.tsx generation\n * - Middleware-based skeleton injection\n *\n * Usage (App Router):\n * ```tsx\n * // app/layout.tsx\n * import { CastDOMProvider } from \"castdom/next\";\n * import manifest from \".castdom/manifest.json\";\n *\n * export default function RootLayout({ children }) {\n * return (\n * <CastDOMProvider manifest={manifest}>\n * {children}\n * </CastDOMProvider>\n * );\n * }\n * ```\n *\n * Usage (Pages Router):\n * ```tsx\n * // pages/_app.tsx\n * import { initCastDOM } from \"castdom/next\";\n * import manifest from \".castdom/manifest.json\";\n *\n * initCastDOM(manifest);\n * ```\n */\n\n// Re-export React components for convenience\nexport { CastDOM, CastDOMStyle, useCastDOM } from \"../components/react.js\";\n\n/**\n * Initialize CastDOM in a Next.js app.\n * Call once in _app.tsx or layout.tsx.\n */\nexport function initCastDOM(manifest: { skeletons: SkeletonData[] }): void {\n loadManifest(manifest);\n}\n\n/**\n * Server-side helper for getServerSideProps / getStaticProps.\n * Returns skeleton HTML that can be passed as props.\n *\n * ```ts\n * export async function getServerSideProps() {\n * const { skeletonHTML, skeletonCSS } = getSkeletonProps([\"user-card\", \"feed-item\"]);\n * return { props: { skeletonHTML, skeletonCSS } };\n * }\n * ```\n */\nexport function getSkeletonProps(\n names: string[],\n config?: Partial<CastDOMConfig>\n): { skeletonHTML: Record<string, string>; skeletonCSS: string } {\n const skeletonHTML: Record<string, string> = {};\n const skeletons: SkeletonData[] = [];\n\n for (const name of names) {\n const entry = getFromRegistry(name);\n if (entry) {\n skeletonHTML[name] = renderSkeleton(entry.data, { config });\n skeletons.push(entry.data);\n }\n }\n\n return {\n skeletonHTML,\n skeletonCSS: generateCriticalCSS(skeletons, config),\n };\n}\n\n/**\n * Next.js App Router metadata helper.\n * Generates <head> tags for skeleton critical CSS.\n *\n * ```tsx\n * // app/layout.tsx\n * import { generateCastDOMMetadata } from \"castdom/next\";\n *\n * export const metadata = generateCastDOMMetadata([\"user-card\"]);\n * ```\n */\nexport function generateCastDOMHead(\n skeletonNames: string[],\n config?: Partial<CastDOMConfig>\n): string {\n const skeletons: SkeletonData[] = [];\n\n for (const name of skeletonNames) {\n const entry = getFromRegistry(name);\n if (entry) skeletons.push(entry.data);\n }\n\n if (skeletons.length === 0) return \"\";\n\n return [renderCriticalStyleTag(skeletons, config), renderHydrationScript()].join(\"\\n\");\n}\n\n/**\n * Next.js middleware helper — injects skeleton HTML into streaming responses.\n * Use this for automatic skeleton injection without modifying page components.\n *\n * ```ts\n * // middleware.ts\n * import { withCastDOM } from \"castdom/next\";\n *\n * export default withCastDOM({\n * skeletons: { \"/dashboard\": \"dashboard-skeleton\" },\n * });\n * ```\n */\nexport interface CastDOMMiddlewareConfig {\n /** Map of route patterns to skeleton names */\n skeletons: Record<string, string | string[]>;\n /** Config overrides */\n config?: Partial<CastDOMConfig>;\n}\n\n/**\n * Create a Next.js config plugin that adds CastDOM webpack config.\n *\n * ```js\n * // next.config.js\n * const { withCastDOMConfig } = require(\"castdom/next\");\n *\n * module.exports = withCastDOMConfig({\n * // your next.js config\n * });\n * ```\n */\nexport function withCastDOMConfig(nextConfig: Record<string, unknown> = {}): Record<string, unknown> {\n return {\n ...nextConfig,\n webpack(config: Record<string, unknown>, options: Record<string, unknown>) {\n // Add .castdom to module resolution\n const existingWebpack =\n typeof nextConfig.webpack === \"function\"\n ? (nextConfig.webpack as Function)(config, options)\n : config;\n\n return existingWebpack;\n },\n };\n}\n"]}
package/dist/react.cjs ADDED
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var chunkO4OOMGGM_cjs = require('./chunk-O4OOMGGM.cjs');
6
+ require('./chunk-ORY4OMZ5.cjs');
7
+ require('./chunk-YDT4TPB7.cjs');
8
+ require('./chunk-XS5HAU5E.cjs');
9
+ require('./chunk-JRQ6EVQP.cjs');
10
+
11
+
12
+
13
+ Object.defineProperty(exports, "CastDOM", {
14
+ enumerable: true,
15
+ get: function () { return chunkO4OOMGGM_cjs.CastDOM; }
16
+ });
17
+ Object.defineProperty(exports, "CastDOMStyle", {
18
+ enumerable: true,
19
+ get: function () { return chunkO4OOMGGM_cjs.CastDOMStyle; }
20
+ });
21
+ Object.defineProperty(exports, "default", {
22
+ enumerable: true,
23
+ get: function () { return chunkO4OOMGGM_cjs.react_default; }
24
+ });
25
+ Object.defineProperty(exports, "useCastDOM", {
26
+ enumerable: true,
27
+ get: function () { return chunkO4OOMGGM_cjs.useCastDOM; }
28
+ });
29
+ //# sourceMappingURL=react.cjs.map
30
+ //# sourceMappingURL=react.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"react.cjs"}
@@ -0,0 +1,70 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ import { S as SkeletonData, B as BreakpointData } from './types-ChD5jENU.cjs';
3
+
4
+ interface CastDOMProps {
5
+ /** Name of the registered skeleton */
6
+ name: string;
7
+ /** Children to render once loaded */
8
+ children: ReactNode;
9
+ /** Whether the content is still loading (default: false when children mount) */
10
+ loading?: boolean;
11
+ /** Custom fallback while skeleton data loads from registry */
12
+ fallback?: ReactNode;
13
+ /** Animation type override */
14
+ animation?: "shimmer" | "pulse" | "wave" | "none";
15
+ /** Base color override */
16
+ color?: string;
17
+ /** Shimmer highlight color override */
18
+ shimmerColor?: string;
19
+ /** Animation duration override (ms) */
20
+ duration?: number;
21
+ /** Additional CSS class */
22
+ className?: string;
23
+ /** Additional inline styles */
24
+ style?: CSSProperties;
25
+ /** Callback when skeleton is shown */
26
+ onSkeletonShow?: () => void;
27
+ /** Callback when real content replaces skeleton */
28
+ onContentShow?: () => void;
29
+ /** Aria label for the loading state */
30
+ ariaLabel?: string;
31
+ }
32
+ /**
33
+ * <CastDOM> — wraps your component and shows an extracted skeleton while loading.
34
+ *
35
+ * Usage:
36
+ * ```tsx
37
+ * <CastDOM name="user-card" loading={isLoading}>
38
+ * <UserCard data={data} />
39
+ * </CastDOM>
40
+ * ```
41
+ *
42
+ * The skeleton auto-resolves from the global registry.
43
+ * Register skeletons once at app entry with `loadManifest()`.
44
+ */
45
+ declare function CastDOM({ name, children, loading, fallback, animation, color, shimmerColor, duration, className, style, onSkeletonShow, onContentShow, ariaLabel, }: CastDOMProps): ReactNode;
46
+ /**
47
+ * <CastDOMStyle> — renders the critical CSS for registered skeletons.
48
+ * Place this in your <head> or layout for optimal performance.
49
+ *
50
+ * ```tsx
51
+ * <head>
52
+ * <CastDOMStyle skeletons={["user-card", "feed-item"]} />
53
+ * </head>
54
+ * ```
55
+ */
56
+ declare function CastDOMStyle({ skeletons, }: {
57
+ skeletons?: string[];
58
+ }): ReactNode;
59
+ /**
60
+ * Hook: useCastDOM — programmatic access to skeleton data.
61
+ */
62
+ declare function useCastDOM(name: string): {
63
+ exists: boolean;
64
+ data: SkeletonData | null;
65
+ breakpoint: BreakpointData | null;
66
+ css: string;
67
+ html: string;
68
+ };
69
+
70
+ export { CastDOM, type CastDOMProps, CastDOMStyle, CastDOM as default, useCastDOM };
@@ -0,0 +1,70 @@
1
+ import { ReactNode, CSSProperties } from 'react';
2
+ import { S as SkeletonData, B as BreakpointData } from './types-ChD5jENU.js';
3
+
4
+ interface CastDOMProps {
5
+ /** Name of the registered skeleton */
6
+ name: string;
7
+ /** Children to render once loaded */
8
+ children: ReactNode;
9
+ /** Whether the content is still loading (default: false when children mount) */
10
+ loading?: boolean;
11
+ /** Custom fallback while skeleton data loads from registry */
12
+ fallback?: ReactNode;
13
+ /** Animation type override */
14
+ animation?: "shimmer" | "pulse" | "wave" | "none";
15
+ /** Base color override */
16
+ color?: string;
17
+ /** Shimmer highlight color override */
18
+ shimmerColor?: string;
19
+ /** Animation duration override (ms) */
20
+ duration?: number;
21
+ /** Additional CSS class */
22
+ className?: string;
23
+ /** Additional inline styles */
24
+ style?: CSSProperties;
25
+ /** Callback when skeleton is shown */
26
+ onSkeletonShow?: () => void;
27
+ /** Callback when real content replaces skeleton */
28
+ onContentShow?: () => void;
29
+ /** Aria label for the loading state */
30
+ ariaLabel?: string;
31
+ }
32
+ /**
33
+ * <CastDOM> — wraps your component and shows an extracted skeleton while loading.
34
+ *
35
+ * Usage:
36
+ * ```tsx
37
+ * <CastDOM name="user-card" loading={isLoading}>
38
+ * <UserCard data={data} />
39
+ * </CastDOM>
40
+ * ```
41
+ *
42
+ * The skeleton auto-resolves from the global registry.
43
+ * Register skeletons once at app entry with `loadManifest()`.
44
+ */
45
+ declare function CastDOM({ name, children, loading, fallback, animation, color, shimmerColor, duration, className, style, onSkeletonShow, onContentShow, ariaLabel, }: CastDOMProps): ReactNode;
46
+ /**
47
+ * <CastDOMStyle> — renders the critical CSS for registered skeletons.
48
+ * Place this in your <head> or layout for optimal performance.
49
+ *
50
+ * ```tsx
51
+ * <head>
52
+ * <CastDOMStyle skeletons={["user-card", "feed-item"]} />
53
+ * </head>
54
+ * ```
55
+ */
56
+ declare function CastDOMStyle({ skeletons, }: {
57
+ skeletons?: string[];
58
+ }): ReactNode;
59
+ /**
60
+ * Hook: useCastDOM — programmatic access to skeleton data.
61
+ */
62
+ declare function useCastDOM(name: string): {
63
+ exists: boolean;
64
+ data: SkeletonData | null;
65
+ breakpoint: BreakpointData | null;
66
+ css: string;
67
+ html: string;
68
+ };
69
+
70
+ export { CastDOM, type CastDOMProps, CastDOMStyle, CastDOM as default, useCastDOM };
package/dist/react.js ADDED
@@ -0,0 +1,7 @@
1
+ export { CastDOM, CastDOMStyle, react_default as default, useCastDOM } from './chunk-ZBJB7WVV.js';
2
+ import './chunk-ONS533CQ.js';
3
+ import './chunk-KGLTVTHU.js';
4
+ import './chunk-ZWZ5ZLJE.js';
5
+ import './chunk-EJRNKHL5.js';
6
+ //# sourceMappingURL=react.js.map
7
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"react.js"}
@@ -0,0 +1,30 @@
1
+ import { S as SkeletonData, C as CastDOMConfig, B as BreakpointData } from './types-ChD5jENU.js';
2
+
3
+ /**
4
+ * Render all bones for a breakpoint to HTML.
5
+ * The output is a pure CSS skeleton — no JS needed to display.
6
+ */
7
+ declare function renderBonesHTML(name: string, bp: BreakpointData, config?: Partial<CastDOMConfig>): string;
8
+ /**
9
+ * Render a responsive skeleton with all breakpoints.
10
+ * Uses CSS container queries + media queries for breakpoint switching.
11
+ */
12
+ declare function renderResponsiveHTML(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
13
+ /**
14
+ * Generate CSS for a skeleton definition.
15
+ * Includes responsive media queries to show/hide the correct breakpoint variant.
16
+ */
17
+ declare function generateCSS(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
18
+ /**
19
+ * Generate critical inline CSS for above-the-fold skeletons.
20
+ * This CSS is designed to be embedded in <style> tags for instant rendering.
21
+ */
22
+ declare function generateCriticalCSS(skeletons: SkeletonData[], config?: Partial<CastDOMConfig>): string;
23
+ /**
24
+ * Generate a complete, self-contained HTML skeleton
25
+ * that can be embedded directly in server-rendered pages.
26
+ * Includes inline <style> — no external CSS needed.
27
+ */
28
+ declare function renderStandalone(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
29
+
30
+ export { generateCriticalCSS as a, renderResponsiveHTML as b, renderStandalone as c, generateCSS as g, renderBonesHTML as r };
@@ -0,0 +1,30 @@
1
+ import { S as SkeletonData, C as CastDOMConfig, B as BreakpointData } from './types-ChD5jENU.cjs';
2
+
3
+ /**
4
+ * Render all bones for a breakpoint to HTML.
5
+ * The output is a pure CSS skeleton — no JS needed to display.
6
+ */
7
+ declare function renderBonesHTML(name: string, bp: BreakpointData, config?: Partial<CastDOMConfig>): string;
8
+ /**
9
+ * Render a responsive skeleton with all breakpoints.
10
+ * Uses CSS container queries + media queries for breakpoint switching.
11
+ */
12
+ declare function renderResponsiveHTML(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
13
+ /**
14
+ * Generate CSS for a skeleton definition.
15
+ * Includes responsive media queries to show/hide the correct breakpoint variant.
16
+ */
17
+ declare function generateCSS(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
18
+ /**
19
+ * Generate critical inline CSS for above-the-fold skeletons.
20
+ * This CSS is designed to be embedded in <style> tags for instant rendering.
21
+ */
22
+ declare function generateCriticalCSS(skeletons: SkeletonData[], config?: Partial<CastDOMConfig>): string;
23
+ /**
24
+ * Generate a complete, self-contained HTML skeleton
25
+ * that can be embedded directly in server-rendered pages.
26
+ * Includes inline <style> — no external CSS needed.
27
+ */
28
+ declare function renderStandalone(skeleton: SkeletonData, config?: Partial<CastDOMConfig>): string;
29
+
30
+ export { generateCriticalCSS as a, renderResponsiveHTML as b, renderStandalone as c, generateCSS as g, renderBonesHTML as r };
package/dist/ssr.cjs ADDED
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ var chunkQLEBTZIB_cjs = require('./chunk-QLEBTZIB.cjs');
4
+ var chunkXS5HAU5E_cjs = require('./chunk-XS5HAU5E.cjs');
5
+ require('./chunk-JRQ6EVQP.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "renderCriticalStyleTag", {
10
+ enumerable: true,
11
+ get: function () { return chunkQLEBTZIB_cjs.renderCriticalStyleTag; }
12
+ });
13
+ Object.defineProperty(exports, "renderHydrationScript", {
14
+ enumerable: true,
15
+ get: function () { return chunkQLEBTZIB_cjs.renderHydrationScript; }
16
+ });
17
+ Object.defineProperty(exports, "renderPreloadHints", {
18
+ enumerable: true,
19
+ get: function () { return chunkQLEBTZIB_cjs.renderPreloadHints; }
20
+ });
21
+ Object.defineProperty(exports, "renderSSRFragment", {
22
+ enumerable: true,
23
+ get: function () { return chunkQLEBTZIB_cjs.renderSSRFragment; }
24
+ });
25
+ Object.defineProperty(exports, "renderSkeleton", {
26
+ enumerable: true,
27
+ get: function () { return chunkQLEBTZIB_cjs.renderSkeleton; }
28
+ });
29
+ Object.defineProperty(exports, "renderSkeletons", {
30
+ enumerable: true,
31
+ get: function () { return chunkQLEBTZIB_cjs.renderSkeletons; }
32
+ });
33
+ Object.defineProperty(exports, "generateCriticalCSS", {
34
+ enumerable: true,
35
+ get: function () { return chunkXS5HAU5E_cjs.generateCriticalCSS; }
36
+ });
37
+ Object.defineProperty(exports, "renderResponsiveHTML", {
38
+ enumerable: true,
39
+ get: function () { return chunkXS5HAU5E_cjs.renderResponsiveHTML; }
40
+ });
41
+ Object.defineProperty(exports, "renderStandalone", {
42
+ enumerable: true,
43
+ get: function () { return chunkXS5HAU5E_cjs.renderStandalone; }
44
+ });
45
+ //# sourceMappingURL=ssr.cjs.map
46
+ //# sourceMappingURL=ssr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ssr.cjs"}
package/dist/ssr.d.cts ADDED
@@ -0,0 +1,83 @@
1
+ import { C as CastDOMConfig, S as SkeletonData } from './types-ChD5jENU.cjs';
2
+ export { a as generateCriticalCSS, b as renderResponsiveHTML, c as renderStandalone } from './renderer-Bfzjr6l9.cjs';
3
+
4
+ /**
5
+ * SSR (Server-Side Rendering) utilities for CastDOM.
6
+ *
7
+ * These functions generate HTML that can be embedded directly in
8
+ * server-rendered pages. The skeletons render as pure CSS —
9
+ * no JavaScript is needed on the client to display them.
10
+ *
11
+ * Benefits for SEO:
12
+ * - Crawlers see structured placeholder content instead of blank areas
13
+ * - Zero CLS (Cumulative Layout Shift) — skeletons match exact dimensions
14
+ * - Instant visual feedback — no FOUC (Flash of Unstyled Content)
15
+ * - Proper ARIA attributes for accessibility
16
+ */
17
+ interface SSRRenderOptions {
18
+ /** Include <style> tag with critical CSS (default: true) */
19
+ inlineCSS?: boolean;
20
+ /** Wrap in a <noscript> fallback (default: false) */
21
+ noscript?: boolean;
22
+ /** Add data attributes for hydration (default: true) */
23
+ hydrationAttrs?: boolean;
24
+ /** Custom config overrides */
25
+ config?: Partial<CastDOMConfig>;
26
+ }
27
+ /**
28
+ * Render a skeleton to an HTML string for SSR.
29
+ * Includes inline critical CSS for immediate rendering.
30
+ *
31
+ * ```ts
32
+ * // In your server handler / getServerSideProps / loader:
33
+ * import { renderSkeleton } from 'castdom/ssr';
34
+ *
35
+ * const skeletonHTML = renderSkeleton(skeletonData);
36
+ * // Embed in your page HTML
37
+ * ```
38
+ */
39
+ declare function renderSkeleton(skeleton: SkeletonData, options?: SSRRenderOptions): string;
40
+ /**
41
+ * Render multiple skeletons with shared CSS (deduplicates the critical CSS).
42
+ *
43
+ * More efficient than calling renderSkeleton() multiple times
44
+ * when you have several skeletons on one page.
45
+ */
46
+ declare function renderSkeletons(skeletons: SkeletonData[], options?: SSRRenderOptions): {
47
+ css: string;
48
+ html: Record<string, string>;
49
+ };
50
+ /**
51
+ * Generate a <style> tag with critical CSS for given skeletons.
52
+ * Place in <head> for optimal rendering performance.
53
+ */
54
+ declare function renderCriticalStyleTag(skeletons: SkeletonData[], config?: Partial<CastDOMConfig>): string;
55
+ /**
56
+ * Generate a hydration script that removes SSR skeletons
57
+ * once the client-side app takes over.
58
+ *
59
+ * This is a tiny (~200 byte) inline script that:
60
+ * 1. Waits for DOMContentLoaded
61
+ * 2. Finds all [data-castdom-ssr] elements
62
+ * 3. Removes them once the real content renders
63
+ *
64
+ * The script is safe to inline — no external dependencies.
65
+ */
66
+ declare function renderHydrationScript(): string;
67
+ /**
68
+ * Generate a complete SSR skeleton page fragment.
69
+ * Includes: critical CSS + skeleton HTML + hydration script.
70
+ *
71
+ * Designed to be dropped directly into your HTML template.
72
+ */
73
+ declare function renderSSRFragment(skeletons: SkeletonData[], options?: SSRRenderOptions): {
74
+ head: string;
75
+ body: Record<string, string>;
76
+ };
77
+ /**
78
+ * Preload hint generator for skeleton assets.
79
+ * Generates <link> tags for optimal loading.
80
+ */
81
+ declare function renderPreloadHints(): string;
82
+
83
+ export { type SSRRenderOptions, renderCriticalStyleTag, renderHydrationScript, renderPreloadHints, renderSSRFragment, renderSkeleton, renderSkeletons };
package/dist/ssr.d.ts ADDED
@@ -0,0 +1,83 @@
1
+ import { C as CastDOMConfig, S as SkeletonData } from './types-ChD5jENU.js';
2
+ export { a as generateCriticalCSS, b as renderResponsiveHTML, c as renderStandalone } from './renderer-B1R7u2wm.js';
3
+
4
+ /**
5
+ * SSR (Server-Side Rendering) utilities for CastDOM.
6
+ *
7
+ * These functions generate HTML that can be embedded directly in
8
+ * server-rendered pages. The skeletons render as pure CSS —
9
+ * no JavaScript is needed on the client to display them.
10
+ *
11
+ * Benefits for SEO:
12
+ * - Crawlers see structured placeholder content instead of blank areas
13
+ * - Zero CLS (Cumulative Layout Shift) — skeletons match exact dimensions
14
+ * - Instant visual feedback — no FOUC (Flash of Unstyled Content)
15
+ * - Proper ARIA attributes for accessibility
16
+ */
17
+ interface SSRRenderOptions {
18
+ /** Include <style> tag with critical CSS (default: true) */
19
+ inlineCSS?: boolean;
20
+ /** Wrap in a <noscript> fallback (default: false) */
21
+ noscript?: boolean;
22
+ /** Add data attributes for hydration (default: true) */
23
+ hydrationAttrs?: boolean;
24
+ /** Custom config overrides */
25
+ config?: Partial<CastDOMConfig>;
26
+ }
27
+ /**
28
+ * Render a skeleton to an HTML string for SSR.
29
+ * Includes inline critical CSS for immediate rendering.
30
+ *
31
+ * ```ts
32
+ * // In your server handler / getServerSideProps / loader:
33
+ * import { renderSkeleton } from 'castdom/ssr';
34
+ *
35
+ * const skeletonHTML = renderSkeleton(skeletonData);
36
+ * // Embed in your page HTML
37
+ * ```
38
+ */
39
+ declare function renderSkeleton(skeleton: SkeletonData, options?: SSRRenderOptions): string;
40
+ /**
41
+ * Render multiple skeletons with shared CSS (deduplicates the critical CSS).
42
+ *
43
+ * More efficient than calling renderSkeleton() multiple times
44
+ * when you have several skeletons on one page.
45
+ */
46
+ declare function renderSkeletons(skeletons: SkeletonData[], options?: SSRRenderOptions): {
47
+ css: string;
48
+ html: Record<string, string>;
49
+ };
50
+ /**
51
+ * Generate a <style> tag with critical CSS for given skeletons.
52
+ * Place in <head> for optimal rendering performance.
53
+ */
54
+ declare function renderCriticalStyleTag(skeletons: SkeletonData[], config?: Partial<CastDOMConfig>): string;
55
+ /**
56
+ * Generate a hydration script that removes SSR skeletons
57
+ * once the client-side app takes over.
58
+ *
59
+ * This is a tiny (~200 byte) inline script that:
60
+ * 1. Waits for DOMContentLoaded
61
+ * 2. Finds all [data-castdom-ssr] elements
62
+ * 3. Removes them once the real content renders
63
+ *
64
+ * The script is safe to inline — no external dependencies.
65
+ */
66
+ declare function renderHydrationScript(): string;
67
+ /**
68
+ * Generate a complete SSR skeleton page fragment.
69
+ * Includes: critical CSS + skeleton HTML + hydration script.
70
+ *
71
+ * Designed to be dropped directly into your HTML template.
72
+ */
73
+ declare function renderSSRFragment(skeletons: SkeletonData[], options?: SSRRenderOptions): {
74
+ head: string;
75
+ body: Record<string, string>;
76
+ };
77
+ /**
78
+ * Preload hint generator for skeleton assets.
79
+ * Generates <link> tags for optimal loading.
80
+ */
81
+ declare function renderPreloadHints(): string;
82
+
83
+ export { type SSRRenderOptions, renderCriticalStyleTag, renderHydrationScript, renderPreloadHints, renderSSRFragment, renderSkeleton, renderSkeletons };
package/dist/ssr.js ADDED
@@ -0,0 +1,5 @@
1
+ export { renderCriticalStyleTag, renderHydrationScript, renderPreloadHints, renderSSRFragment, renderSkeleton, renderSkeletons } from './chunk-COLESJ66.js';
2
+ export { generateCriticalCSS, renderResponsiveHTML, renderStandalone } from './chunk-ZWZ5ZLJE.js';
3
+ import './chunk-EJRNKHL5.js';
4
+ //# sourceMappingURL=ssr.js.map
5
+ //# sourceMappingURL=ssr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"ssr.js"}