@refrakt-md/eleventy 0.9.4 → 0.9.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.
@@ -0,0 +1,10 @@
1
+ import type { RendererNode } from '@refrakt-md/types';
2
+ /**
3
+ * Check whether a rendered tree contains interactive runes that need
4
+ * client-side behavior initialization.
5
+ *
6
+ * Use to conditionally include the behavior `<script>` tag,
7
+ * shipping zero JS for static-only pages.
8
+ */
9
+ export declare function hasInteractiveRunes(node: RendererNode): boolean;
10
+ //# sourceMappingURL=behaviors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"behaviors.d.ts","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAE/D"}
@@ -0,0 +1,13 @@
1
+ import { hasMatchingRunes } from '@refrakt-md/transform';
2
+ import { getBehaviorNames } from '@refrakt-md/behaviors';
3
+ /**
4
+ * Check whether a rendered tree contains interactive runes that need
5
+ * client-side behavior initialization.
6
+ *
7
+ * Use to conditionally include the behavior `<script>` tag,
8
+ * shipping zero JS for static-only pages.
9
+ */
10
+ export function hasInteractiveRunes(node) {
11
+ return hasMatchingRunes(node, getBehaviorNames());
12
+ }
13
+ //# sourceMappingURL=behaviors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"behaviors.js","sourceRoot":"","sources":["../src/behaviors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAkB;IACrD,OAAO,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACnD,CAAC"}
package/dist/data.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { RunePackage } from '@refrakt-md/types';
1
2
  import type { EleventyTheme } from './types.js';
2
3
  export interface EleventyPageData {
3
4
  url: string;
@@ -10,6 +11,10 @@ export interface EleventyPageData {
10
11
  jsonLd: string;
11
12
  };
12
13
  frontmatter: Record<string, unknown>;
14
+ /** Pre-serialized JSON context for the #rf-context script element */
15
+ contextJson: string;
16
+ /** Whether this page contains interactive runes needing behavior JS */
17
+ hasInteractiveRunes: boolean;
13
18
  }
14
19
  /**
15
20
  * Create a global data function for Eleventy.
@@ -28,6 +33,7 @@ export declare function createDataFile(config: {
28
33
  theme: EleventyTheme;
29
34
  contentDir?: string;
30
35
  basePath?: string;
31
- configPath?: string;
36
+ /** Community rune packages to include in the content pipeline */
37
+ packages?: RunePackage[];
32
38
  }): () => Promise<EleventyPageData[]>;
33
39
  //# sourceMappingURL=data.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACtC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAoDpC"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,mBAAmB,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACtC,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkFpC"}
package/dist/data.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { resolve } from 'node:path';
2
2
  import { renderPage, extractSeoData, seoToHtml } from '@refrakt-md/transform';
3
+ import { hasInteractiveRunes } from './behaviors.js';
3
4
  /**
4
5
  * Create a global data function for Eleventy.
5
6
  *
@@ -18,40 +19,62 @@ export function createDataFile(config) {
18
19
  return async function loadRefrakt() {
19
20
  const { loadContent } = await import('@refrakt-md/content');
20
21
  const absContentDir = resolve(contentDir);
21
- const site = await loadContent(absContentDir, basePath);
22
+ const site = await loadContent(absContentDir, basePath, undefined, // icons
23
+ undefined, // additionalTags
24
+ config.packages);
25
+ // Build the pages list for LayoutPageData and RfContext
26
+ const pagesList = site.pages.map((p) => ({
27
+ url: p.route.url,
28
+ title: p.frontmatter?.title ?? '',
29
+ draft: p.route.draft ?? false,
30
+ description: p.frontmatter?.description,
31
+ date: p.frontmatter?.date,
32
+ author: p.frontmatter?.author,
33
+ tags: p.frontmatter?.tags,
34
+ image: p.frontmatter?.image,
35
+ version: p.frontmatter?.version,
36
+ versionGroup: p.frontmatter?.versionGroup,
37
+ }));
22
38
  return site.pages.map((page) => {
39
+ const url = page.route.url;
40
+ const title = page.frontmatter?.title ?? '';
41
+ // Convert layout regions from Map to Record
42
+ const regions = {};
43
+ if (page.layout?.regions instanceof Map) {
44
+ for (const [name, region] of page.layout.regions) {
45
+ regions[name] = region;
46
+ }
47
+ }
23
48
  const pageData = {
24
49
  renderable: page.renderable,
25
- regions: page.regions ?? {},
26
- title: page.title,
27
- url: page.url,
28
- pages: site.pages.map((p) => ({
29
- url: p.url,
30
- title: p.title,
31
- draft: p.draft ?? false,
32
- description: p.frontmatter?.description,
33
- date: p.frontmatter?.date,
34
- author: p.frontmatter?.author,
35
- tags: p.frontmatter?.tags,
36
- image: p.frontmatter?.image,
37
- })),
50
+ regions,
51
+ title,
52
+ url,
53
+ pages: pagesList,
38
54
  frontmatter: page.frontmatter ?? {},
39
55
  headings: page.headings,
40
56
  };
41
57
  const html = renderPage({ theme, page: pageData });
58
+ const needsBehaviors = hasInteractiveRunes(page.renderable);
42
59
  const seoData = extractSeoData({
43
- title: page.title,
60
+ title,
44
61
  frontmatter: page.frontmatter ?? {},
45
62
  seo: page.seo,
46
63
  });
47
64
  const seoHtml = seoToHtml(seoData);
48
65
  const seo = { ...seoHtml, description: seoData.description };
66
+ const contextJson = JSON.stringify({
67
+ pages: pagesList,
68
+ currentUrl: url,
69
+ });
49
70
  return {
50
- url: page.url,
51
- title: page.title,
71
+ url,
72
+ title,
52
73
  html,
53
74
  seo,
54
75
  frontmatter: page.frontmatter ?? {},
76
+ contextJson,
77
+ hasInteractiveRunes: needsBehaviors,
55
78
  };
56
79
  });
57
80
  };
package/dist/data.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"data.js","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAgB9E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,MAK9B;IACA,MAAM,EACL,KAAK,EACL,UAAU,GAAG,WAAW,EACxB,QAAQ,GAAG,GAAG,GACd,GAAG,MAAM,CAAC;IAEX,OAAO,KAAK,UAAU,WAAW;QAChC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAE5D,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;YACnC,MAAM,QAAQ,GAAmB;gBAChC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;gBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;oBAClC,GAAG,EAAE,CAAC,CAAC,GAAG;oBACV,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,KAAK,EAAE,CAAC,CAAC,KAA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;gBACN,GAAG;gBACH,KAAK;gBACL,IAAI;gBACJ,GAAG;gBACH,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;gBACnC,WAAW;gBACX,mBAAmB,EAAE,cAAc;aACnC,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { refraktPlugin } from './plugin.js';
2
2
  export { createDataFile } from './data.js';
3
3
  export type { EleventyPageData } from './data.js';
4
+ export { hasInteractiveRunes } from './behaviors.js';
4
5
  export type { EleventyTheme, RefraktEleventyOptions } from './types.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGlD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrD,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -2,4 +2,6 @@
2
2
  export { refraktPlugin } from './plugin.js';
3
3
  // Data file factory
4
4
  export { createDataFile } from './data.js';
5
+ // Behaviors
6
+ export { hasInteractiveRunes } from './behaviors.js';
5
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,YAAY;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAc7F"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAqB7F"}
package/dist/plugin.js CHANGED
@@ -6,9 +6,8 @@ import { existsSync } from 'node:fs';
6
6
  * behaviors JS from node_modules.
7
7
  */
8
8
  export function refraktPlugin(eleventyConfig, options = {}) {
9
- const { cssPrefix = '/css', } = options;
10
- // Passthrough copy Lumina CSS from node_modules
11
- // Users should configure the specific paths for their theme
9
+ const { cssPrefix = '/css', jsPrefix = '/js', } = options;
10
+ // Passthrough copy theme CSS from node_modules
12
11
  if (options.cssFiles) {
13
12
  for (const cssFile of options.cssFiles) {
14
13
  if (existsSync(cssFile)) {
@@ -16,5 +15,11 @@ export function refraktPlugin(eleventyConfig, options = {}) {
16
15
  }
17
16
  }
18
17
  }
18
+ // Passthrough copy behaviors JS bundle
19
+ if (options.behaviorFile) {
20
+ if (existsSync(options.behaviorFile)) {
21
+ eleventyConfig.addPassthroughCopy({ [options.behaviorFile]: jsPrefix });
22
+ }
23
+ }
19
24
  }
20
25
  //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,cAAmB,EAAE,UAAkC,EAAE;IACtF,MAAM,EACL,SAAS,GAAG,MAAM,GAClB,GAAG,OAAO,CAAC;IAEZ,gDAAgD;IAChD,4DAA4D;IAC5D,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,cAAmB,EAAE,UAAkC,EAAE;IACtF,MAAM,EACL,SAAS,GAAG,MAAM,EAClB,QAAQ,GAAG,KAAK,GAChB,GAAG,OAAO,CAAC;IAEZ,+CAA+C;IAC/C,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7D,CAAC;QACF,CAAC;IACF,CAAC;IAED,uCAAuC;IACvC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QAC1B,IAAI,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;YACtC,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzE,CAAC;IACF,CAAC;AACF,CAAC"}
package/dist/types.d.ts CHANGED
@@ -14,5 +14,9 @@ export interface RefraktEleventyOptions {
14
14
  cssFiles?: string[];
15
15
  /** Path prefix for copied CSS (default: '/css') */
16
16
  cssPrefix?: string;
17
+ /** Path to the behaviors JS bundle for passthrough copy */
18
+ behaviorFile?: string;
19
+ /** Path prefix for copied JS (default: '/js') */
20
+ jsPrefix?: string;
17
21
  }
18
22
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AAEzC,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AAEzC,8CAA8C;AAC9C,MAAM,WAAW,sBAAsB;IACtC,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@refrakt-md/eleventy",
3
3
  "description": "Eleventy plugin for refrakt.md — render Markdoc runes in 11ty v3 projects",
4
- "version": "0.9.4",
4
+ "version": "0.9.6",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -30,9 +30,10 @@
30
30
  "build": "tsc"
31
31
  },
32
32
  "dependencies": {
33
- "@refrakt-md/content": "0.9.4",
34
- "@refrakt-md/transform": "0.9.4",
35
- "@refrakt-md/types": "0.9.4"
33
+ "@refrakt-md/behaviors": "0.9.6",
34
+ "@refrakt-md/content": "0.9.6",
35
+ "@refrakt-md/transform": "0.9.6",
36
+ "@refrakt-md/types": "0.9.6"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "@11ty/eleventy": "^3.0.0"
@@ -10,13 +10,23 @@
10
10
  </head>
11
11
  <body>
12
12
  {{ page.html | safe }}
13
+ <script type="application/json" id="rf-context">{{ page.contextJson | safe }}</script>
14
+ {% if page.hasInteractiveRunes %}
13
15
  <script type="module">
14
16
  import { registerElements, RfContext, initRuneBehaviors, initLayoutBehaviors } from '/js/behaviors.js';
15
17
 
16
- RfContext.currentUrl = '{{ page.url }}';
18
+ const contextEl = document.getElementById('rf-context');
19
+ if (contextEl) {
20
+ try {
21
+ const ctx = JSON.parse(contextEl.textContent || '{}');
22
+ RfContext.pages = ctx.pages;
23
+ RfContext.currentUrl = ctx.currentUrl;
24
+ } catch {}
25
+ }
17
26
  registerElements();
18
27
  initRuneBehaviors();
19
28
  initLayoutBehaviors();
20
29
  </script>
30
+ {% endif %}
21
31
  </body>
22
32
  </html>