@open-mercato/shared 0.7.1-develop.7203.1.9396450b78 → 0.8.1-develop.7204.1.83330e271e

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/lib/utils.js CHANGED
@@ -1,7 +1,13 @@
1
1
  import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+ const mergeClasses = extendTailwindMerge({
4
+ extend: {
5
+ classGroups: { "font-size": [{ text: ["overline", "compact", "title-4", "ai-body"] }] },
6
+ theme: { radius: ["alert", "content-card", "textarea", "upload", "selection-card", "ai-control", "ai-input", "ai-prompt", "ai-prompt-inner", "ai-prompt-mobile", "ai-prompt-mobile-inner"] }
7
+ }
8
+ });
3
9
  function cn(...inputs) {
4
- return twMerge(clsx(inputs));
10
+ return mergeClasses(clsx(inputs));
5
11
  }
6
12
  function isRecord(value) {
7
13
  return !!value && typeof value === "object" && !Array.isArray(value);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/utils.ts"],
4
- "sourcesContent": ["import { clsx, type ClassValue } from \"clsx\"\nimport { twMerge } from \"tailwind-merge\"\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function slugifyTagLabel(label: string): string {\n return (\n label\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/(?:^-+|-+$)/g, \"\")\n .slice(0, 80) || `tag-${Math.random().toString(36).slice(2, 10)}`\n )\n}\n"],
5
- "mappings": "AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,SAAS,SAAS,OAAkD;AACzE,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE;AAEO,SAAS,gBAAgB,OAAuB;AACrD,SACE,MACG,YAAY,EACZ,KAAK,EACL,QAAQ,eAAe,GAAG,EAC1B,QAAQ,gBAAgB,EAAE,EAC1B,MAAM,GAAG,EAAE,KAAK,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAErE;",
4
+ "sourcesContent": ["import { clsx, type ClassValue } from \"clsx\"\nimport { extendTailwindMerge } from \"tailwind-merge\"\n\nconst mergeClasses = extendTailwindMerge({\n extend: {\n classGroups: { \"font-size\": [{ text: [\"overline\", \"compact\", \"title-4\", \"ai-body\"] }] },\n theme: { radius: [\"alert\", \"content-card\", \"textarea\", \"upload\", \"selection-card\", \"ai-control\", \"ai-input\", \"ai-prompt\", \"ai-prompt-inner\", \"ai-prompt-mobile\", \"ai-prompt-mobile-inner\"] },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return mergeClasses(clsx(inputs))\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value)\n}\n\nexport function slugifyTagLabel(label: string): string {\n return (\n label\n .toLowerCase()\n .trim()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/(?:^-+|-+$)/g, \"\")\n .slice(0, 80) || `tag-${Math.random().toString(36).slice(2, 10)}`\n )\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAA6B;AACtC,SAAS,2BAA2B;AAEpC,MAAM,eAAe,oBAAoB;AAAA,EACvC,QAAQ;AAAA,IACN,aAAa,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,YAAY,WAAW,WAAW,SAAS,EAAE,CAAC,EAAE;AAAA,IACtF,OAAO,EAAE,QAAQ,CAAC,SAAS,gBAAgB,YAAY,UAAU,kBAAkB,cAAc,YAAY,aAAa,mBAAmB,oBAAoB,wBAAwB,EAAE;AAAA,EAC7L;AACF,CAAC;AAEM,SAAS,MAAM,QAAsB;AAC1C,SAAO,aAAa,KAAK,MAAM,CAAC;AAClC;AAEO,SAAS,SAAS,OAAkD;AACzE,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE;AAEO,SAAS,gBAAgB,OAAuB;AACrD,SACE,MACG,YAAY,EACZ,KAAK,EACL,QAAQ,eAAe,GAAG,EAC1B,QAAQ,gBAAgB,EAAE,EAC1B,MAAM,GAAG,EAAE,KAAK,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;AAErE;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- const APP_VERSION = "0.7.1-develop.7203.1.9396450b78";
1
+ const APP_VERSION = "0.8.1-develop.7204.1.83330e271e";
2
2
  const appVersion = APP_VERSION;
3
3
  export {
4
4
  APP_VERSION,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/version.ts"],
4
- "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.7.1-develop.7203.1.9396450b78';\nexport const appVersion = APP_VERSION;\n"],
4
+ "sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.8.1-develop.7204.1.83330e271e';\nexport const appVersion = APP_VERSION;\n"],
5
5
  "mappings": "AACO,MAAM,cAAc;AACpB,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/shared",
3
- "version": "0.7.1-develop.7203.1.9396450b78",
3
+ "version": "0.8.1-develop.7204.1.83330e271e",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -113,7 +113,7 @@
113
113
  "@mikro-orm/core": "^7.1.14",
114
114
  "@mikro-orm/decorators": "^7.1.14",
115
115
  "@mikro-orm/postgresql": "^7.1.14",
116
- "@open-mercato/cache": "0.7.1-develop.7203.1.9396450b78",
116
+ "@open-mercato/cache": "0.8.1-develop.7204.1.83330e271e",
117
117
  "@types/html-to-text": "^9.0.4",
118
118
  "@types/sanitize-html": "^2.16.1",
119
119
  "dotenv": "^17.4.2",
@@ -141,5 +141,5 @@
141
141
  "url": "https://github.com/open-mercato/open-mercato",
142
142
  "directory": "packages/shared"
143
143
  },
144
- "stableVersion": "0.7.0"
144
+ "stableVersion": "0.8.0"
145
145
  }
@@ -0,0 +1,30 @@
1
+ import { cn } from '../utils'
2
+
3
+ describe('DS class merging', () => {
4
+ it('preserves the overline size alongside a semantic text color', () => {
5
+ expect(cn('text-overline leading-3', 'text-badge-purple-text')).toBe('text-overline leading-3 text-badge-purple-text')
6
+ expect(cn('text-muted-foreground', 'text-overline')).toBe('text-muted-foreground text-overline')
7
+ })
8
+
9
+ it('lets later font sizes and colors override only their own groups', () => {
10
+ expect(cn('text-sm text-foreground', 'text-overline text-muted-foreground')).toBe('text-overline text-muted-foreground')
11
+ expect(cn('text-overline text-muted-foreground', 'text-sm')).toBe('text-muted-foreground text-sm')
12
+ expect(cn('md:text-overline md:text-foreground', 'md:text-sm')).toBe('md:text-foreground md:text-sm')
13
+ })
14
+
15
+ it('retains conditional and ordinary layout merging', () => {
16
+ expect(cn(['px-2', false, 'py-1'], { 'text-overline': true }, 'px-4')).toBe('py-1 text-overline px-4')
17
+ })
18
+
19
+ it.each(['compact', 'title-4', 'ai-body'])('retains the %s source type scale with semantic colors', size => {
20
+ expect(cn('text-sm text-muted-foreground', `text-${size}`)).toBe(`text-muted-foreground text-${size}`)
21
+ expect(cn(`text-${size}`, 'text-status-success-text')).toBe(`text-${size} text-status-success-text`)
22
+ })
23
+
24
+ it('lets source radii override inherited primitive radii in both directions', () => {
25
+ expect(cn('rounded-md border border-border', 'rounded-ai-control')).toBe('border border-border rounded-ai-control')
26
+ expect(cn('rounded-ai-prompt', 'rounded-none')).toBe('rounded-none')
27
+ expect(cn('rounded-md', 'rounded-content-card')).toBe('rounded-content-card')
28
+ expect(cn('rounded-ai-prompt', 'rounded-t-ai-prompt-inner')).toBe('rounded-ai-prompt rounded-t-ai-prompt-inner')
29
+ })
30
+ })
package/src/lib/utils.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  import { clsx, type ClassValue } from "clsx"
2
- import { twMerge } from "tailwind-merge"
2
+ import { extendTailwindMerge } from "tailwind-merge"
3
+
4
+ const mergeClasses = extendTailwindMerge({
5
+ extend: {
6
+ classGroups: { "font-size": [{ text: ["overline", "compact", "title-4", "ai-body"] }] },
7
+ theme: { radius: ["alert", "content-card", "textarea", "upload", "selection-card", "ai-control", "ai-input", "ai-prompt", "ai-prompt-inner", "ai-prompt-mobile", "ai-prompt-mobile-inner"] },
8
+ },
9
+ })
3
10
 
4
11
  export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
12
+ return mergeClasses(clsx(inputs))
6
13
  }
7
14
 
8
15
  export function isRecord(value: unknown): value is Record<string, unknown> {