@ai-matrx/content-ir 0.19.25 → 0.19.27

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,322 @@
1
+ 'use strict';
2
+
3
+ // text-case.ts
4
+ var DEFAULT_WORD_REPLACEMENTS = {
5
+ // Acronyms & initialisms
6
+ "api": "API",
7
+ "apis": "APIs",
8
+ "ui": "UI",
9
+ "ux": "UX",
10
+ "id": "ID",
11
+ "ids": "IDs",
12
+ "qr": "QR",
13
+ "ssr": "SSR",
14
+ "csr": "CSR",
15
+ "ssg": "SSG",
16
+ "isr": "ISR",
17
+ "spa": "SPA",
18
+ "pwa": "PWA",
19
+ "sdk": "SDK",
20
+ "sdks": "SDKs",
21
+ "cli": "CLI",
22
+ "tty": "TTY",
23
+ "repl": "REPL",
24
+ "ci": "CI",
25
+ "cd": "CD",
26
+ "cpu": "CPU",
27
+ "cpus": "CPUs",
28
+ "gpu": "GPU",
29
+ "gpus": "GPUs",
30
+ "ram": "RAM",
31
+ "rom": "ROM",
32
+ "ssd": "SSD",
33
+ "ssds": "SSDs",
34
+ "hdd": "HDD",
35
+ "hdds": "HDDs",
36
+ "kpi": "KPI",
37
+ "kpis": "KPIs",
38
+ "sla": "SLA",
39
+ "slas": "SLAs",
40
+ "slo": "SLO",
41
+ "slos": "SLOs",
42
+ "sli": "SLI",
43
+ "slis": "SLIs",
44
+ "dom": "DOM",
45
+ // Web, formats, protocols
46
+ "url": "URL",
47
+ "urls": "URLs",
48
+ "uri": "URI",
49
+ "uris": "URIs",
50
+ "http": "HTTP",
51
+ "https": "HTTPS",
52
+ "html": "HTML",
53
+ "css": "CSS",
54
+ "json": "JSON",
55
+ "yaml": "YAML",
56
+ "yml": "YML",
57
+ "toml": "TOML",
58
+ "csv": "CSV",
59
+ "pdf": "PDF",
60
+ "tsv": "TSV",
61
+ "jpg": "JPG",
62
+ "jpeg": "JPEG",
63
+ "png": "PNG",
64
+ "gif": "GIF",
65
+ "webp": "WebP",
66
+ "heic": "HEIC",
67
+ "heif": "HEIF",
68
+ "bmp": "BMP",
69
+ "tiff": "TIFF",
70
+ "ico": "ICO",
71
+ "xml": "XML",
72
+ "sql": "SQL",
73
+ "db": "DB",
74
+ "dbs": "DBs",
75
+ "nosql": "NoSQL",
76
+ "graphql": "GraphQL",
77
+ "grpc": "gRPC",
78
+ "rest": "REST",
79
+ "restful": "RESTful",
80
+ "websocket": "WebSocket",
81
+ "websockets": "WebSockets",
82
+ "webrtc": "WebRTC",
83
+ // Networking
84
+ "ip": "IP",
85
+ "ipv4": "IPv4",
86
+ "ipv6": "IPv6",
87
+ "dns": "DNS",
88
+ "dhcp": "DHCP",
89
+ "nat": "NAT",
90
+ "tcp": "TCP",
91
+ "udp": "UDP",
92
+ "icmp": "ICMP",
93
+ "ttl": "TTL",
94
+ "lan": "LAN",
95
+ "wan": "WAN",
96
+ "vlan": "VLAN",
97
+ "cdn": "CDN",
98
+ "ftp": "FTP",
99
+ "ssh": "SSH",
100
+ "tls": "TLS",
101
+ "ssl": "SSL",
102
+ // Security & crypto
103
+ "jwt": "JWT",
104
+ "jws": "JWS",
105
+ "jwe": "JWE",
106
+ "hmac": "HMAC",
107
+ "rsa": "RSA",
108
+ "ecdsa": "ECDSA",
109
+ "aes": "AES",
110
+ "pbkdf2": "PBKDF2",
111
+ "argon2": "Argon2",
112
+ "scrypt": "scrypt",
113
+ "totp": "TOTP",
114
+ "hotp": "HOTP",
115
+ "mfa": "MFA",
116
+ "2fa": "2FA",
117
+ "csrf": "CSRF",
118
+ "xss": "XSS",
119
+ "ssrf": "SSRF",
120
+ "rce": "RCE",
121
+ "dos": "DoS",
122
+ "ddos": "DDoS",
123
+ "mitm": "MITM",
124
+ "csp": "CSP",
125
+ "cors": "CORS",
126
+ "pii": "PII",
127
+ "phi": "PHI",
128
+ "gdpr": "GDPR",
129
+ "ccpa": "CCPA",
130
+ "hipaa": "HIPAA",
131
+ "rfc": "RFC",
132
+ // Platforms, langs, tools (single-token)
133
+ "javascript": "JavaScript",
134
+ "typescript": "TypeScript",
135
+ "jsx": "JSX",
136
+ "tsx": "TSX",
137
+ "node": "Node",
138
+ // (used when tokenized alone)
139
+ "deno": "Deno",
140
+ "bun": "Bun",
141
+ "react": "React",
142
+ "nextjs": "Next.js",
143
+ // if your tokenizer drops dots, keep this
144
+ "nodejs": "Node.js",
145
+ "postgresql": "PostgreSQL",
146
+ "postgres": "Postgres",
147
+ "mysql": "MySQL",
148
+ "sqlite": "SQLite",
149
+ "redis": "Redis",
150
+ "supabase": "Supabase",
151
+ "docker": "Docker",
152
+ "kubernetes": "Kubernetes",
153
+ "k8s": "Kubernetes",
154
+ "helm": "Helm",
155
+ "npm": "npm",
156
+ "pnpm": "pnpm",
157
+ "yarn": "Yarn",
158
+ "eslint": "ESLint",
159
+ "prettier": "Prettier",
160
+ "vite": "Vite",
161
+ "webpack": "Webpack",
162
+ "babel": "Babel",
163
+ // OS & vendors
164
+ "macos": "macOS",
165
+ "ios": "iOS",
166
+ "ipados": "iPadOS",
167
+ "watchos": "watchOS",
168
+ "tvos": "tvOS",
169
+ "windows": "Windows",
170
+ "linux": "Linux",
171
+ "ubuntu": "Ubuntu",
172
+ "github": "GitHub",
173
+ "gitlab": "GitLab",
174
+ "bitbucket": "Bitbucket",
175
+ // Data & analytics
176
+ "etl": "ETL",
177
+ "elt": "ELT",
178
+ "olap": "OLAP",
179
+ "oltp": "OLTP",
180
+ "bi": "BI",
181
+ // Time & locales
182
+ "utc": "UTC",
183
+ "gmt": "GMT",
184
+ "pst": "PST",
185
+ "pdt": "PDT",
186
+ "pt": "PT",
187
+ // Common “small words” to keep lowercase (unless first/last word)
188
+ "or": "or",
189
+ "and": "and",
190
+ "the": "the",
191
+ "of": "of",
192
+ "in": "in",
193
+ "to": "to",
194
+ "with": "with",
195
+ "as": "as",
196
+ "by": "by",
197
+ "for": "for",
198
+ "on": "on",
199
+ "at": "at",
200
+ "up": "up",
201
+ "a": "a",
202
+ "an": "an",
203
+ "is": "is",
204
+ "are": "are",
205
+ "was": "was",
206
+ "were": "were",
207
+ "be": "be",
208
+ "but": "but",
209
+ "nor": "nor",
210
+ "so": "so",
211
+ "yet": "yet",
212
+ "per": "per",
213
+ "via": "via",
214
+ // Latin abbreviations (tokenized as words in some pipelines)
215
+ "eg": "e.g.",
216
+ "ie": "i.e.",
217
+ "etc": "etc.",
218
+ "aka": "aka",
219
+ "vs": "vs.",
220
+ "v": "v.",
221
+ // Client abbreviations
222
+ "CIC": "CIC",
223
+ "AGR": "AGR",
224
+ "AGER": "AGER",
225
+ "DD": "DD",
226
+ "TS": "TS",
227
+ "TM": "TM",
228
+ "arman": "Arman"
229
+ };
230
+ var DEFAULT_OPTIONS = {
231
+ textCase: "title",
232
+ wordReplacements: DEFAULT_WORD_REPLACEMENTS,
233
+ trim: true
234
+ };
235
+ function formatText(text, options = {}) {
236
+ const opts = { ...DEFAULT_OPTIONS, ...options };
237
+ if (!text) return "";
238
+ let normalized = text.replace(/_/g, " ").replace(/-/g, " ").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\s+/g, " ");
239
+ if (opts.trim) {
240
+ normalized = normalized.trim();
241
+ }
242
+ let caseTransformed = normalized;
243
+ switch (opts.textCase) {
244
+ case "title":
245
+ caseTransformed = normalized.replace(
246
+ /\w\S*/g,
247
+ (word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
248
+ );
249
+ break;
250
+ case "sentence":
251
+ if (normalized.length > 0) {
252
+ caseTransformed = normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();
253
+ }
254
+ break;
255
+ case "lower":
256
+ caseTransformed = normalized.toLowerCase();
257
+ break;
258
+ case "upper":
259
+ caseTransformed = normalized.toUpperCase();
260
+ break;
261
+ }
262
+ let result = caseTransformed;
263
+ if (opts.wordReplacements) {
264
+ Object.entries(opts.wordReplacements).forEach(([key, value]) => {
265
+ const regex = new RegExp(`\\b${key}\\b`, "gi");
266
+ result = result.replace(regex, value);
267
+ });
268
+ }
269
+ return result;
270
+ }
271
+ function createFormatter(defaultOptions = {}) {
272
+ return (text, overrideOptions = {}) => formatText(text, { ...defaultOptions, ...overrideOptions });
273
+ }
274
+ var formatTitleCase = createFormatter({ textCase: "title" });
275
+ var formatSentenceCase = createFormatter({ textCase: "sentence" });
276
+ var formatNormalCase = createFormatter({ textCase: "normal" });
277
+ var formatUpperCase = createFormatter({ textCase: "upper" });
278
+ var formatLowerCase = createFormatter({ textCase: "lower" });
279
+ var formatWithoutReplacements = createFormatter({ wordReplacements: {} });
280
+ var IDENTIFIER_ACRONYMS = [
281
+ "ID",
282
+ "URL",
283
+ "PDF",
284
+ "HTML",
285
+ "JSON",
286
+ "API",
287
+ "AI",
288
+ "UI",
289
+ "CSV",
290
+ "SMS",
291
+ "SEO",
292
+ "LLM",
293
+ "MCP",
294
+ "UUID",
295
+ "ISO"
296
+ ];
297
+ var IDENTIFIER_ACRONYM_SET = new Set(IDENTIFIER_ACRONYMS.map((a) => a.toLowerCase()));
298
+ function humanizeIdentifier(identifier) {
299
+ return identifier.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[_\-.\s]+/).filter((part) => part.length > 0).map(
300
+ (part) => IDENTIFIER_ACRONYM_SET.has(part.toLowerCase()) ? part.toUpperCase() : part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()
301
+ ).join(" ");
302
+ }
303
+ function displayLabel(label, identifier) {
304
+ const own = (label ?? "").trim();
305
+ if (own !== "") return own;
306
+ return humanizeIdentifier(identifier) || identifier;
307
+ }
308
+
309
+ exports.DEFAULT_WORD_REPLACEMENTS = DEFAULT_WORD_REPLACEMENTS;
310
+ exports.IDENTIFIER_ACRONYMS = IDENTIFIER_ACRONYMS;
311
+ exports.createFormatter = createFormatter;
312
+ exports.displayLabel = displayLabel;
313
+ exports.formatLowerCase = formatLowerCase;
314
+ exports.formatNormalCase = formatNormalCase;
315
+ exports.formatSentenceCase = formatSentenceCase;
316
+ exports.formatText = formatText;
317
+ exports.formatTitleCase = formatTitleCase;
318
+ exports.formatUpperCase = formatUpperCase;
319
+ exports.formatWithoutReplacements = formatWithoutReplacements;
320
+ exports.humanizeIdentifier = humanizeIdentifier;
321
+ //# sourceMappingURL=text-case.cjs.map
322
+ //# sourceMappingURL=text-case.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../text-case.ts"],"names":[],"mappings":";;;AAwCO,IAAM,yBAAA,GAA4C;AAAA;AAAA,EAEvD,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,IAAA,EAAM,IAAA;AAAA,EACN,IAAA,EAAM,IAAA;AAAA,EACN,IAAA,EAAM,IAAA;AAAA,EACN,KAAA,EAAO,KAAA;AAAA,EACP,IAAA,EAAM,IAAA;AAAA,EACN,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,IAAA,EAAM,IAAA;AAAA,EACN,IAAA,EAAM,IAAA;AAAA,EACN,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,KAAA;AAAA,EACP,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,KAAA;AAAA,EACP,MAAA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EAAK;AAC/B,EAAA,IAAI,GAAA,KAAQ,IAAI,OAAO,GAAA;AACvB,EAAA,OAAO,kBAAA,CAAmB,UAAU,CAAA,IAAK,UAAA;AAC3C","file":"text-case.cjs","sourcesContent":["/**\n * `@ai-matrx/content-ir/text-case` — THE text-case and identifier-label rules.\n *\n * Pure TS. Public face for apps: `@ai-matrx/kit/text-case` (re-exports this). Lives\n * here, the lowest pure layer, because both content-ir (`formatBlockLabel`) and kit\n * need it and kit already depends on content-ir.\n */\n/**\n * Text formatting options\n */\nexport type TextCaseOption = 'title' | 'sentence' | 'normal' | 'lower' | 'upper';\n\nexport interface TextFormatterOptions {\n /**\n * Text case to apply after normalization\n * - title: First Letter Of Each Word Capitalized\n * - sentence: First letter of first word capitalized\n * - normal: No case transformation after normalization\n * - lower: all text lowercase\n * - upper: ALL TEXT UPPERCASE\n */\n textCase?: TextCaseOption;\n \n /**\n * Map of words to replace with specific formatting\n * Example: { 'api': 'API', 'ui': 'UI' }\n */\n wordReplacements?: Record<string, string>;\n \n /**\n * Whether to trim the result\n */\n trim?: boolean;\n}\n\n/**\n * Default word replacements for common acronyms and terms\n */\nexport type ReplacementMap = Readonly<Record<string, string>>;\n\nexport const DEFAULT_WORD_REPLACEMENTS: ReplacementMap = {\n // Acronyms & initialisms\n 'api': 'API',\n 'apis': 'APIs',\n 'ui': 'UI',\n 'ux': 'UX',\n 'id': 'ID',\n 'ids': 'IDs',\n 'qr': 'QR',\n 'ssr': 'SSR',\n 'csr': 'CSR',\n 'ssg': 'SSG',\n 'isr': 'ISR',\n 'spa': 'SPA',\n 'pwa': 'PWA',\n 'sdk': 'SDK',\n 'sdks': 'SDKs',\n 'cli': 'CLI',\n 'tty': 'TTY',\n 'repl': 'REPL',\n 'ci': 'CI',\n 'cd': 'CD',\n 'cpu': 'CPU',\n 'cpus': 'CPUs',\n 'gpu': 'GPU',\n 'gpus': 'GPUs',\n 'ram': 'RAM',\n 'rom': 'ROM',\n 'ssd': 'SSD',\n 'ssds': 'SSDs',\n 'hdd': 'HDD',\n 'hdds': 'HDDs',\n 'kpi': 'KPI',\n 'kpis': 'KPIs',\n 'sla': 'SLA',\n 'slas': 'SLAs',\n 'slo': 'SLO',\n 'slos': 'SLOs',\n 'sli': 'SLI',\n 'slis': 'SLIs',\n 'dom': 'DOM',\n\n // Web, formats, protocols\n 'url': 'URL',\n 'urls': 'URLs',\n 'uri': 'URI',\n 'uris': 'URIs',\n 'http': 'HTTP',\n 'https': 'HTTPS',\n 'html': 'HTML',\n 'css': 'CSS',\n 'json': 'JSON',\n 'yaml': 'YAML',\n 'yml': 'YML',\n 'toml': 'TOML',\n 'csv': 'CSV',\n 'pdf': 'PDF',\n 'tsv': 'TSV',\n 'jpg': 'JPG',\n 'jpeg': 'JPEG',\n 'png': 'PNG',\n 'gif': 'GIF',\n 'webp': 'WebP',\n 'heic': 'HEIC',\n 'heif': 'HEIF',\n 'bmp': 'BMP',\n 'tiff': 'TIFF',\n 'ico': 'ICO',\n 'xml': 'XML',\n 'sql': 'SQL',\n 'db': 'DB',\n 'dbs': 'DBs',\n 'nosql': 'NoSQL',\n 'graphql': 'GraphQL',\n 'grpc': 'gRPC',\n 'rest': 'REST',\n 'restful': 'RESTful',\n 'websocket': 'WebSocket',\n 'websockets': 'WebSockets',\n 'webrtc': 'WebRTC',\n\n // Networking\n 'ip': 'IP',\n 'ipv4': 'IPv4',\n 'ipv6': 'IPv6',\n 'dns': 'DNS',\n 'dhcp': 'DHCP',\n 'nat': 'NAT',\n 'tcp': 'TCP',\n 'udp': 'UDP',\n 'icmp': 'ICMP',\n 'ttl': 'TTL',\n 'lan': 'LAN',\n 'wan': 'WAN',\n 'vlan': 'VLAN',\n 'cdn': 'CDN',\n 'ftp': 'FTP',\n 'ssh': 'SSH',\n 'tls': 'TLS',\n 'ssl': 'SSL',\n\n // Security & crypto\n 'jwt': 'JWT',\n 'jws': 'JWS',\n 'jwe': 'JWE',\n 'hmac': 'HMAC',\n 'rsa': 'RSA',\n 'ecdsa': 'ECDSA',\n 'aes': 'AES',\n 'pbkdf2': 'PBKDF2',\n 'argon2': 'Argon2',\n 'scrypt': 'scrypt',\n 'totp': 'TOTP',\n 'hotp': 'HOTP',\n 'mfa': 'MFA',\n '2fa': '2FA',\n 'csrf': 'CSRF',\n 'xss': 'XSS',\n 'ssrf': 'SSRF',\n 'rce': 'RCE',\n 'dos': 'DoS',\n 'ddos': 'DDoS',\n 'mitm': 'MITM',\n 'csp': 'CSP',\n 'cors': 'CORS',\n 'pii': 'PII',\n 'phi': 'PHI',\n 'gdpr': 'GDPR',\n 'ccpa': 'CCPA',\n 'hipaa': 'HIPAA',\n 'rfc': 'RFC',\n\n // Platforms, langs, tools (single-token)\n 'javascript': 'JavaScript',\n 'typescript': 'TypeScript',\n 'jsx': 'JSX',\n 'tsx': 'TSX',\n 'node': 'Node', // (used when tokenized alone)\n 'deno': 'Deno',\n 'bun': 'Bun',\n 'react': 'React',\n 'nextjs': 'Next.js', // if your tokenizer drops dots, keep this\n 'nodejs': 'Node.js',\n 'postgresql': 'PostgreSQL',\n 'postgres': 'Postgres',\n 'mysql': 'MySQL',\n 'sqlite': 'SQLite',\n 'redis': 'Redis',\n 'supabase': 'Supabase',\n 'docker': 'Docker',\n 'kubernetes': 'Kubernetes',\n 'k8s': 'Kubernetes',\n 'helm': 'Helm',\n 'npm': 'npm',\n 'pnpm': 'pnpm',\n 'yarn': 'Yarn',\n 'eslint': 'ESLint',\n 'prettier': 'Prettier',\n 'vite': 'Vite',\n 'webpack': 'Webpack',\n 'babel': 'Babel',\n\n // OS & vendors\n 'macos': 'macOS',\n 'ios': 'iOS',\n 'ipados': 'iPadOS',\n 'watchos': 'watchOS',\n 'tvos': 'tvOS',\n 'windows': 'Windows',\n 'linux': 'Linux',\n 'ubuntu': 'Ubuntu',\n 'github': 'GitHub',\n 'gitlab': 'GitLab',\n 'bitbucket': 'Bitbucket',\n\n // Data & analytics\n 'etl': 'ETL',\n 'elt': 'ELT',\n 'olap': 'OLAP',\n 'oltp': 'OLTP',\n 'bi': 'BI',\n\n // Time & locales\n 'utc': 'UTC',\n 'gmt': 'GMT',\n 'pst': 'PST',\n 'pdt': 'PDT',\n 'pt': 'PT',\n\n // Common “small words” to keep lowercase (unless first/last word)\n 'or': 'or',\n 'and': 'and',\n 'the': 'the',\n 'of': 'of',\n 'in': 'in',\n 'to': 'to',\n 'with': 'with',\n 'as': 'as',\n 'by': 'by',\n 'for': 'for',\n 'on': 'on',\n 'at': 'at',\n 'up': 'up',\n 'a': 'a',\n 'an': 'an',\n 'is': 'is',\n 'are': 'are',\n 'was': 'was',\n 'were': 'were',\n 'be': 'be',\n 'but': 'but',\n 'nor': 'nor',\n 'so': 'so',\n 'yet': 'yet',\n 'per': 'per',\n 'via': 'via',\n\n // Latin abbreviations (tokenized as words in some pipelines)\n 'eg': 'e.g.',\n 'ie': 'i.e.',\n 'etc': 'etc.',\n 'aka': 'aka',\n 'vs': 'vs.',\n 'v': 'v.',\n\n // Client abbreviations\n 'CIC': 'CIC',\n 'AGR': 'AGR',\n 'AGER': 'AGER',\n 'DD': 'DD',\n 'TS': 'TS',\n 'TM': 'TM',\n 'arman': \"Arman\",\n};\n\n/**\n * Default options for text formatting\n */\nconst DEFAULT_OPTIONS: TextFormatterOptions = {\n textCase: 'title',\n wordReplacements: DEFAULT_WORD_REPLACEMENTS,\n trim: true,\n};\n\n/**\n * Formats text by normalizing case styles, applying case transformations,\n * and replacing specific words with custom formatting.\n * \n * @param text The input text to format\n * @param options Formatting options\n * @returns Formatted text\n */\nexport function formatText(text: string, options: TextFormatterOptions = {}): string {\n // Merge provided options with defaults\n const opts = { ...DEFAULT_OPTIONS, ...options };\n \n // Handle empty text\n if (!text) return '';\n \n // Step 1: Normalize various case styles to space-separated words\n let normalized = text\n // Convert snake_case to space-separated\n .replace(/_/g, ' ')\n // Convert kebab-case to space-separated\n .replace(/-/g, ' ')\n // Convert camelCase and PascalCase to space-separated\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n // Replace multiple spaces with a single space\n .replace(/\\s+/g, ' ');\n \n // Step 2: Apply trim if needed\n if (opts.trim) {\n normalized = normalized.trim();\n }\n \n // Step 3: Apply the specified text case\n let caseTransformed = normalized;\n switch (opts.textCase) {\n case 'title':\n caseTransformed = normalized.replace(/\\w\\S*/g, (word) => \n word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()\n );\n break;\n case 'sentence':\n if (normalized.length > 0) {\n caseTransformed = normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();\n }\n break;\n case 'lower':\n caseTransformed = normalized.toLowerCase();\n break;\n case 'upper':\n caseTransformed = normalized.toUpperCase();\n break;\n case 'normal':\n default:\n // No case transformation\n break;\n }\n \n // Step 4: Apply word replacements if provided\n let result = caseTransformed;\n if (opts.wordReplacements) {\n Object.entries(opts.wordReplacements).forEach(([key, value]) => {\n // Create a regex that matches the key as a whole word (case insensitive)\n const regex = new RegExp(`\\\\b${key}\\\\b`, 'gi');\n result = result.replace(regex, value);\n });\n }\n \n return result;\n}\n\n/**\n * Creates a pre-configured formatter function with specific options\n * \n * @param defaultOptions Default options for the formatter\n * @returns A formatter function with the specified default options\n */\nexport function createFormatter(defaultOptions: TextFormatterOptions = {}) {\n return (text: string, overrideOptions: TextFormatterOptions = {}) => \n formatText(text, { ...defaultOptions, ...overrideOptions });\n}\n\n// Some pre-configured formatters for common use cases\nexport const formatTitleCase = createFormatter({ textCase: 'title' });\nexport const formatSentenceCase = createFormatter({ textCase: 'sentence' });\nexport const formatNormalCase = createFormatter({ textCase: 'normal' });\nexport const formatUpperCase = createFormatter({ textCase: 'upper' });\nexport const formatLowerCase = createFormatter({ textCase: 'lower' });\nexport const formatWithoutReplacements = createFormatter({ wordReplacements: {} });\n\n// ── humanizeIdentifier — THE one identifier-to-words rule ────────────────────\n//\n// A screen never shows a machine identifier (`normal_text`, `note_id`,\n// `workflowCatalog`). It shows the thing's own label; when the thing carries no\n// label, it shows the identifier through this function — the ONE humanizer every\n// app and package uses (matrx-frontend, records-ui, diff, chat, agents). The\n// Python twin is aidream `humanize_context_key`; both run the parity corpus\n// `humanize_cases` in `@ai-matrx/agents` `context/rules-corpus.json`.\n\n/** Words always written in capitals when they are a whole word of an identifier. */\nexport const IDENTIFIER_ACRONYMS: readonly string[] = [\n \"ID\", \"URL\", \"PDF\", \"HTML\", \"JSON\", \"API\", \"AI\", \"UI\", \"CSV\", \"SMS\", \"SEO\", \"LLM\", \"MCP\", \"UUID\", \"ISO\",\n];\nconst IDENTIFIER_ACRONYM_SET = new Set(IDENTIFIER_ACRONYMS.map((a) => a.toLowerCase()));\n\n/**\n * An identifier in words — the label of a thing nobody named.\n *\n * 1. split camelCase (`myValue` → `my Value`, `HTMLParser` → `HTML Parser`);\n * 2. split on runs of `_`, `-`, `.` and whitespace; drop empty parts;\n * 3. a part that is, case-insensitively, one of `IDENTIFIER_ACRONYMS` is\n * upper-cased; any other part gets its first character upper-cased and the\n * rest lower-cased (acronyms are whole parts only: `url2pdf` → `Url2pdf`);\n * 4. join with single spaces.\n *\n * `note_id` → `Note ID`, `normal_text` → `Normal Text`, `myValue_ID` → `My Value ID`.\n * An identifier with no word characters returns `\"\"` — callers fall back.\n */\nexport function humanizeIdentifier(identifier: string): string {\n return identifier\n .replace(/([a-z\\d])([A-Z])/g, \"$1 $2\")\n .replace(/([A-Z]+)([A-Z][a-z])/g, \"$1 $2\")\n .split(/[_\\-.\\s]+/)\n .filter((part) => part.length > 0)\n .map((part) =>\n IDENTIFIER_ACRONYM_SET.has(part.toLowerCase())\n ? part.toUpperCase()\n : part.charAt(0).toUpperCase() + part.slice(1).toLowerCase(),\n )\n .join(\" \");\n}\n\n/**\n * What a screen shows for a thing: its own label when it has one, else its\n * identifier through `humanizeIdentifier`, else the identifier itself.\n */\nexport function displayLabel(label: string | null | undefined, identifier: string): string {\n const own = (label ?? \"\").trim();\n if (own !== \"\") return own;\n return humanizeIdentifier(identifier) || identifier;\n}\n"]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `@ai-matrx/content-ir/text-case` — THE text-case and identifier-label rules.
3
+ *
4
+ * Pure TS. Public face for apps: `@ai-matrx/kit/text-case` (re-exports this). Lives
5
+ * here, the lowest pure layer, because both content-ir (`formatBlockLabel`) and kit
6
+ * need it and kit already depends on content-ir.
7
+ */
8
+ /**
9
+ * Text formatting options
10
+ */
11
+ type TextCaseOption = 'title' | 'sentence' | 'normal' | 'lower' | 'upper';
12
+ interface TextFormatterOptions {
13
+ /**
14
+ * Text case to apply after normalization
15
+ * - title: First Letter Of Each Word Capitalized
16
+ * - sentence: First letter of first word capitalized
17
+ * - normal: No case transformation after normalization
18
+ * - lower: all text lowercase
19
+ * - upper: ALL TEXT UPPERCASE
20
+ */
21
+ textCase?: TextCaseOption;
22
+ /**
23
+ * Map of words to replace with specific formatting
24
+ * Example: { 'api': 'API', 'ui': 'UI' }
25
+ */
26
+ wordReplacements?: Record<string, string>;
27
+ /**
28
+ * Whether to trim the result
29
+ */
30
+ trim?: boolean;
31
+ }
32
+ /**
33
+ * Default word replacements for common acronyms and terms
34
+ */
35
+ type ReplacementMap = Readonly<Record<string, string>>;
36
+ declare const DEFAULT_WORD_REPLACEMENTS: ReplacementMap;
37
+ /**
38
+ * Formats text by normalizing case styles, applying case transformations,
39
+ * and replacing specific words with custom formatting.
40
+ *
41
+ * @param text The input text to format
42
+ * @param options Formatting options
43
+ * @returns Formatted text
44
+ */
45
+ declare function formatText(text: string, options?: TextFormatterOptions): string;
46
+ /**
47
+ * Creates a pre-configured formatter function with specific options
48
+ *
49
+ * @param defaultOptions Default options for the formatter
50
+ * @returns A formatter function with the specified default options
51
+ */
52
+ declare function createFormatter(defaultOptions?: TextFormatterOptions): (text: string, overrideOptions?: TextFormatterOptions) => string;
53
+ declare const formatTitleCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
54
+ declare const formatSentenceCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
55
+ declare const formatNormalCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
56
+ declare const formatUpperCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
57
+ declare const formatLowerCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
58
+ declare const formatWithoutReplacements: (text: string, overrideOptions?: TextFormatterOptions) => string;
59
+ /** Words always written in capitals when they are a whole word of an identifier. */
60
+ declare const IDENTIFIER_ACRONYMS: readonly string[];
61
+ /**
62
+ * An identifier in words — the label of a thing nobody named.
63
+ *
64
+ * 1. split camelCase (`myValue` → `my Value`, `HTMLParser` → `HTML Parser`);
65
+ * 2. split on runs of `_`, `-`, `.` and whitespace; drop empty parts;
66
+ * 3. a part that is, case-insensitively, one of `IDENTIFIER_ACRONYMS` is
67
+ * upper-cased; any other part gets its first character upper-cased and the
68
+ * rest lower-cased (acronyms are whole parts only: `url2pdf` → `Url2pdf`);
69
+ * 4. join with single spaces.
70
+ *
71
+ * `note_id` → `Note ID`, `normal_text` → `Normal Text`, `myValue_ID` → `My Value ID`.
72
+ * An identifier with no word characters returns `""` — callers fall back.
73
+ */
74
+ declare function humanizeIdentifier(identifier: string): string;
75
+ /**
76
+ * What a screen shows for a thing: its own label when it has one, else its
77
+ * identifier through `humanizeIdentifier`, else the identifier itself.
78
+ */
79
+ declare function displayLabel(label: string | null | undefined, identifier: string): string;
80
+
81
+ export { DEFAULT_WORD_REPLACEMENTS, IDENTIFIER_ACRONYMS, type ReplacementMap, type TextCaseOption, type TextFormatterOptions, createFormatter, displayLabel, formatLowerCase, formatNormalCase, formatSentenceCase, formatText, formatTitleCase, formatUpperCase, formatWithoutReplacements, humanizeIdentifier };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `@ai-matrx/content-ir/text-case` — THE text-case and identifier-label rules.
3
+ *
4
+ * Pure TS. Public face for apps: `@ai-matrx/kit/text-case` (re-exports this). Lives
5
+ * here, the lowest pure layer, because both content-ir (`formatBlockLabel`) and kit
6
+ * need it and kit already depends on content-ir.
7
+ */
8
+ /**
9
+ * Text formatting options
10
+ */
11
+ type TextCaseOption = 'title' | 'sentence' | 'normal' | 'lower' | 'upper';
12
+ interface TextFormatterOptions {
13
+ /**
14
+ * Text case to apply after normalization
15
+ * - title: First Letter Of Each Word Capitalized
16
+ * - sentence: First letter of first word capitalized
17
+ * - normal: No case transformation after normalization
18
+ * - lower: all text lowercase
19
+ * - upper: ALL TEXT UPPERCASE
20
+ */
21
+ textCase?: TextCaseOption;
22
+ /**
23
+ * Map of words to replace with specific formatting
24
+ * Example: { 'api': 'API', 'ui': 'UI' }
25
+ */
26
+ wordReplacements?: Record<string, string>;
27
+ /**
28
+ * Whether to trim the result
29
+ */
30
+ trim?: boolean;
31
+ }
32
+ /**
33
+ * Default word replacements for common acronyms and terms
34
+ */
35
+ type ReplacementMap = Readonly<Record<string, string>>;
36
+ declare const DEFAULT_WORD_REPLACEMENTS: ReplacementMap;
37
+ /**
38
+ * Formats text by normalizing case styles, applying case transformations,
39
+ * and replacing specific words with custom formatting.
40
+ *
41
+ * @param text The input text to format
42
+ * @param options Formatting options
43
+ * @returns Formatted text
44
+ */
45
+ declare function formatText(text: string, options?: TextFormatterOptions): string;
46
+ /**
47
+ * Creates a pre-configured formatter function with specific options
48
+ *
49
+ * @param defaultOptions Default options for the formatter
50
+ * @returns A formatter function with the specified default options
51
+ */
52
+ declare function createFormatter(defaultOptions?: TextFormatterOptions): (text: string, overrideOptions?: TextFormatterOptions) => string;
53
+ declare const formatTitleCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
54
+ declare const formatSentenceCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
55
+ declare const formatNormalCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
56
+ declare const formatUpperCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
57
+ declare const formatLowerCase: (text: string, overrideOptions?: TextFormatterOptions) => string;
58
+ declare const formatWithoutReplacements: (text: string, overrideOptions?: TextFormatterOptions) => string;
59
+ /** Words always written in capitals when they are a whole word of an identifier. */
60
+ declare const IDENTIFIER_ACRONYMS: readonly string[];
61
+ /**
62
+ * An identifier in words — the label of a thing nobody named.
63
+ *
64
+ * 1. split camelCase (`myValue` → `my Value`, `HTMLParser` → `HTML Parser`);
65
+ * 2. split on runs of `_`, `-`, `.` and whitespace; drop empty parts;
66
+ * 3. a part that is, case-insensitively, one of `IDENTIFIER_ACRONYMS` is
67
+ * upper-cased; any other part gets its first character upper-cased and the
68
+ * rest lower-cased (acronyms are whole parts only: `url2pdf` → `Url2pdf`);
69
+ * 4. join with single spaces.
70
+ *
71
+ * `note_id` → `Note ID`, `normal_text` → `Normal Text`, `myValue_ID` → `My Value ID`.
72
+ * An identifier with no word characters returns `""` — callers fall back.
73
+ */
74
+ declare function humanizeIdentifier(identifier: string): string;
75
+ /**
76
+ * What a screen shows for a thing: its own label when it has one, else its
77
+ * identifier through `humanizeIdentifier`, else the identifier itself.
78
+ */
79
+ declare function displayLabel(label: string | null | undefined, identifier: string): string;
80
+
81
+ export { DEFAULT_WORD_REPLACEMENTS, IDENTIFIER_ACRONYMS, type ReplacementMap, type TextCaseOption, type TextFormatterOptions, createFormatter, displayLabel, formatLowerCase, formatNormalCase, formatSentenceCase, formatText, formatTitleCase, formatUpperCase, formatWithoutReplacements, humanizeIdentifier };