@ox-content/vite-plugin 0.0.1-alpha.0 → 0.3.0-alpha.11

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.
package/dist/tabs2.js ADDED
@@ -0,0 +1,177 @@
1
+ import { unified } from "unified";
2
+ import rehypeParse from "rehype-parse";
3
+ import rehypeStringify from "rehype-stringify";
4
+
5
+ //#region src/plugins/tabs.ts
6
+ /**
7
+ * Tabs Plugin - Pure CSS implementation
8
+ *
9
+ * Transforms <Tabs>/<Tab> components into accessible HTML
10
+ * with CSS :has() based tab switching (no JavaScript required).
11
+ */
12
+ let tabGroupCounter = 0;
13
+ /**
14
+ * Get element attribute value.
15
+ */
16
+ function getAttribute(el, name) {
17
+ const value = el.properties?.[name];
18
+ if (typeof value === "string") return value;
19
+ if (Array.isArray(value)) return value.join(" ");
20
+ }
21
+ /**
22
+ * Parse Tab elements from Tabs children.
23
+ */
24
+ function parseTabChildren(children) {
25
+ const tabs = [];
26
+ for (const child of children) {
27
+ if (child.type !== "element") continue;
28
+ if (child.tagName.toLowerCase() === "tab") {
29
+ const label = getAttribute(child, "label") || `Tab ${tabs.length + 1}`;
30
+ tabs.push({
31
+ label,
32
+ content: child.children.filter((c) => c.type === "element" || c.type === "text")
33
+ });
34
+ }
35
+ }
36
+ return tabs;
37
+ }
38
+ /**
39
+ * Create the HTML structure for tabs.
40
+ */
41
+ function createTabsElement(tabs, groupId) {
42
+ const children = [];
43
+ const headerChildren = [];
44
+ tabs.forEach((tab, index) => {
45
+ const inputId = `ox-tab-${groupId}-${index}`;
46
+ headerChildren.push({
47
+ type: "element",
48
+ tagName: "input",
49
+ properties: {
50
+ type: "radio",
51
+ name: `ox-tabs-${groupId}`,
52
+ id: inputId,
53
+ checked: index === 0 ? true : void 0
54
+ },
55
+ children: []
56
+ });
57
+ headerChildren.push({
58
+ type: "element",
59
+ tagName: "label",
60
+ properties: { htmlFor: inputId },
61
+ children: [{
62
+ type: "text",
63
+ value: tab.label
64
+ }]
65
+ });
66
+ });
67
+ children.push({
68
+ type: "element",
69
+ tagName: "div",
70
+ properties: { className: ["ox-tabs-header"] },
71
+ children: headerChildren
72
+ });
73
+ tabs.forEach((tab, index) => {
74
+ children.push({
75
+ type: "element",
76
+ tagName: "div",
77
+ properties: {
78
+ className: ["ox-tab-panel"],
79
+ "data-tab": String(index)
80
+ },
81
+ children: tab.content
82
+ });
83
+ });
84
+ return {
85
+ type: "element",
86
+ tagName: "div",
87
+ properties: {
88
+ className: ["ox-tabs"],
89
+ "data-group": groupId
90
+ },
91
+ children
92
+ };
93
+ }
94
+ /**
95
+ * Create fallback HTML using <details> elements.
96
+ */
97
+ function createFallbackElement(tabs) {
98
+ const children = [];
99
+ tabs.forEach((tab, index) => {
100
+ children.push({
101
+ type: "element",
102
+ tagName: "details",
103
+ properties: { open: index === 0 ? true : void 0 },
104
+ children: [{
105
+ type: "element",
106
+ tagName: "summary",
107
+ properties: {},
108
+ children: [{
109
+ type: "text",
110
+ value: tab.label
111
+ }]
112
+ }, {
113
+ type: "element",
114
+ tagName: "div",
115
+ properties: { className: ["ox-tabs-fallback-content"] },
116
+ children: tab.content
117
+ }]
118
+ });
119
+ });
120
+ return {
121
+ type: "element",
122
+ tagName: "noscript",
123
+ properties: {},
124
+ children: [{
125
+ type: "element",
126
+ tagName: "div",
127
+ properties: { className: ["ox-tabs-fallback"] },
128
+ children
129
+ }]
130
+ };
131
+ }
132
+ /**
133
+ * Rehype plugin to transform Tabs components.
134
+ */
135
+ function rehypeTabs() {
136
+ return (tree) => {
137
+ const visit = (node) => {
138
+ if ("children" in node) for (let i = 0; i < node.children.length; i++) {
139
+ const child = node.children[i];
140
+ if (child.type === "element") if (child.tagName.toLowerCase() === "tabs") {
141
+ const tabs = parseTabChildren(child.children);
142
+ if (tabs.length > 0) {
143
+ const wrapper = {
144
+ type: "element",
145
+ tagName: "div",
146
+ properties: { className: ["ox-tabs-container"] },
147
+ children: [createTabsElement(tabs, String(tabGroupCounter++)), createFallbackElement(tabs)]
148
+ };
149
+ node.children[i] = wrapper;
150
+ }
151
+ } else visit(child);
152
+ }
153
+ };
154
+ visit(tree);
155
+ };
156
+ }
157
+ /**
158
+ * Transform Tabs components in HTML.
159
+ */
160
+ async function transformTabs(html) {
161
+ const result = await unified().use(rehypeParse, { fragment: true }).use(rehypeTabs).use(rehypeStringify).process(html);
162
+ return String(result);
163
+ }
164
+ /**
165
+ * Generate dynamic CSS for :has() based tab switching.
166
+ * This is needed because :has() selectors need unique IDs.
167
+ */
168
+ function generateTabsCSS(groupCount) {
169
+ if (groupCount === 0) return "";
170
+ let css = "/* Dynamic Tabs CSS */\n";
171
+ for (let g = 0; g < groupCount; g++) for (let t = 0; t < 8; t++) css += `.ox-tabs[data-group="${g}"]:has(#ox-tab-${g}-${t}:checked) .ox-tab-panel[data-tab="${t}"] { display: block; }\n`;
172
+ return css;
173
+ }
174
+
175
+ //#endregion
176
+ export { transformTabs as n, generateTabsCSS as t };
177
+ //# sourceMappingURL=tabs2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs2.js","names":[],"sources":["../src/plugins/tabs.ts"],"sourcesContent":["/**\n * Tabs Plugin - Pure CSS implementation\n *\n * Transforms <Tabs>/<Tab> components into accessible HTML\n * with CSS :has() based tab switching (no JavaScript required).\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element, Text } from \"hast\";\n\nlet tabGroupCounter = 0;\n\n/**\n * Reset tab group counter (for testing).\n */\nexport function resetTabGroupCounter(): void {\n tabGroupCounter = 0;\n}\n\n/**\n * Extract text content from a hast node.\n */\nfunction getTextContent(node: Element | Root): string {\n let text = \"\";\n if (\"children\" in node) {\n for (const child of node.children) {\n if (child.type === \"text\") {\n text += (child as Text).value;\n } else if (child.type === \"element\") {\n text += getTextContent(child as Element);\n }\n }\n }\n return text;\n}\n\n/**\n * Get element attribute value.\n */\nfunction getAttribute(el: Element, name: string): string | undefined {\n const value = el.properties?.[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.join(\" \");\n return undefined;\n}\n\ninterface TabData {\n label: string;\n content: Element[];\n}\n\n/**\n * Parse Tab elements from Tabs children.\n */\nfunction parseTabChildren(children: Element[\"children\"]): TabData[] {\n const tabs: TabData[] = [];\n\n for (const child of children) {\n if (child.type !== \"element\") continue;\n\n // Handle <Tab label=\"...\">\n if (child.tagName.toLowerCase() === \"tab\") {\n const label = getAttribute(child, \"label\") || `Tab ${tabs.length + 1}`;\n tabs.push({\n label,\n content: child.children.filter((c): c is Element => c.type === \"element\" || c.type === \"text\") as Element[],\n });\n }\n }\n\n return tabs;\n}\n\n/**\n * Create the HTML structure for tabs.\n */\nfunction createTabsElement(tabs: TabData[], groupId: string): Element {\n const children: Element[\"children\"] = [];\n\n // Create header with radio inputs and labels\n const headerChildren: Element[\"children\"] = [];\n\n tabs.forEach((tab, index) => {\n const inputId = `ox-tab-${groupId}-${index}`;\n\n // Radio input\n headerChildren.push({\n type: \"element\",\n tagName: \"input\",\n properties: {\n type: \"radio\",\n name: `ox-tabs-${groupId}`,\n id: inputId,\n checked: index === 0 ? true : undefined,\n },\n children: [],\n });\n\n // Label\n headerChildren.push({\n type: \"element\",\n tagName: \"label\",\n properties: {\n htmlFor: inputId,\n },\n children: [{ type: \"text\", value: tab.label }],\n });\n });\n\n // Tabs header\n children.push({\n type: \"element\",\n tagName: \"div\",\n properties: { className: [\"ox-tabs-header\"] },\n children: headerChildren,\n });\n\n // Tab panels\n tabs.forEach((tab, index) => {\n children.push({\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ox-tab-panel\"],\n \"data-tab\": String(index),\n },\n children: tab.content,\n });\n });\n\n return {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ox-tabs\"],\n \"data-group\": groupId,\n },\n children,\n };\n}\n\n/**\n * Create fallback HTML using <details> elements.\n */\nfunction createFallbackElement(tabs: TabData[]): Element {\n const children: Element[\"children\"] = [];\n\n tabs.forEach((tab, index) => {\n children.push({\n type: \"element\",\n tagName: \"details\",\n properties: {\n open: index === 0 ? true : undefined,\n },\n children: [\n {\n type: \"element\",\n tagName: \"summary\",\n properties: {},\n children: [{ type: \"text\", value: tab.label }],\n },\n {\n type: \"element\",\n tagName: \"div\",\n properties: { className: [\"ox-tabs-fallback-content\"] },\n children: tab.content,\n },\n ],\n });\n });\n\n return {\n type: \"element\",\n tagName: \"noscript\",\n properties: {},\n children: [\n {\n type: \"element\",\n tagName: \"div\",\n properties: { className: [\"ox-tabs-fallback\"] },\n children,\n },\n ],\n };\n}\n\n/**\n * Rehype plugin to transform Tabs components.\n */\nfunction rehypeTabs() {\n return (tree: Root) => {\n const visit = (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\") {\n // Check for <Tabs> component\n if (child.tagName.toLowerCase() === \"tabs\") {\n const tabs = parseTabChildren(child.children);\n\n if (tabs.length > 0) {\n const groupId = String(tabGroupCounter++);\n const tabsElement = createTabsElement(tabs, groupId);\n const fallbackElement = createFallbackElement(tabs);\n\n // Replace <Tabs> with new structure\n // Keep main tabs and add noscript fallback\n const wrapper: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: { className: [\"ox-tabs-container\"] },\n children: [tabsElement, fallbackElement],\n };\n\n node.children[i] = wrapper;\n }\n } else {\n visit(child);\n }\n }\n }\n }\n };\n\n visit(tree);\n };\n}\n\n/**\n * Transform Tabs components in HTML.\n */\nexport async function transformTabs(html: string): Promise<string> {\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeTabs)\n .use(rehypeStringify)\n .process(html);\n\n return String(result);\n}\n\n/**\n * Generate dynamic CSS for :has() based tab switching.\n * This is needed because :has() selectors need unique IDs.\n */\nexport function generateTabsCSS(groupCount: number): string {\n if (groupCount === 0) return \"\";\n\n let css = \"/* Dynamic Tabs CSS */\\n\";\n\n for (let g = 0; g < groupCount; g++) {\n for (let t = 0; t < 8; t++) {\n css += `.ox-tabs[data-group=\"${g}\"]:has(#ox-tab-${g}-${t}:checked) .ox-tab-panel[data-tab=\"${t}\"] { display: block; }\\n`;\n }\n }\n\n return css;\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAI,kBAAkB;;;;AA6BtB,SAAS,aAAa,IAAa,MAAkC;CACnE,MAAM,QAAQ,GAAG,aAAa;AAC9B,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,KAAK,IAAI;;;;;AAYlD,SAAS,iBAAiB,UAA0C;CAClE,MAAM,OAAkB,EAAE;AAE1B,MAAK,MAAM,SAAS,UAAU;AAC5B,MAAI,MAAM,SAAS,UAAW;AAG9B,MAAI,MAAM,QAAQ,aAAa,KAAK,OAAO;GACzC,MAAM,QAAQ,aAAa,OAAO,QAAQ,IAAI,OAAO,KAAK,SAAS;AACnE,QAAK,KAAK;IACR;IACA,SAAS,MAAM,SAAS,QAAQ,MAAoB,EAAE,SAAS,aAAa,EAAE,SAAS,OAAO;IAC/F,CAAC;;;AAIN,QAAO;;;;;AAMT,SAAS,kBAAkB,MAAiB,SAA0B;CACpE,MAAM,WAAgC,EAAE;CAGxC,MAAM,iBAAsC,EAAE;AAE9C,MAAK,SAAS,KAAK,UAAU;EAC3B,MAAM,UAAU,UAAU,QAAQ,GAAG;AAGrC,iBAAe,KAAK;GAClB,MAAM;GACN,SAAS;GACT,YAAY;IACV,MAAM;IACN,MAAM,WAAW;IACjB,IAAI;IACJ,SAAS,UAAU,IAAI,OAAO;IAC/B;GACD,UAAU,EAAE;GACb,CAAC;AAGF,iBAAe,KAAK;GAClB,MAAM;GACN,SAAS;GACT,YAAY,EACV,SAAS,SACV;GACD,UAAU,CAAC;IAAE,MAAM;IAAQ,OAAO,IAAI;IAAO,CAAC;GAC/C,CAAC;GACF;AAGF,UAAS,KAAK;EACZ,MAAM;EACN,SAAS;EACT,Y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OACvB,MAAM;OACN,SAAS;OACT,YAAY,EAAE,WAAW,CAAC,oBAAoB,EAAE;OAChD,UAAU,CATQ,kBAAkB,MADtB,OAAO,kBAAkB,CACW,EAC5B,sBAAsB,KAAK,CAQT;OACzC;AAED,WAAK,SAAS,KAAK;;UAGrB,OAAM,MAAM;;;AAOtB,QAAM,KAAK;;;;;;AAOf,eAAsB,cAAc,MAA+B;CACjE,MAAM,SAAS,MAAM,SAAS,CAC3B,IAAI,aAAa,EAAE,UAAU,MAAM,CAAC,CACpC,IAAI,WAAW,CACf,IAAI,gBAAgB,CACpB,QAAQ,KAAK;AAEhB,QAAO,OAAO,OAAO;;;;;;AAOvB,SAAgB,gBAAgB,YAA4B;AAC1D,KAAI,eAAe,EAAG,QAAO;CAE7B,IAAI,MAAM;AAEV,MAAK,IAAI,IAAI,GAAG,IAAI,YAAY,IAC9B,MAAK,IAAI,IAAI,GAAG,IAAI,GAAG,IACrB,QAAO,wBAAwB,EAAE,iBAAiB,EAAE,GAAG,EAAE,oCAAoC,EAAE;AAInG,QAAO"}
@@ -0,0 +1,4 @@
1
+ const require_chunk = require('./chunk.cjs');
2
+ const require_youtube = require('./youtube2.cjs');
3
+
4
+ exports.transformYouTube = require_youtube.transformYouTube;
@@ -0,0 +1,3 @@
1
+ import { n as transformYouTube, t as extractVideoId } from "./youtube2.js";
2
+
3
+ export { transformYouTube };
@@ -0,0 +1,127 @@
1
+ const require_chunk = require('./chunk.cjs');
2
+ let unified = require("unified");
3
+ let rehype_parse = require("rehype-parse");
4
+ rehype_parse = require_chunk.__toESM(rehype_parse);
5
+ let rehype_stringify = require("rehype-stringify");
6
+ rehype_stringify = require_chunk.__toESM(rehype_stringify);
7
+
8
+ //#region src/plugins/youtube.ts
9
+ /**
10
+ * YouTube Plugin - Privacy-enhanced iframe embedding
11
+ *
12
+ * Transforms <YouTube> components into responsive iframe embeds
13
+ * using youtube-nocookie.com for enhanced privacy.
14
+ */
15
+ const defaultOptions = {
16
+ privacyEnhanced: true,
17
+ aspectRatio: "16/9",
18
+ allowFullscreen: true,
19
+ lazyLoad: true
20
+ };
21
+ /**
22
+ * Get element attribute value.
23
+ */
24
+ function getAttribute(el, name) {
25
+ const value = el.properties?.[name];
26
+ if (typeof value === "string") return value;
27
+ if (Array.isArray(value)) return value.join(" ");
28
+ }
29
+ /**
30
+ * Extract YouTube video ID from various URL formats.
31
+ */
32
+ function extractVideoId(input) {
33
+ if (/^[a-zA-Z0-9_-]{11}$/.test(input)) return input;
34
+ for (const pattern of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/]) {
35
+ const match = input.match(pattern);
36
+ if (match) return match[1];
37
+ }
38
+ return null;
39
+ }
40
+ /**
41
+ * Build YouTube embed URL with parameters.
42
+ */
43
+ function buildEmbedUrl(videoId, options, params) {
44
+ const domain = options.privacyEnhanced ? "www.youtube-nocookie.com" : "www.youtube.com";
45
+ const url = new URL(`https://${domain}/embed/${videoId}`);
46
+ if (params) for (const [key, value] of Object.entries(params)) url.searchParams.set(key, value);
47
+ return url.toString();
48
+ }
49
+ /**
50
+ * Create YouTube embed element.
51
+ */
52
+ function createYouTubeElement(videoId, options, title, start) {
53
+ const params = {};
54
+ if (start) params.start = start;
55
+ const iframe = {
56
+ type: "element",
57
+ tagName: "iframe",
58
+ properties: {
59
+ src: buildEmbedUrl(videoId, options, params),
60
+ title: title || `YouTube video ${videoId}`,
61
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
62
+ referrerpolicy: "strict-origin-when-cross-origin",
63
+ allowfullscreen: options.allowFullscreen || void 0,
64
+ loading: options.lazyLoad ? "lazy" : void 0
65
+ },
66
+ children: []
67
+ };
68
+ return {
69
+ type: "element",
70
+ tagName: "div",
71
+ properties: {
72
+ className: ["ox-youtube"],
73
+ style: `aspect-ratio: ${options.aspectRatio};`
74
+ },
75
+ children: [iframe]
76
+ };
77
+ }
78
+ /**
79
+ * Rehype plugin to transform YouTube components.
80
+ */
81
+ function rehypeYouTube(options) {
82
+ return (tree) => {
83
+ const visit = (node) => {
84
+ if ("children" in node) for (let i = 0; i < node.children.length; i++) {
85
+ const child = node.children[i];
86
+ if (child.type === "element") if (child.tagName.toLowerCase() === "youtube") {
87
+ const id = getAttribute(child, "id");
88
+ const url = getAttribute(child, "url");
89
+ const title = getAttribute(child, "title");
90
+ const start = getAttribute(child, "start");
91
+ const videoId = id ? extractVideoId(id) : url ? extractVideoId(url) : null;
92
+ if (videoId) {
93
+ const youtubeElement = createYouTubeElement(videoId, options, title, start);
94
+ node.children[i] = youtubeElement;
95
+ }
96
+ } else visit(child);
97
+ }
98
+ };
99
+ visit(tree);
100
+ };
101
+ }
102
+ /**
103
+ * Transform YouTube components in HTML.
104
+ */
105
+ async function transformYouTube(html, options) {
106
+ const mergedOptions = {
107
+ ...defaultOptions,
108
+ ...options
109
+ };
110
+ const result = await (0, unified.unified)().use(rehype_parse.default, { fragment: true }).use(rehypeYouTube, mergedOptions).use(rehype_stringify.default).process(html);
111
+ return String(result);
112
+ }
113
+
114
+ //#endregion
115
+ Object.defineProperty(exports, 'extractVideoId', {
116
+ enumerable: true,
117
+ get: function () {
118
+ return extractVideoId;
119
+ }
120
+ });
121
+ Object.defineProperty(exports, 'transformYouTube', {
122
+ enumerable: true,
123
+ get: function () {
124
+ return transformYouTube;
125
+ }
126
+ });
127
+ //# sourceMappingURL=youtube2.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube2.cjs","names":["rehypeParse","rehypeStringify"],"sources":["../src/plugins/youtube.ts"],"sourcesContent":["/**\n * YouTube Plugin - Privacy-enhanced iframe embedding\n *\n * Transforms <YouTube> components into responsive iframe embeds\n * using youtube-nocookie.com for enhanced privacy.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element, Properties } from \"hast\";\n\nexport interface YouTubeOptions {\n /** Use privacy-enhanced mode (youtube-nocookie.com). Default: true */\n privacyEnhanced?: boolean;\n /** Default aspect ratio. Default: \"16/9\" */\n aspectRatio?: string;\n /** Allow fullscreen. Default: true */\n allowFullscreen?: boolean;\n /** Lazy load iframe. Default: true */\n lazyLoad?: boolean;\n}\n\nconst defaultOptions: Required<YouTubeOptions> = {\n privacyEnhanced: true,\n aspectRatio: \"16/9\",\n allowFullscreen: true,\n lazyLoad: true,\n};\n\n/**\n * Get element attribute value.\n */\nfunction getAttribute(el: Element, name: string): string | undefined {\n const value = el.properties?.[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.join(\" \");\n return undefined;\n}\n\n/**\n * Extract YouTube video ID from various URL formats.\n */\nexport function extractVideoId(input: string): string | null {\n // Already a video ID (11 characters, alphanumeric + _ -)\n if (/^[a-zA-Z0-9_-]{11}$/.test(input)) {\n return input;\n }\n\n // Full URL patterns\n const patterns = [\n /(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/|youtube\\.com\\/embed\\/|youtube\\.com\\/v\\/)([a-zA-Z0-9_-]{11})/,\n /youtube\\.com\\/shorts\\/([a-zA-Z0-9_-]{11})/,\n ];\n\n for (const pattern of patterns) {\n const match = input.match(pattern);\n if (match) return match[1];\n }\n\n return null;\n}\n\n/**\n * Build YouTube embed URL with parameters.\n */\nfunction buildEmbedUrl(videoId: string, options: Required<YouTubeOptions>, params?: Record<string, string>): string {\n const domain = options.privacyEnhanced ? \"www.youtube-nocookie.com\" : \"www.youtube.com\";\n const url = new URL(`https://${domain}/embed/${videoId}`);\n\n // Add any custom parameters\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n\n return url.toString();\n}\n\n/**\n * Create YouTube embed element.\n */\nfunction createYouTubeElement(\n videoId: string,\n options: Required<YouTubeOptions>,\n title?: string,\n start?: string,\n): Element {\n const params: Record<string, string> = {};\n if (start) {\n params.start = start;\n }\n\n const embedUrl = buildEmbedUrl(videoId, options, params);\n\n const iframeProps: Properties = {\n src: embedUrl,\n title: title || `YouTube video ${videoId}`,\n allow: \"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\",\n referrerpolicy: \"strict-origin-when-cross-origin\",\n allowfullscreen: options.allowFullscreen || undefined,\n loading: options.lazyLoad ? \"lazy\" : undefined,\n };\n\n const iframe: Element = {\n type: \"element\",\n tagName: \"iframe\",\n properties: iframeProps,\n children: [],\n };\n\n return {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ox-youtube\"],\n style: `aspect-ratio: ${options.aspectRatio};`,\n },\n children: [iframe],\n };\n}\n\n/**\n * Rehype plugin to transform YouTube components.\n */\nfunction rehypeYouTube(options: Required<YouTubeOptions>) {\n return (tree: Root) => {\n const visit = (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\") {\n // Check for <YouTube> component\n if (child.tagName.toLowerCase() === \"youtube\") {\n const id = getAttribute(child, \"id\");\n const url = getAttribute(child, \"url\");\n const title = getAttribute(child, \"title\");\n const start = getAttribute(child, \"start\");\n\n // Extract video ID from id or url attribute\n const videoId = id ? extractVideoId(id) : url ? extractVideoId(url) : null;\n\n if (videoId) {\n const youtubeElement = createYouTubeElement(videoId, options, title, start);\n node.children[i] = youtubeElement;\n }\n } else {\n visit(child);\n }\n }\n }\n }\n };\n\n visit(tree);\n };\n}\n\n/**\n * Transform YouTube components in HTML.\n */\nexport async function transformYouTube(html: string, options?: YouTubeOptions): Promise<string> {\n const mergedOptions = { ...defaultOptions, ...options };\n\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeYouTube, mergedOptions)\n .use(rehypeStringify)\n .process(html);\n\n return String(result);\n}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAM,iBAA2C;CAC/C,iBAAiB;CACjB,aAAa;CACb,iBAAiB;CACj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IAAI,IAAI,GAAG,IAAI,KAAK,SAAS,QAAQ,KAAK;IAC7C,MAAM,QAAQ,KAAK,SAAS;AAE5B,QAAI,MAAM,SAAS,UAEjB,KAAI,MAAM,QAAQ,aAAa,KAAK,WAAW;KAC7C,MAAM,KAAK,aAAa,OAAO,KAAK;KACpC,MAAM,MAAM,aAAa,OAAO,MAAM;KACtC,MAAM,QAAQ,aAAa,OAAO,QAAQ;KAC1C,MAAM,QAAQ,aAAa,OAAO,QAAQ;KAG1C,MAAM,UAAU,KAAK,eAAe,GAAG,GAAG,MAAM,eAAe,IAAI,GAAG;AAEtE,SAAI,SAAS;MACX,MAAM,iBAAiB,qBAAqB,SAAS,SAAS,OAAO,MAAM;AAC3E,WAAK,SAAS,KAAK;;UAGrB,OAAM,MAAM;;;AAOtB,QAAM,KAAK;;;;;;AAOf,eAAsB,iBAAiB,MAAc,SAA2C;CAC9F,MAAM,gBAAgB;EAAE,GAAG;EAAgB,GAAG;EAAS;CAEvD,MAAM,SAAS,4BAAe,CAC3B,IAAIA,sBAAa,EAAE,UAAU,MAAM,CAAC,CACpC,IAAI,eAAe,cAAc,CACjC,IAAIC,yBAAgB,CACpB,QAAQ,KAAK;AAEhB,QAAO,OAAO,OAAO"}
@@ -0,0 +1,113 @@
1
+ import { unified } from "unified";
2
+ import rehypeParse from "rehype-parse";
3
+ import rehypeStringify from "rehype-stringify";
4
+
5
+ //#region src/plugins/youtube.ts
6
+ /**
7
+ * YouTube Plugin - Privacy-enhanced iframe embedding
8
+ *
9
+ * Transforms <YouTube> components into responsive iframe embeds
10
+ * using youtube-nocookie.com for enhanced privacy.
11
+ */
12
+ const defaultOptions = {
13
+ privacyEnhanced: true,
14
+ aspectRatio: "16/9",
15
+ allowFullscreen: true,
16
+ lazyLoad: true
17
+ };
18
+ /**
19
+ * Get element attribute value.
20
+ */
21
+ function getAttribute(el, name) {
22
+ const value = el.properties?.[name];
23
+ if (typeof value === "string") return value;
24
+ if (Array.isArray(value)) return value.join(" ");
25
+ }
26
+ /**
27
+ * Extract YouTube video ID from various URL formats.
28
+ */
29
+ function extractVideoId(input) {
30
+ if (/^[a-zA-Z0-9_-]{11}$/.test(input)) return input;
31
+ for (const pattern of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/v\/)([a-zA-Z0-9_-]{11})/, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/]) {
32
+ const match = input.match(pattern);
33
+ if (match) return match[1];
34
+ }
35
+ return null;
36
+ }
37
+ /**
38
+ * Build YouTube embed URL with parameters.
39
+ */
40
+ function buildEmbedUrl(videoId, options, params) {
41
+ const domain = options.privacyEnhanced ? "www.youtube-nocookie.com" : "www.youtube.com";
42
+ const url = new URL(`https://${domain}/embed/${videoId}`);
43
+ if (params) for (const [key, value] of Object.entries(params)) url.searchParams.set(key, value);
44
+ return url.toString();
45
+ }
46
+ /**
47
+ * Create YouTube embed element.
48
+ */
49
+ function createYouTubeElement(videoId, options, title, start) {
50
+ const params = {};
51
+ if (start) params.start = start;
52
+ const iframe = {
53
+ type: "element",
54
+ tagName: "iframe",
55
+ properties: {
56
+ src: buildEmbedUrl(videoId, options, params),
57
+ title: title || `YouTube video ${videoId}`,
58
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
59
+ referrerpolicy: "strict-origin-when-cross-origin",
60
+ allowfullscreen: options.allowFullscreen || void 0,
61
+ loading: options.lazyLoad ? "lazy" : void 0
62
+ },
63
+ children: []
64
+ };
65
+ return {
66
+ type: "element",
67
+ tagName: "div",
68
+ properties: {
69
+ className: ["ox-youtube"],
70
+ style: `aspect-ratio: ${options.aspectRatio};`
71
+ },
72
+ children: [iframe]
73
+ };
74
+ }
75
+ /**
76
+ * Rehype plugin to transform YouTube components.
77
+ */
78
+ function rehypeYouTube(options) {
79
+ return (tree) => {
80
+ const visit = (node) => {
81
+ if ("children" in node) for (let i = 0; i < node.children.length; i++) {
82
+ const child = node.children[i];
83
+ if (child.type === "element") if (child.tagName.toLowerCase() === "youtube") {
84
+ const id = getAttribute(child, "id");
85
+ const url = getAttribute(child, "url");
86
+ const title = getAttribute(child, "title");
87
+ const start = getAttribute(child, "start");
88
+ const videoId = id ? extractVideoId(id) : url ? extractVideoId(url) : null;
89
+ if (videoId) {
90
+ const youtubeElement = createYouTubeElement(videoId, options, title, start);
91
+ node.children[i] = youtubeElement;
92
+ }
93
+ } else visit(child);
94
+ }
95
+ };
96
+ visit(tree);
97
+ };
98
+ }
99
+ /**
100
+ * Transform YouTube components in HTML.
101
+ */
102
+ async function transformYouTube(html, options) {
103
+ const mergedOptions = {
104
+ ...defaultOptions,
105
+ ...options
106
+ };
107
+ const result = await unified().use(rehypeParse, { fragment: true }).use(rehypeYouTube, mergedOptions).use(rehypeStringify).process(html);
108
+ return String(result);
109
+ }
110
+
111
+ //#endregion
112
+ export { transformYouTube as n, extractVideoId as t };
113
+ //# sourceMappingURL=youtube2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"youtube2.js","names":[],"sources":["../src/plugins/youtube.ts"],"sourcesContent":["/**\n * YouTube Plugin - Privacy-enhanced iframe embedding\n *\n * Transforms <YouTube> components into responsive iframe embeds\n * using youtube-nocookie.com for enhanced privacy.\n */\n\nimport { unified } from \"unified\";\nimport rehypeParse from \"rehype-parse\";\nimport rehypeStringify from \"rehype-stringify\";\nimport type { Root, Element, Properties } from \"hast\";\n\nexport interface YouTubeOptions {\n /** Use privacy-enhanced mode (youtube-nocookie.com). Default: true */\n privacyEnhanced?: boolean;\n /** Default aspect ratio. Default: \"16/9\" */\n aspectRatio?: string;\n /** Allow fullscreen. Default: true */\n allowFullscreen?: boolean;\n /** Lazy load iframe. Default: true */\n lazyLoad?: boolean;\n}\n\nconst defaultOptions: Required<YouTubeOptions> = {\n privacyEnhanced: true,\n aspectRatio: \"16/9\",\n allowFullscreen: true,\n lazyLoad: true,\n};\n\n/**\n * Get element attribute value.\n */\nfunction getAttribute(el: Element, name: string): string | undefined {\n const value = el.properties?.[name];\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.join(\" \");\n return undefined;\n}\n\n/**\n * Extract YouTube video ID from various URL formats.\n */\nexport function extractVideoId(input: string): string | null {\n // Already a video ID (11 characters, alphanumeric + _ -)\n if (/^[a-zA-Z0-9_-]{11}$/.test(input)) {\n return input;\n }\n\n // Full URL patterns\n const patterns = [\n /(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/|youtube\\.com\\/embed\\/|youtube\\.com\\/v\\/)([a-zA-Z0-9_-]{11})/,\n /youtube\\.com\\/shorts\\/([a-zA-Z0-9_-]{11})/,\n ];\n\n for (const pattern of patterns) {\n const match = input.match(pattern);\n if (match) return match[1];\n }\n\n return null;\n}\n\n/**\n * Build YouTube embed URL with parameters.\n */\nfunction buildEmbedUrl(videoId: string, options: Required<YouTubeOptions>, params?: Record<string, string>): string {\n const domain = options.privacyEnhanced ? \"www.youtube-nocookie.com\" : \"www.youtube.com\";\n const url = new URL(`https://${domain}/embed/${videoId}`);\n\n // Add any custom parameters\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n url.searchParams.set(key, value);\n }\n }\n\n return url.toString();\n}\n\n/**\n * Create YouTube embed element.\n */\nfunction createYouTubeElement(\n videoId: string,\n options: Required<YouTubeOptions>,\n title?: string,\n start?: string,\n): Element {\n const params: Record<string, string> = {};\n if (start) {\n params.start = start;\n }\n\n const embedUrl = buildEmbedUrl(videoId, options, params);\n\n const iframeProps: Properties = {\n src: embedUrl,\n title: title || `YouTube video ${videoId}`,\n allow: \"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\",\n referrerpolicy: \"strict-origin-when-cross-origin\",\n allowfullscreen: options.allowFullscreen || undefined,\n loading: options.lazyLoad ? \"lazy\" : undefined,\n };\n\n const iframe: Element = {\n type: \"element\",\n tagName: \"iframe\",\n properties: iframeProps,\n children: [],\n };\n\n return {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ox-youtube\"],\n style: `aspect-ratio: ${options.aspectRatio};`,\n },\n children: [iframe],\n };\n}\n\n/**\n * Rehype plugin to transform YouTube components.\n */\nfunction rehypeYouTube(options: Required<YouTubeOptions>) {\n return (tree: Root) => {\n const visit = (node: Root | Element) => {\n if (\"children\" in node) {\n for (let i = 0; i < node.children.length; i++) {\n const child = node.children[i];\n\n if (child.type === \"element\") {\n // Check for <YouTube> component\n if (child.tagName.toLowerCase() === \"youtube\") {\n const id = getAttribute(child, \"id\");\n const url = getAttribute(child, \"url\");\n const title = getAttribute(child, \"title\");\n const start = getAttribute(child, \"start\");\n\n // Extract video ID from id or url attribute\n const videoId = id ? extractVideoId(id) : url ? extractVideoId(url) : null;\n\n if (videoId) {\n const youtubeElement = createYouTubeElement(videoId, options, title, start);\n node.children[i] = youtubeElement;\n }\n } else {\n visit(child);\n }\n }\n }\n }\n };\n\n visit(tree);\n };\n}\n\n/**\n * Transform YouTube components in HTML.\n */\nexport async function transformYouTube(html: string, options?: YouTubeOptions): Promise<string> {\n const mergedOptions = { ...defaultOptions, ...options };\n\n const result = await unified()\n .use(rehypeParse, { fragment: true })\n .use(rehypeYouTube, mergedOptions)\n .use(rehypeStringify)\n .process(html);\n\n return String(result);\n}\n"],"mappings":";;;;;;;;;;;AAuBA,MAAM,iBAA2C;CAC/C,iBAAiB;CACjB,aAAa;CACb,iBAAiB;CACjB,UAAU;CACX;;;;AAKD,SAAS,aAAa,IAAa,MAAkC;CACnE,MAAM,QAAQ,GAAG,aAAa;AAC9B,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,KAAK,IAAI;;;;;AAOlD,SAAgB,eAAe,OAA8B;AAE3D,KAAI,sBAAsB,KAAK,MAAM,CACnC,QAAO;AAST,MAAK,MAAM,WALM,CACf,sGACA,4CACD,EAE+B;EAC9B,MAAM,QAAQ,MAAM,MAAM,QAAQ;AAClC,MAAI,MAAO,QAAO,MAAM;;AAG1B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AAI,SAAS;MACX,MAAM,iBAAiB,qBAAqB,SAAS,SAAS,OAAO,MAAM;AAC3E,WAAK,SAAS,KAAK;;UAGrB,OAAM,MAAM;;;AAOtB,QAAM,KAAK;;;;;;AAOf,eAAsB,iBAAiB,MAAc,SAA2C;CAC9F,MAAM,gBAAgB;EAAE,GAAG;EAAgB,GAAG;EAAS;CAEvD,MAAM,SAAS,MAAM,SAAS,CAC3B,IAAI,aAAa,EAAE,UAAU,MAAM,CAAC,CACpC,IAAI,eAAe,cAAc,CACjC,IAAI,gBAAgB,CACpB,QAAQ,KAAK;AAEhB,QAAO,OAAO,OAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox-content/vite-plugin",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.3.0-alpha.11",
4
4
  "description": "Vite plugin for Ox Content - High-performance Markdown processing with Environment API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,29 +14,27 @@
14
14
  "files": [
15
15
  "dist"
16
16
  ],
17
- "scripts": {
18
- "build": "tsup",
19
- "dev": "tsup --watch",
20
- "typecheck": "tsc --noEmit"
21
- },
22
17
  "peerDependencies": {
23
- "vite": "catalog:"
18
+ "vite": "^8.0.0-beta.0"
24
19
  },
25
20
  "dependencies": {
26
- "@ox-content/napi": "workspace:*",
21
+ "@mermaid-js/mermaid-cli": "^11.12.0",
22
+ "puppeteer": "^23.0.0",
27
23
  "glob": "^11.0.0",
28
- "unified": "^11.0.5",
29
24
  "rehype-parse": "^9.0.1",
30
25
  "rehype-stringify": "^10.0.1",
31
26
  "shiki": "^1.24.0",
32
- "mermaid": "^11.4.0"
27
+ "unified": "^11.0.5",
28
+ "@ox-content/napi": "0.3.0-alpha.11"
33
29
  },
34
30
  "devDependencies": {
35
31
  "@types/hast": "^3.0.4",
36
- "@types/node": "catalog:",
37
- "tsup": "catalog:",
38
- "typescript": "catalog:",
39
- "vite": "catalog:"
32
+ "@types/node": "^22.0.0",
33
+ "@typescript/native-preview": "^7.0.0-dev.20250601",
34
+ "tsdown": "^0.12.0",
35
+ "typescript": "^5.7.0",
36
+ "vite": "^8.0.0-beta.0",
37
+ "yaml": "^2.8.2"
40
38
  },
41
39
  "keywords": [
42
40
  "vite",
@@ -55,5 +53,10 @@
55
53
  },
56
54
  "publishConfig": {
57
55
  "access": "public"
56
+ },
57
+ "scripts": {
58
+ "build": "tsdown",
59
+ "dev": "tsdown --watch",
60
+ "typecheck": "tsgo --noEmit"
58
61
  }
59
- }
62
+ }