@utilix-tech/sdk 0.1.2 → 0.1.4

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/index.cjs CHANGED
@@ -9798,10 +9798,13 @@ __export(code_exports, {
9798
9798
  buildGitCommand: () => buildGitCommand,
9799
9799
  collapseHtmlWhitespace: () => collapseHtmlWhitespace,
9800
9800
  collapseJsWhitespace: () => collapseJsWhitespace,
9801
+ countProperties: () => countProperties,
9802
+ countRules: () => countRules,
9801
9803
  detectDialect: () => detectDialect,
9802
9804
  detectOperationType: () => detectOperationType,
9803
9805
  envToExport: () => envToExport2,
9804
9806
  envToJson: () => envToJson2,
9807
+ formatCss: () => formatCss,
9805
9808
  formatGql: () => formatGql,
9806
9809
  formatHtml: () => formatHtml,
9807
9810
  formatSql: () => formatSql,
@@ -9810,6 +9813,7 @@ __export(code_exports, {
9810
9813
  getJsStats: () => getJsStats,
9811
9814
  getMethodColor: () => getMethodColor,
9812
9815
  isValidTag: () => isValidTag,
9816
+ minifyCss: () => minifyCss,
9813
9817
  minifyGql: () => minifyGql,
9814
9818
  minifyHtml: () => minifyHtml,
9815
9819
  minifyJs: () => minifyJs,
@@ -11996,6 +12000,69 @@ function envToExport2(input) {
11996
12000
  function validateEnvKey2(key) {
11997
12001
  return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key);
11998
12002
  }
12003
+ function _calcCssResult(input, output) {
12004
+ const originalSize = input.length;
12005
+ const outputSize = output.length;
12006
+ const savingsPercent = originalSize === 0 ? 0 : Math.round((originalSize - outputSize) / originalSize * 100 * 100) / 100;
12007
+ return { output, originalSize, outputSize, savingsPercent };
12008
+ }
12009
+ function minifyCss(input) {
12010
+ let output = input;
12011
+ output = output.replace(/\/\*[\s\S]*?\*\//g, "");
12012
+ output = output.replace(/\s+/g, " ");
12013
+ output = output.replace(/\s*{\s*/g, "{");
12014
+ output = output.replace(/\s*}\s*/g, "}");
12015
+ output = output.replace(/\s*:\s*/g, ":");
12016
+ output = output.replace(/\s*;\s*/g, ";");
12017
+ output = output.replace(/\s*,\s*/g, ",");
12018
+ output = output.replace(/;}/g, "}");
12019
+ output = output.trim();
12020
+ return _calcCssResult(input, output);
12021
+ }
12022
+ function formatCss(input, indentSize = 2) {
12023
+ const indent = " ".repeat(indentSize);
12024
+ const { output: minified } = minifyCss(input);
12025
+ let result = "";
12026
+ let insideBlock = false;
12027
+ let i = 0;
12028
+ while (i < minified.length) {
12029
+ const char = minified[i];
12030
+ if (char === "{") {
12031
+ result += " {\n";
12032
+ insideBlock = true;
12033
+ } else if (char === "}") {
12034
+ result = result.trimEnd() + "\n";
12035
+ result += "}\n\n";
12036
+ insideBlock = false;
12037
+ } else if (char === ";" && insideBlock) {
12038
+ result += ";\n";
12039
+ if (i + 1 < minified.length && minified[i + 1] !== "}") result += indent;
12040
+ } else {
12041
+ if (insideBlock && result.endsWith("{\n")) result += indent;
12042
+ result += char;
12043
+ }
12044
+ i++;
12045
+ }
12046
+ return _calcCssResult(input, result.trimEnd());
12047
+ }
12048
+ function countRules(css) {
12049
+ return (css.match(/{/g) ?? []).length;
12050
+ }
12051
+ function countProperties(css) {
12052
+ let count = 0;
12053
+ let insideBlock = false;
12054
+ for (const char of css) {
12055
+ if (char === "{") insideBlock = true;
12056
+ else if (char === "}") insideBlock = false;
12057
+ else if (char === ";" && insideBlock) count++;
12058
+ }
12059
+ css.replace(/{[^{}]*}/g, (block) => {
12060
+ const last = block.slice(1, -1).trim().split(";").pop()?.trim();
12061
+ if (last?.includes(":")) count++;
12062
+ return block;
12063
+ });
12064
+ return count;
12065
+ }
11999
12066
 
12000
12067
  // src/tools/color.ts
12001
12068
  var color_exports = {};
@@ -13139,10 +13206,10 @@ __export(css_exports, {
13139
13206
  calcClamp: () => calcClamp,
13140
13207
  calcSpecificity: () => calcSpecificity,
13141
13208
  compareSpecificity: () => compareSpecificity,
13142
- countProperties: () => countProperties,
13143
- countRules: () => countRules,
13209
+ countProperties: () => countProperties2,
13210
+ countRules: () => countRules2,
13144
13211
  explainSelector: () => explainSelector,
13145
- formatCss: () => formatCss,
13212
+ formatCss: () => formatCss2,
13146
13213
  generateAnimationCSS: () => generateAnimationCSS,
13147
13214
  generateBorderRadius: () => generateBorderRadius,
13148
13215
  generateBoxShadow: () => generateBoxShadow,
@@ -13156,7 +13223,7 @@ __export(css_exports, {
13156
13223
  generateKeyframesCSS: () => generateKeyframesCSS,
13157
13224
  getCurvePoints: () => getCurvePoints,
13158
13225
  isUniform: () => isUniform,
13159
- minifyCss: () => minifyCss,
13226
+ minifyCss: () => minifyCss2,
13160
13227
  multipleSelectors: () => multipleSelectors,
13161
13228
  parseBorderRadius: () => parseBorderRadius,
13162
13229
  parseBoxShadow: () => parseBoxShadow,
@@ -14032,7 +14099,7 @@ function calcCssResult(input, output) {
14032
14099
  const savingsPercent = originalSize === 0 ? 0 : Math.round((originalSize - outputSize) / originalSize * 100 * 100) / 100;
14033
14100
  return { output, originalSize, outputSize, savingsPercent };
14034
14101
  }
14035
- function minifyCss(input) {
14102
+ function minifyCss2(input) {
14036
14103
  let output = input;
14037
14104
  output = output.replace(/\/\*[\s\S]*?\*\//g, "");
14038
14105
  output = output.replace(/\s+/g, " ");
@@ -14045,9 +14112,9 @@ function minifyCss(input) {
14045
14112
  output = output.trim();
14046
14113
  return calcCssResult(input, output);
14047
14114
  }
14048
- function formatCss(input, indentSize = 2) {
14115
+ function formatCss2(input, indentSize = 2) {
14049
14116
  const indent = " ".repeat(indentSize);
14050
- const { output: minified } = minifyCss(input);
14117
+ const { output: minified } = minifyCss2(input);
14051
14118
  let result = "";
14052
14119
  let insideBlock = false;
14053
14120
  let i = 0;
@@ -14079,11 +14146,11 @@ function formatCss(input, indentSize = 2) {
14079
14146
  const output = result.trimEnd();
14080
14147
  return calcCssResult(input, output);
14081
14148
  }
14082
- function countRules(css) {
14149
+ function countRules2(css) {
14083
14150
  const matches = css.match(/{/g);
14084
14151
  return matches ? matches.length : 0;
14085
14152
  }
14086
- function countProperties(css) {
14153
+ function countProperties2(css) {
14087
14154
  let count = 0;
14088
14155
  let insideBlock = false;
14089
14156
  for (let i = 0; i < css.length; i++) {
@@ -14369,6 +14436,7 @@ __export(misc_exports, {
14369
14436
  COLOR_PRESETS: () => COLOR_PRESETS,
14370
14437
  DATA_TYPES: () => DATA_TYPES2,
14371
14438
  DEFAULT_CONFIG: () => DEFAULT_CONFIG2,
14439
+ DEFAULT_QR_OPTIONS: () => DEFAULT_QR_OPTIONS2,
14372
14440
  FORMAT_EXTENSIONS: () => FORMAT_EXTENSIONS,
14373
14441
  FORMAT_LABELS: () => FORMAT_LABELS,
14374
14442
  analyzeString: () => analyzeString,
@@ -14384,6 +14452,9 @@ __export(misc_exports, {
14384
14452
  formatSvg: () => formatSvg,
14385
14453
  fromUnicodeEscape: () => fromUnicodeEscape,
14386
14454
  generateData: () => generateData2,
14455
+ generateMetaHtml: () => generateMetaHtml2,
14456
+ generateQrDataUrl: () => generateQrDataUrl2,
14457
+ generateQrSvg: () => generateQrSvg2,
14387
14458
  generateSingle: () => generateSingle2,
14388
14459
  generateSvgFavicon: () => generateSvgFavicon,
14389
14460
  getConversionWarnings: () => getConversionWarnings,
@@ -14397,10 +14468,12 @@ __export(misc_exports, {
14397
14468
  numberToWords: () => numberToWords2,
14398
14469
  optimizeSvg: () => optimizeSvg,
14399
14470
  ordinalWords: () => ordinalWords2,
14471
+ parseMetaTags: () => parseMetaTags2,
14400
14472
  romanToNumber: () => romanToNumber2,
14401
14473
  sanitizeSvg: () => sanitizeSvg,
14402
14474
  svgToDataUrl: () => svgToDataUrl,
14403
- toUnicodeEscape: () => toUnicodeEscape
14475
+ toUnicodeEscape: () => toUnicodeEscape,
14476
+ validateOgTags: () => validateOgTags2
14404
14477
  });
14405
14478
  var NAMED_HTML_ENTITIES = {
14406
14479
  34: "&quot;",
@@ -15445,6 +15518,130 @@ function generateData2(config) {
15445
15518
  }
15446
15519
  return results;
15447
15520
  }
15521
+ var DEFAULT_QR_OPTIONS2 = {
15522
+ errorLevel: "M",
15523
+ size: 256,
15524
+ margin: 1,
15525
+ darkColor: "#000000",
15526
+ lightColor: "#ffffff"
15527
+ };
15528
+ async function generateQrSvg2(text, options) {
15529
+ const o = { ...DEFAULT_QR_OPTIONS2, ...options };
15530
+ return QRCode__default.default.toString(text, {
15531
+ type: "svg",
15532
+ errorCorrectionLevel: o.errorLevel,
15533
+ margin: o.margin,
15534
+ color: { dark: o.darkColor, light: o.lightColor }
15535
+ });
15536
+ }
15537
+ async function generateQrDataUrl2(text, options) {
15538
+ const o = { ...DEFAULT_QR_OPTIONS2, ...options };
15539
+ return QRCode__default.default.toDataURL(text, {
15540
+ width: o.size,
15541
+ errorCorrectionLevel: o.errorLevel,
15542
+ margin: o.margin,
15543
+ color: { dark: o.darkColor, light: o.lightColor }
15544
+ });
15545
+ }
15546
+ function _getMetaContent(html, property) {
15547
+ const esc = property.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
15548
+ const patterns = [
15549
+ new RegExp(`<meta[^>]+property=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
15550
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+property=["']${esc}["']`, "i"),
15551
+ new RegExp(`<meta[^>]+name=["']${esc}["'][^>]+content=["']([^"']*)["']`, "i"),
15552
+ new RegExp(`<meta[^>]+content=["']([^"']*)["'][^>]+name=["']${esc}["']`, "i")
15553
+ ];
15554
+ for (const p of patterns) {
15555
+ const m = html.match(p);
15556
+ if (m) return m[1];
15557
+ }
15558
+ return void 0;
15559
+ }
15560
+ function parseMetaTags2(html) {
15561
+ const titleMatch = html.match(/<title[^>]*>([^<]*)<\/title>/i);
15562
+ const canonicalMatch = html.match(/<link[^>]+rel=["']canonical["'][^>]+href=["']([^"']*)["']/i) || html.match(/<link[^>]+href=["']([^"']*)["'][^>]+rel=["']canonical["']/i);
15563
+ const charsetMatch = html.match(/<meta[^>]+charset=["']([^"']*)["']/i) || html.match(/<meta[^>]+charset=([^\s>]*)/i);
15564
+ return {
15565
+ og: {
15566
+ title: _getMetaContent(html, "og:title"),
15567
+ description: _getMetaContent(html, "og:description"),
15568
+ image: _getMetaContent(html, "og:image"),
15569
+ imageAlt: _getMetaContent(html, "og:image:alt"),
15570
+ imageWidth: _getMetaContent(html, "og:image:width"),
15571
+ imageHeight: _getMetaContent(html, "og:image:height"),
15572
+ url: _getMetaContent(html, "og:url"),
15573
+ type: _getMetaContent(html, "og:type"),
15574
+ siteName: _getMetaContent(html, "og:site_name"),
15575
+ locale: _getMetaContent(html, "og:locale")
15576
+ },
15577
+ twitter: {
15578
+ card: _getMetaContent(html, "twitter:card"),
15579
+ site: _getMetaContent(html, "twitter:site"),
15580
+ creator: _getMetaContent(html, "twitter:creator"),
15581
+ title: _getMetaContent(html, "twitter:title"),
15582
+ description: _getMetaContent(html, "twitter:description"),
15583
+ image: _getMetaContent(html, "twitter:image")
15584
+ },
15585
+ standard: {
15586
+ title: titleMatch ? titleMatch[1].trim() : void 0,
15587
+ description: _getMetaContent(html, "description"),
15588
+ keywords: _getMetaContent(html, "keywords"),
15589
+ canonical: canonicalMatch ? canonicalMatch[1] : void 0,
15590
+ robots: _getMetaContent(html, "robots"),
15591
+ viewport: _getMetaContent(html, "viewport"),
15592
+ charset: charsetMatch ? charsetMatch[1] : void 0
15593
+ }
15594
+ };
15595
+ }
15596
+ function validateOgTags2(tags) {
15597
+ const warnings = [];
15598
+ const missing = [];
15599
+ const required = ["title", "description", "image", "url", "type"];
15600
+ for (const field of required) {
15601
+ if (!tags[field]) missing.push(`og:${field}`);
15602
+ }
15603
+ if (tags.image && !/^https?:\/\//i.test(tags.image))
15604
+ warnings.push("og:image should be an absolute URL");
15605
+ if (tags.url && !/^https?:\/\//i.test(tags.url))
15606
+ warnings.push("og:url should be an absolute URL");
15607
+ if (tags.title && tags.title.length > 95)
15608
+ warnings.push("og:title is longer than 95 characters and may be truncated");
15609
+ if (tags.description && tags.description.length > 300)
15610
+ warnings.push("og:description is longer than 300 characters and may be truncated");
15611
+ const standardTypes = ["website", "article", "video.movie", "video.episode", "music.song", "music.album", "book", "profile"];
15612
+ if (tags.type && !standardTypes.includes(tags.type))
15613
+ warnings.push(`og:type "${tags.type}" is not a standard type`);
15614
+ return { warnings, missing };
15615
+ }
15616
+ function generateMetaHtml2(tags) {
15617
+ const lines = [];
15618
+ const ogMap = {
15619
+ title: "og:title",
15620
+ description: "og:description",
15621
+ image: "og:image",
15622
+ imageAlt: "og:image:alt",
15623
+ imageWidth: "og:image:width",
15624
+ imageHeight: "og:image:height",
15625
+ url: "og:url",
15626
+ type: "og:type",
15627
+ siteName: "og:site_name",
15628
+ locale: "og:locale"
15629
+ };
15630
+ const twitterMap = {
15631
+ card: "twitter:card",
15632
+ site: "twitter:site",
15633
+ creator: "twitter:creator"
15634
+ };
15635
+ for (const [key, property] of Object.entries(ogMap)) {
15636
+ const v = tags[key];
15637
+ if (v) lines.push(`<meta property="${property}" content="${v}" />`);
15638
+ }
15639
+ for (const [key, name] of Object.entries(twitterMap)) {
15640
+ const v = tags[key];
15641
+ if (v) lines.push(`<meta name="${name}" content="${v}" />`);
15642
+ }
15643
+ return lines.join("\n");
15644
+ }
15448
15645
 
15449
15646
  // src/index.ts
15450
15647
  var version = "0.1.0";
package/dist/index.d.cts CHANGED
@@ -8,10 +8,10 @@ export { t as time } from './time-DbT8fjaF.cjs';
8
8
  export { u as units } from './units-6lwDYBvX.cjs';
9
9
  export { n as network } from './network-CNtmrDeN.cjs';
10
10
  export { a as api } from './api-8aZtWhSj.cjs';
11
- export { c as code } from './code-QNrdLIR3.cjs';
11
+ export { c as code } from './code-BUqyaofO.cjs';
12
12
  export { c as color } from './color-tPwZCr9H.cjs';
13
13
  export { c as css } from './css-Cf7AMGM-.cjs';
14
- export { m as misc } from './misc-DcVBManm.cjs';
14
+ export { m as misc } from './misc-CA3N198T.cjs';
15
15
 
16
16
  declare const version = "0.1.0";
17
17
 
package/dist/index.d.ts CHANGED
@@ -8,10 +8,10 @@ export { t as time } from './time-DbT8fjaF.js';
8
8
  export { u as units } from './units-6lwDYBvX.js';
9
9
  export { n as network } from './network-CNtmrDeN.js';
10
10
  export { a as api } from './api-8aZtWhSj.js';
11
- export { c as code } from './code-QNrdLIR3.js';
11
+ export { c as code } from './code-BUqyaofO.js';
12
12
  export { c as color } from './color-tPwZCr9H.js';
13
13
  export { c as css } from './css-Cf7AMGM-.js';
14
- export { m as misc } from './misc-DcVBManm.js';
14
+ export { m as misc } from './misc-CA3N198T.js';
15
15
 
16
16
  declare const version = "0.1.0";
17
17
 
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  export { units_exports as units } from './chunk-XST6X3HT.js';
2
2
  export { network_exports as network } from './chunk-3BAHSW4C.js';
3
3
  export { api_exports as api } from './chunk-W4UBLYFU.js';
4
- export { code_exports as code } from './chunk-ZKL2VX2G.js';
4
+ export { code_exports as code } from './chunk-NSOARQCM.js';
5
5
  export { color_exports as color } from './chunk-BPVAB4P2.js';
6
6
  export { css_exports as css } from './chunk-6YPV2AB5.js';
7
- export { misc_exports as misc } from './chunk-L6KCTHUW.js';
7
+ export { misc_exports as misc } from './chunk-OKSWDVOM.js';
8
8
  export { json_exports as json } from './chunk-TSAGO3XP.js';
9
9
  export { encoding_exports as encoding } from './chunk-ROTPLW7T.js';
10
10
  export { hashing_exports as hashing } from './chunk-FL53T24A.js';
@@ -12,6 +12,8 @@
12
12
  * FORMAT_EXTENSIONS, FORMAT_LABELS
13
13
  * - number-words : numberToWords, numberToOrdinal, ordinalWords, numberToRoman, romanToNumber
14
14
  * - random-data : generateSingle, generateData, DATA_TYPES
15
+ * - qr-code : generateQrSvg, generateQrDataUrl (SVG works in Node; dataUrl needs canvas)
16
+ * - og-meta : parseMetaTags, validateOgTags, generateMetaHtml
15
17
  *
16
18
  * NOTE: Canvas-based image compression/conversion is not supported in Node. The relevant
17
19
  * functions (compressImage, convertImage) are intentionally omitted; use the REST API or
@@ -147,6 +149,58 @@ declare const DATA_TYPES: {
147
149
  }[];
148
150
  declare function generateSingle(type: DataType, options?: RandomConfig['options']): string;
149
151
  declare function generateData(config: RandomConfig): string[];
152
+ type QrErrorLevel = 'L' | 'M' | 'Q' | 'H';
153
+ interface QrOptions {
154
+ errorLevel?: QrErrorLevel;
155
+ size?: number;
156
+ margin?: number;
157
+ darkColor?: string;
158
+ lightColor?: string;
159
+ }
160
+ declare const DEFAULT_QR_OPTIONS: QrOptions;
161
+ /** Returns an SVG string — works in Node without canvas. */
162
+ declare function generateQrSvg(text: string, options?: QrOptions): Promise<string>;
163
+ /** Returns a data URL (PNG). Requires a canvas implementation in Node — use generateQrSvg for a canvas-free alternative. */
164
+ declare function generateQrDataUrl(text: string, options?: QrOptions): Promise<string>;
165
+ interface OgTags {
166
+ title?: string;
167
+ description?: string;
168
+ image?: string;
169
+ imageAlt?: string;
170
+ imageWidth?: string;
171
+ imageHeight?: string;
172
+ url?: string;
173
+ type?: string;
174
+ siteName?: string;
175
+ locale?: string;
176
+ }
177
+ interface TwitterTags {
178
+ card?: string;
179
+ site?: string;
180
+ creator?: string;
181
+ title?: string;
182
+ description?: string;
183
+ image?: string;
184
+ }
185
+ interface MetaTags {
186
+ og: OgTags;
187
+ twitter: TwitterTags;
188
+ standard: {
189
+ title?: string;
190
+ description?: string;
191
+ keywords?: string;
192
+ canonical?: string;
193
+ robots?: string;
194
+ viewport?: string;
195
+ charset?: string;
196
+ };
197
+ }
198
+ declare function parseMetaTags(html: string): MetaTags;
199
+ declare function validateOgTags(tags: OgTags): {
200
+ warnings: string[];
201
+ missing: string[];
202
+ };
203
+ declare function generateMetaHtml(tags: Partial<OgTags & TwitterTags>): string;
150
204
 
151
205
  declare const misc_COLOR_PRESETS: typeof COLOR_PRESETS;
152
206
  type misc_CodePoint = CodePoint;
@@ -156,14 +210,20 @@ type misc_ConversionOptions = ConversionOptions;
156
210
  type misc_ConvertImageFormat = ConvertImageFormat;
157
211
  declare const misc_DATA_TYPES: typeof DATA_TYPES;
158
212
  declare const misc_DEFAULT_CONFIG: typeof DEFAULT_CONFIG;
213
+ declare const misc_DEFAULT_QR_OPTIONS: typeof DEFAULT_QR_OPTIONS;
159
214
  type misc_DataType = DataType;
160
215
  declare const misc_FORMAT_EXTENSIONS: typeof FORMAT_EXTENSIONS;
161
216
  declare const misc_FORMAT_LABELS: typeof FORMAT_LABELS;
162
217
  type misc_FaviconConfig = FaviconConfig;
163
218
  type misc_ImageFormat = ImageFormat;
219
+ type misc_MetaTags = MetaTags;
220
+ type misc_OgTags = OgTags;
221
+ type misc_QrErrorLevel = QrErrorLevel;
222
+ type misc_QrOptions = QrOptions;
164
223
  type misc_RandomConfig = RandomConfig;
165
224
  type misc_Shape = Shape;
166
225
  type misc_SvgInfo = SvgInfo;
226
+ type misc_TwitterTags = TwitterTags;
167
227
  declare const misc_analyzeString: typeof analyzeString;
168
228
  declare const misc_analyzeSvg: typeof analyzeSvg;
169
229
  declare const misc_calcResizeDimensions: typeof calcResizeDimensions;
@@ -177,6 +237,9 @@ declare const misc_formatLabel: typeof formatLabel;
177
237
  declare const misc_formatSvg: typeof formatSvg;
178
238
  declare const misc_fromUnicodeEscape: typeof fromUnicodeEscape;
179
239
  declare const misc_generateData: typeof generateData;
240
+ declare const misc_generateMetaHtml: typeof generateMetaHtml;
241
+ declare const misc_generateQrDataUrl: typeof generateQrDataUrl;
242
+ declare const misc_generateQrSvg: typeof generateQrSvg;
180
243
  declare const misc_generateSingle: typeof generateSingle;
181
244
  declare const misc_generateSvgFavicon: typeof generateSvgFavicon;
182
245
  declare const misc_getConversionWarnings: typeof getConversionWarnings;
@@ -190,12 +253,14 @@ declare const misc_numberToRoman: typeof numberToRoman;
190
253
  declare const misc_numberToWords: typeof numberToWords;
191
254
  declare const misc_optimizeSvg: typeof optimizeSvg;
192
255
  declare const misc_ordinalWords: typeof ordinalWords;
256
+ declare const misc_parseMetaTags: typeof parseMetaTags;
193
257
  declare const misc_romanToNumber: typeof romanToNumber;
194
258
  declare const misc_sanitizeSvg: typeof sanitizeSvg;
195
259
  declare const misc_svgToDataUrl: typeof svgToDataUrl;
196
260
  declare const misc_toUnicodeEscape: typeof toUnicodeEscape;
261
+ declare const misc_validateOgTags: typeof validateOgTags;
197
262
  declare namespace misc {
198
- export { misc_COLOR_PRESETS as COLOR_PRESETS, type misc_CodePoint as CodePoint, type misc_CompressionOptions as CompressionOptions, type misc_CompressionResult as CompressionResult, type misc_ConversionOptions as ConversionOptions, type misc_ConvertImageFormat as ConvertImageFormat, misc_DATA_TYPES as DATA_TYPES, misc_DEFAULT_CONFIG as DEFAULT_CONFIG, type misc_DataType as DataType, misc_FORMAT_EXTENSIONS as FORMAT_EXTENSIONS, misc_FORMAT_LABELS as FORMAT_LABELS, type misc_FaviconConfig as FaviconConfig, type misc_ImageFormat as ImageFormat, type misc_RandomConfig as RandomConfig, type misc_Shape as Shape, type misc_SvgInfo as SvgInfo, misc_analyzeString as analyzeString, misc_analyzeSvg as analyzeSvg, misc_calcResizeDimensions as calcResizeDimensions, misc_calcSavings as calcSavings, misc_charToCodePoint as charToCodePoint, misc_codePointToChar as codePointToChar, misc_detectFormatFromDataUrl as detectFormatFromDataUrl, misc_detectFormatFromFilename as detectFormatFromFilename, misc_formatBytes as formatBytes, misc_formatLabel as formatLabel, misc_formatSvg as formatSvg, misc_fromUnicodeEscape as fromUnicodeEscape, misc_generateData as generateData, misc_generateSingle as generateSingle, misc_generateSvgFavicon as generateSvgFavicon, misc_getConversionWarnings as getConversionWarnings, misc_getDefaultQuality as getDefaultQuality, misc_getDownloadFilename as getDownloadFilename, misc_getSupportedFormats as getSupportedFormats, misc_getSupportedOutputFormats as getSupportedOutputFormats, misc_minifySvg as minifySvg, misc_numberToOrdinal as numberToOrdinal, misc_numberToRoman as numberToRoman, misc_numberToWords as numberToWords, misc_optimizeSvg as optimizeSvg, misc_ordinalWords as ordinalWords, misc_romanToNumber as romanToNumber, misc_sanitizeSvg as sanitizeSvg, misc_svgToDataUrl as svgToDataUrl, misc_toUnicodeEscape as toUnicodeEscape };
263
+ export { misc_COLOR_PRESETS as COLOR_PRESETS, type misc_CodePoint as CodePoint, type misc_CompressionOptions as CompressionOptions, type misc_CompressionResult as CompressionResult, type misc_ConversionOptions as ConversionOptions, type misc_ConvertImageFormat as ConvertImageFormat, misc_DATA_TYPES as DATA_TYPES, misc_DEFAULT_CONFIG as DEFAULT_CONFIG, misc_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type misc_DataType as DataType, misc_FORMAT_EXTENSIONS as FORMAT_EXTENSIONS, misc_FORMAT_LABELS as FORMAT_LABELS, type misc_FaviconConfig as FaviconConfig, type misc_ImageFormat as ImageFormat, type misc_MetaTags as MetaTags, type misc_OgTags as OgTags, type misc_QrErrorLevel as QrErrorLevel, type misc_QrOptions as QrOptions, type misc_RandomConfig as RandomConfig, type misc_Shape as Shape, type misc_SvgInfo as SvgInfo, type misc_TwitterTags as TwitterTags, misc_analyzeString as analyzeString, misc_analyzeSvg as analyzeSvg, misc_calcResizeDimensions as calcResizeDimensions, misc_calcSavings as calcSavings, misc_charToCodePoint as charToCodePoint, misc_codePointToChar as codePointToChar, misc_detectFormatFromDataUrl as detectFormatFromDataUrl, misc_detectFormatFromFilename as detectFormatFromFilename, misc_formatBytes as formatBytes, misc_formatLabel as formatLabel, misc_formatSvg as formatSvg, misc_fromUnicodeEscape as fromUnicodeEscape, misc_generateData as generateData, misc_generateMetaHtml as generateMetaHtml, misc_generateQrDataUrl as generateQrDataUrl, misc_generateQrSvg as generateQrSvg, misc_generateSingle as generateSingle, misc_generateSvgFavicon as generateSvgFavicon, misc_getConversionWarnings as getConversionWarnings, misc_getDefaultQuality as getDefaultQuality, misc_getDownloadFilename as getDownloadFilename, misc_getSupportedFormats as getSupportedFormats, misc_getSupportedOutputFormats as getSupportedOutputFormats, misc_minifySvg as minifySvg, misc_numberToOrdinal as numberToOrdinal, misc_numberToRoman as numberToRoman, misc_numberToWords as numberToWords, misc_optimizeSvg as optimizeSvg, misc_ordinalWords as ordinalWords, misc_parseMetaTags as parseMetaTags, misc_romanToNumber as romanToNumber, misc_sanitizeSvg as sanitizeSvg, misc_svgToDataUrl as svgToDataUrl, misc_toUnicodeEscape as toUnicodeEscape, misc_validateOgTags as validateOgTags };
199
264
  }
200
265
 
201
- export { getConversionWarnings as A, getDefaultQuality as B, COLOR_PRESETS as C, DATA_TYPES as D, getDownloadFilename as E, FORMAT_EXTENSIONS as F, getSupportedFormats as G, getSupportedOutputFormats as H, type ImageFormat as I, minifySvg as J, numberToOrdinal as K, numberToRoman as L, numberToWords as M, optimizeSvg as N, ordinalWords as O, romanToNumber as P, sanitizeSvg as Q, type RandomConfig as R, type Shape as S, svgToDataUrl as T, toUnicodeEscape as U, type CodePoint as a, type CompressionOptions as b, type CompressionResult as c, type ConversionOptions as d, type ConvertImageFormat as e, DEFAULT_CONFIG as f, type DataType as g, FORMAT_LABELS as h, type FaviconConfig as i, type SvgInfo as j, analyzeString as k, analyzeSvg as l, misc as m, calcResizeDimensions as n, calcSavings as o, charToCodePoint as p, codePointToChar as q, detectFormatFromDataUrl as r, detectFormatFromFilename as s, formatBytes as t, formatLabel as u, formatSvg as v, fromUnicodeEscape as w, generateData as x, generateSingle as y, generateSvgFavicon as z };
266
+ export { romanToNumber as $, generateMetaHtml as A, generateQrDataUrl as B, COLOR_PRESETS as C, DATA_TYPES as D, generateQrSvg as E, FORMAT_EXTENSIONS as F, generateSingle as G, generateSvgFavicon as H, type ImageFormat as I, getConversionWarnings as J, getDefaultQuality as K, getDownloadFilename as L, type MetaTags as M, getSupportedFormats as N, type OgTags as O, getSupportedOutputFormats as P, type QrErrorLevel as Q, type RandomConfig as R, type Shape as S, type TwitterTags as T, minifySvg as U, numberToOrdinal as V, numberToRoman as W, numberToWords as X, optimizeSvg as Y, ordinalWords as Z, parseMetaTags as _, type CodePoint as a, sanitizeSvg as a0, svgToDataUrl as a1, toUnicodeEscape as a2, validateOgTags as a3, type CompressionOptions as b, type CompressionResult as c, type ConversionOptions as d, type ConvertImageFormat as e, DEFAULT_CONFIG as f, DEFAULT_QR_OPTIONS as g, type DataType as h, FORMAT_LABELS as i, type FaviconConfig as j, type QrOptions as k, type SvgInfo as l, misc as m, analyzeString as n, analyzeSvg as o, calcResizeDimensions as p, calcSavings as q, charToCodePoint as r, codePointToChar as s, detectFormatFromDataUrl as t, detectFormatFromFilename as u, formatBytes as v, formatLabel as w, formatSvg as x, fromUnicodeEscape as y, generateData as z };
@@ -12,6 +12,8 @@
12
12
  * FORMAT_EXTENSIONS, FORMAT_LABELS
13
13
  * - number-words : numberToWords, numberToOrdinal, ordinalWords, numberToRoman, romanToNumber
14
14
  * - random-data : generateSingle, generateData, DATA_TYPES
15
+ * - qr-code : generateQrSvg, generateQrDataUrl (SVG works in Node; dataUrl needs canvas)
16
+ * - og-meta : parseMetaTags, validateOgTags, generateMetaHtml
15
17
  *
16
18
  * NOTE: Canvas-based image compression/conversion is not supported in Node. The relevant
17
19
  * functions (compressImage, convertImage) are intentionally omitted; use the REST API or
@@ -147,6 +149,58 @@ declare const DATA_TYPES: {
147
149
  }[];
148
150
  declare function generateSingle(type: DataType, options?: RandomConfig['options']): string;
149
151
  declare function generateData(config: RandomConfig): string[];
152
+ type QrErrorLevel = 'L' | 'M' | 'Q' | 'H';
153
+ interface QrOptions {
154
+ errorLevel?: QrErrorLevel;
155
+ size?: number;
156
+ margin?: number;
157
+ darkColor?: string;
158
+ lightColor?: string;
159
+ }
160
+ declare const DEFAULT_QR_OPTIONS: QrOptions;
161
+ /** Returns an SVG string — works in Node without canvas. */
162
+ declare function generateQrSvg(text: string, options?: QrOptions): Promise<string>;
163
+ /** Returns a data URL (PNG). Requires a canvas implementation in Node — use generateQrSvg for a canvas-free alternative. */
164
+ declare function generateQrDataUrl(text: string, options?: QrOptions): Promise<string>;
165
+ interface OgTags {
166
+ title?: string;
167
+ description?: string;
168
+ image?: string;
169
+ imageAlt?: string;
170
+ imageWidth?: string;
171
+ imageHeight?: string;
172
+ url?: string;
173
+ type?: string;
174
+ siteName?: string;
175
+ locale?: string;
176
+ }
177
+ interface TwitterTags {
178
+ card?: string;
179
+ site?: string;
180
+ creator?: string;
181
+ title?: string;
182
+ description?: string;
183
+ image?: string;
184
+ }
185
+ interface MetaTags {
186
+ og: OgTags;
187
+ twitter: TwitterTags;
188
+ standard: {
189
+ title?: string;
190
+ description?: string;
191
+ keywords?: string;
192
+ canonical?: string;
193
+ robots?: string;
194
+ viewport?: string;
195
+ charset?: string;
196
+ };
197
+ }
198
+ declare function parseMetaTags(html: string): MetaTags;
199
+ declare function validateOgTags(tags: OgTags): {
200
+ warnings: string[];
201
+ missing: string[];
202
+ };
203
+ declare function generateMetaHtml(tags: Partial<OgTags & TwitterTags>): string;
150
204
 
151
205
  declare const misc_COLOR_PRESETS: typeof COLOR_PRESETS;
152
206
  type misc_CodePoint = CodePoint;
@@ -156,14 +210,20 @@ type misc_ConversionOptions = ConversionOptions;
156
210
  type misc_ConvertImageFormat = ConvertImageFormat;
157
211
  declare const misc_DATA_TYPES: typeof DATA_TYPES;
158
212
  declare const misc_DEFAULT_CONFIG: typeof DEFAULT_CONFIG;
213
+ declare const misc_DEFAULT_QR_OPTIONS: typeof DEFAULT_QR_OPTIONS;
159
214
  type misc_DataType = DataType;
160
215
  declare const misc_FORMAT_EXTENSIONS: typeof FORMAT_EXTENSIONS;
161
216
  declare const misc_FORMAT_LABELS: typeof FORMAT_LABELS;
162
217
  type misc_FaviconConfig = FaviconConfig;
163
218
  type misc_ImageFormat = ImageFormat;
219
+ type misc_MetaTags = MetaTags;
220
+ type misc_OgTags = OgTags;
221
+ type misc_QrErrorLevel = QrErrorLevel;
222
+ type misc_QrOptions = QrOptions;
164
223
  type misc_RandomConfig = RandomConfig;
165
224
  type misc_Shape = Shape;
166
225
  type misc_SvgInfo = SvgInfo;
226
+ type misc_TwitterTags = TwitterTags;
167
227
  declare const misc_analyzeString: typeof analyzeString;
168
228
  declare const misc_analyzeSvg: typeof analyzeSvg;
169
229
  declare const misc_calcResizeDimensions: typeof calcResizeDimensions;
@@ -177,6 +237,9 @@ declare const misc_formatLabel: typeof formatLabel;
177
237
  declare const misc_formatSvg: typeof formatSvg;
178
238
  declare const misc_fromUnicodeEscape: typeof fromUnicodeEscape;
179
239
  declare const misc_generateData: typeof generateData;
240
+ declare const misc_generateMetaHtml: typeof generateMetaHtml;
241
+ declare const misc_generateQrDataUrl: typeof generateQrDataUrl;
242
+ declare const misc_generateQrSvg: typeof generateQrSvg;
180
243
  declare const misc_generateSingle: typeof generateSingle;
181
244
  declare const misc_generateSvgFavicon: typeof generateSvgFavicon;
182
245
  declare const misc_getConversionWarnings: typeof getConversionWarnings;
@@ -190,12 +253,14 @@ declare const misc_numberToRoman: typeof numberToRoman;
190
253
  declare const misc_numberToWords: typeof numberToWords;
191
254
  declare const misc_optimizeSvg: typeof optimizeSvg;
192
255
  declare const misc_ordinalWords: typeof ordinalWords;
256
+ declare const misc_parseMetaTags: typeof parseMetaTags;
193
257
  declare const misc_romanToNumber: typeof romanToNumber;
194
258
  declare const misc_sanitizeSvg: typeof sanitizeSvg;
195
259
  declare const misc_svgToDataUrl: typeof svgToDataUrl;
196
260
  declare const misc_toUnicodeEscape: typeof toUnicodeEscape;
261
+ declare const misc_validateOgTags: typeof validateOgTags;
197
262
  declare namespace misc {
198
- export { misc_COLOR_PRESETS as COLOR_PRESETS, type misc_CodePoint as CodePoint, type misc_CompressionOptions as CompressionOptions, type misc_CompressionResult as CompressionResult, type misc_ConversionOptions as ConversionOptions, type misc_ConvertImageFormat as ConvertImageFormat, misc_DATA_TYPES as DATA_TYPES, misc_DEFAULT_CONFIG as DEFAULT_CONFIG, type misc_DataType as DataType, misc_FORMAT_EXTENSIONS as FORMAT_EXTENSIONS, misc_FORMAT_LABELS as FORMAT_LABELS, type misc_FaviconConfig as FaviconConfig, type misc_ImageFormat as ImageFormat, type misc_RandomConfig as RandomConfig, type misc_Shape as Shape, type misc_SvgInfo as SvgInfo, misc_analyzeString as analyzeString, misc_analyzeSvg as analyzeSvg, misc_calcResizeDimensions as calcResizeDimensions, misc_calcSavings as calcSavings, misc_charToCodePoint as charToCodePoint, misc_codePointToChar as codePointToChar, misc_detectFormatFromDataUrl as detectFormatFromDataUrl, misc_detectFormatFromFilename as detectFormatFromFilename, misc_formatBytes as formatBytes, misc_formatLabel as formatLabel, misc_formatSvg as formatSvg, misc_fromUnicodeEscape as fromUnicodeEscape, misc_generateData as generateData, misc_generateSingle as generateSingle, misc_generateSvgFavicon as generateSvgFavicon, misc_getConversionWarnings as getConversionWarnings, misc_getDefaultQuality as getDefaultQuality, misc_getDownloadFilename as getDownloadFilename, misc_getSupportedFormats as getSupportedFormats, misc_getSupportedOutputFormats as getSupportedOutputFormats, misc_minifySvg as minifySvg, misc_numberToOrdinal as numberToOrdinal, misc_numberToRoman as numberToRoman, misc_numberToWords as numberToWords, misc_optimizeSvg as optimizeSvg, misc_ordinalWords as ordinalWords, misc_romanToNumber as romanToNumber, misc_sanitizeSvg as sanitizeSvg, misc_svgToDataUrl as svgToDataUrl, misc_toUnicodeEscape as toUnicodeEscape };
263
+ export { misc_COLOR_PRESETS as COLOR_PRESETS, type misc_CodePoint as CodePoint, type misc_CompressionOptions as CompressionOptions, type misc_CompressionResult as CompressionResult, type misc_ConversionOptions as ConversionOptions, type misc_ConvertImageFormat as ConvertImageFormat, misc_DATA_TYPES as DATA_TYPES, misc_DEFAULT_CONFIG as DEFAULT_CONFIG, misc_DEFAULT_QR_OPTIONS as DEFAULT_QR_OPTIONS, type misc_DataType as DataType, misc_FORMAT_EXTENSIONS as FORMAT_EXTENSIONS, misc_FORMAT_LABELS as FORMAT_LABELS, type misc_FaviconConfig as FaviconConfig, type misc_ImageFormat as ImageFormat, type misc_MetaTags as MetaTags, type misc_OgTags as OgTags, type misc_QrErrorLevel as QrErrorLevel, type misc_QrOptions as QrOptions, type misc_RandomConfig as RandomConfig, type misc_Shape as Shape, type misc_SvgInfo as SvgInfo, type misc_TwitterTags as TwitterTags, misc_analyzeString as analyzeString, misc_analyzeSvg as analyzeSvg, misc_calcResizeDimensions as calcResizeDimensions, misc_calcSavings as calcSavings, misc_charToCodePoint as charToCodePoint, misc_codePointToChar as codePointToChar, misc_detectFormatFromDataUrl as detectFormatFromDataUrl, misc_detectFormatFromFilename as detectFormatFromFilename, misc_formatBytes as formatBytes, misc_formatLabel as formatLabel, misc_formatSvg as formatSvg, misc_fromUnicodeEscape as fromUnicodeEscape, misc_generateData as generateData, misc_generateMetaHtml as generateMetaHtml, misc_generateQrDataUrl as generateQrDataUrl, misc_generateQrSvg as generateQrSvg, misc_generateSingle as generateSingle, misc_generateSvgFavicon as generateSvgFavicon, misc_getConversionWarnings as getConversionWarnings, misc_getDefaultQuality as getDefaultQuality, misc_getDownloadFilename as getDownloadFilename, misc_getSupportedFormats as getSupportedFormats, misc_getSupportedOutputFormats as getSupportedOutputFormats, misc_minifySvg as minifySvg, misc_numberToOrdinal as numberToOrdinal, misc_numberToRoman as numberToRoman, misc_numberToWords as numberToWords, misc_optimizeSvg as optimizeSvg, misc_ordinalWords as ordinalWords, misc_parseMetaTags as parseMetaTags, misc_romanToNumber as romanToNumber, misc_sanitizeSvg as sanitizeSvg, misc_svgToDataUrl as svgToDataUrl, misc_toUnicodeEscape as toUnicodeEscape, misc_validateOgTags as validateOgTags };
199
264
  }
200
265
 
201
- export { getConversionWarnings as A, getDefaultQuality as B, COLOR_PRESETS as C, DATA_TYPES as D, getDownloadFilename as E, FORMAT_EXTENSIONS as F, getSupportedFormats as G, getSupportedOutputFormats as H, type ImageFormat as I, minifySvg as J, numberToOrdinal as K, numberToRoman as L, numberToWords as M, optimizeSvg as N, ordinalWords as O, romanToNumber as P, sanitizeSvg as Q, type RandomConfig as R, type Shape as S, svgToDataUrl as T, toUnicodeEscape as U, type CodePoint as a, type CompressionOptions as b, type CompressionResult as c, type ConversionOptions as d, type ConvertImageFormat as e, DEFAULT_CONFIG as f, type DataType as g, FORMAT_LABELS as h, type FaviconConfig as i, type SvgInfo as j, analyzeString as k, analyzeSvg as l, misc as m, calcResizeDimensions as n, calcSavings as o, charToCodePoint as p, codePointToChar as q, detectFormatFromDataUrl as r, detectFormatFromFilename as s, formatBytes as t, formatLabel as u, formatSvg as v, fromUnicodeEscape as w, generateData as x, generateSingle as y, generateSvgFavicon as z };
266
+ export { romanToNumber as $, generateMetaHtml as A, generateQrDataUrl as B, COLOR_PRESETS as C, DATA_TYPES as D, generateQrSvg as E, FORMAT_EXTENSIONS as F, generateSingle as G, generateSvgFavicon as H, type ImageFormat as I, getConversionWarnings as J, getDefaultQuality as K, getDownloadFilename as L, type MetaTags as M, getSupportedFormats as N, type OgTags as O, getSupportedOutputFormats as P, type QrErrorLevel as Q, type RandomConfig as R, type Shape as S, type TwitterTags as T, minifySvg as U, numberToOrdinal as V, numberToRoman as W, numberToWords as X, optimizeSvg as Y, ordinalWords as Z, parseMetaTags as _, type CodePoint as a, sanitizeSvg as a0, svgToDataUrl as a1, toUnicodeEscape as a2, validateOgTags as a3, type CompressionOptions as b, type CompressionResult as c, type ConversionOptions as d, type ConvertImageFormat as e, DEFAULT_CONFIG as f, DEFAULT_QR_OPTIONS as g, type DataType as h, FORMAT_LABELS as i, type FaviconConfig as j, type QrOptions as k, type SvgInfo as l, misc as m, analyzeString as n, analyzeSvg as o, calcResizeDimensions as p, calcSavings as q, charToCodePoint as r, codePointToChar as s, detectFormatFromDataUrl as t, detectFormatFromFilename as u, formatBytes as v, formatLabel as w, formatSvg as x, fromUnicodeEscape as y, generateData as z };