@nuvio/shared 0.5.5 → 1.0.0

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.d.ts CHANGED
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
  declare const NUVIO_WS_PATH: "/__nuvio/ws";
5
5
 
6
6
  /** Bump when wire payloads change incompatibly. */
7
- declare const PROTOCOL_VERSION: 7;
7
+ declare const PROTOCOL_VERSION: 8;
8
8
  declare const riskLevelSchema: z.ZodEnum<["safe", "caution", "unsupported"]>;
9
9
  type RiskLevel = z.infer<typeof riskLevelSchema>;
10
10
  /** Index v3: editable text node under an instrumented host (Step 1). */
@@ -142,6 +142,12 @@ declare const tableDataFieldSchema: z.ZodObject<{
142
142
  }>;
143
143
  type TableDataFieldBinding = z.infer<typeof tableDataFieldSchema>;
144
144
  type HierarchyRole = z.infer<typeof hierarchyRoleSchema>;
145
+ /** Per-host className patch strategy (index v5 / v0.7). */
146
+ declare const classNameModeSchema: z.ZodEnum<["literal-only", "cn-basic", "cn-conditional", "classnames-static", "unsupported"]>;
147
+ type WireClassNameMode = z.infer<typeof classNameModeSchema>;
148
+ /** Detected UI library profile (v0.8). */
149
+ declare const libraryIdSchema: z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>;
150
+ type LibraryId = z.infer<typeof libraryIdSchema>;
145
151
  declare const indexEntrySchema: z.ZodObject<{
146
152
  id: z.ZodString;
147
153
  file: z.ZodString;
@@ -295,6 +301,10 @@ declare const indexEntrySchema: z.ZodObject<{
295
301
  arrayName: string;
296
302
  field: string;
297
303
  }>>;
304
+ /** Index v5: detected className expression mode for patch routing. */
305
+ classNameMode: z.ZodOptional<z.ZodEnum<["literal-only", "cn-basic", "cn-conditional", "classnames-static", "unsupported"]>>;
306
+ /** Index v6: shadcn / TailAdmin / DaisyUI hint for this host. */
307
+ libraryHint: z.ZodOptional<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>>;
298
308
  }, "strip", z.ZodTypeAny, {
299
309
  file: string;
300
310
  line: number;
@@ -357,6 +367,8 @@ declare const indexEntrySchema: z.ZodObject<{
357
367
  arrayName: string;
358
368
  field: string;
359
369
  } | undefined;
370
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
371
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
360
372
  }, {
361
373
  file: string;
362
374
  line: number;
@@ -419,6 +431,8 @@ declare const indexEntrySchema: z.ZodObject<{
419
431
  arrayName: string;
420
432
  field: string;
421
433
  } | undefined;
434
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
435
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
422
436
  }>;
423
437
  type IndexWireEntry = z.infer<typeof indexEntrySchema>;
424
438
  declare const runtimeDiagnosticsSchema: z.ZodObject<{
@@ -426,16 +440,20 @@ declare const runtimeDiagnosticsSchema: z.ZodObject<{
426
440
  reactVersion: z.ZodOptional<z.ZodString>;
427
441
  tailwindVersion: z.ZodOptional<z.ZodString>;
428
442
  overlayCssMode: z.ZodOptional<z.ZodLiteral<"self-contained">>;
443
+ /** Project-level library detection (v0.8). */
444
+ detectedLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>, "many">>;
429
445
  }, "strip", z.ZodTypeAny, {
430
446
  viteVersion?: string | undefined;
431
447
  reactVersion?: string | undefined;
432
448
  tailwindVersion?: string | undefined;
433
449
  overlayCssMode?: "self-contained" | undefined;
450
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
434
451
  }, {
435
452
  viteVersion?: string | undefined;
436
453
  reactVersion?: string | undefined;
437
454
  tailwindVersion?: string | undefined;
438
455
  overlayCssMode?: "self-contained" | undefined;
456
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
439
457
  }>;
440
458
  type RuntimeDiagnostics = z.infer<typeof runtimeDiagnosticsSchema>;
441
459
  declare const duplicateIdOccurrenceSchema: z.ZodObject<{
@@ -813,6 +831,33 @@ declare const clientPatchUndoSchema: z.ZodObject<{
813
831
  requestId: string;
814
832
  }>;
815
833
  type ClientPatchUndo = z.infer<typeof clientPatchUndoSchema>;
834
+ /** v0.6: insert data-nuvio-id at a dev-time source location (click-to-tag). */
835
+ declare const clientTagElementSchema: z.ZodObject<{
836
+ type: z.ZodLiteral<"tagElement">;
837
+ protocolVersion: z.ZodNumber;
838
+ requestId: z.ZodString;
839
+ file: z.ZodString;
840
+ line: z.ZodNumber;
841
+ column: z.ZodNumber;
842
+ nuvioId: z.ZodString;
843
+ }, "strip", z.ZodTypeAny, {
844
+ type: "tagElement";
845
+ file: string;
846
+ line: number;
847
+ column: number;
848
+ nuvioId: string;
849
+ protocolVersion: number;
850
+ requestId: string;
851
+ }, {
852
+ type: "tagElement";
853
+ file: string;
854
+ line: number;
855
+ column: number;
856
+ nuvioId: string;
857
+ protocolVersion: number;
858
+ requestId: string;
859
+ }>;
860
+ type ClientTagElement = z.infer<typeof clientTagElementSchema>;
816
861
  declare const clientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
817
862
  type: z.ZodLiteral<"ping">;
818
863
  protocolVersion: z.ZodNumber;
@@ -993,6 +1038,30 @@ declare const clientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
993
1038
  type: "patchUndo";
994
1039
  protocolVersion: number;
995
1040
  requestId: string;
1041
+ }>, z.ZodObject<{
1042
+ type: z.ZodLiteral<"tagElement">;
1043
+ protocolVersion: z.ZodNumber;
1044
+ requestId: z.ZodString;
1045
+ file: z.ZodString;
1046
+ line: z.ZodNumber;
1047
+ column: z.ZodNumber;
1048
+ nuvioId: z.ZodString;
1049
+ }, "strip", z.ZodTypeAny, {
1050
+ type: "tagElement";
1051
+ file: string;
1052
+ line: number;
1053
+ column: number;
1054
+ nuvioId: string;
1055
+ protocolVersion: number;
1056
+ requestId: string;
1057
+ }, {
1058
+ type: "tagElement";
1059
+ file: string;
1060
+ line: number;
1061
+ column: number;
1062
+ nuvioId: string;
1063
+ protocolVersion: number;
1064
+ requestId: string;
996
1065
  }>]>;
997
1066
  type ClientMessage = z.infer<typeof clientMessageSchema>;
998
1067
  declare const serverPongSchema: z.ZodObject<{
@@ -1004,16 +1073,20 @@ declare const serverPongSchema: z.ZodObject<{
1004
1073
  reactVersion: z.ZodOptional<z.ZodString>;
1005
1074
  tailwindVersion: z.ZodOptional<z.ZodString>;
1006
1075
  overlayCssMode: z.ZodOptional<z.ZodLiteral<"self-contained">>;
1076
+ /** Project-level library detection (v0.8). */
1077
+ detectedLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>, "many">>;
1007
1078
  }, "strip", z.ZodTypeAny, {
1008
1079
  viteVersion?: string | undefined;
1009
1080
  reactVersion?: string | undefined;
1010
1081
  tailwindVersion?: string | undefined;
1011
1082
  overlayCssMode?: "self-contained" | undefined;
1083
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1012
1084
  }, {
1013
1085
  viteVersion?: string | undefined;
1014
1086
  reactVersion?: string | undefined;
1015
1087
  tailwindVersion?: string | undefined;
1016
1088
  overlayCssMode?: "self-contained" | undefined;
1089
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1017
1090
  }>>;
1018
1091
  }, "strip", z.ZodTypeAny, {
1019
1092
  type: "pong";
@@ -1024,6 +1097,7 @@ declare const serverPongSchema: z.ZodObject<{
1024
1097
  reactVersion?: string | undefined;
1025
1098
  tailwindVersion?: string | undefined;
1026
1099
  overlayCssMode?: "self-contained" | undefined;
1100
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1027
1101
  } | undefined;
1028
1102
  }, {
1029
1103
  type: "pong";
@@ -1034,6 +1108,7 @@ declare const serverPongSchema: z.ZodObject<{
1034
1108
  reactVersion?: string | undefined;
1035
1109
  tailwindVersion?: string | undefined;
1036
1110
  overlayCssMode?: "self-contained" | undefined;
1111
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1037
1112
  } | undefined;
1038
1113
  }>;
1039
1114
  declare const serverErrorSchema: z.ZodObject<{
@@ -1209,6 +1284,10 @@ declare const serverIndexReadySchema: z.ZodObject<{
1209
1284
  arrayName: string;
1210
1285
  field: string;
1211
1286
  }>>;
1287
+ /** Index v5: detected className expression mode for patch routing. */
1288
+ classNameMode: z.ZodOptional<z.ZodEnum<["literal-only", "cn-basic", "cn-conditional", "classnames-static", "unsupported"]>>;
1289
+ /** Index v6: shadcn / TailAdmin / DaisyUI hint for this host. */
1290
+ libraryHint: z.ZodOptional<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>>;
1212
1291
  }, "strip", z.ZodTypeAny, {
1213
1292
  file: string;
1214
1293
  line: number;
@@ -1271,6 +1350,8 @@ declare const serverIndexReadySchema: z.ZodObject<{
1271
1350
  arrayName: string;
1272
1351
  field: string;
1273
1352
  } | undefined;
1353
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
1354
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
1274
1355
  }, {
1275
1356
  file: string;
1276
1357
  line: number;
@@ -1333,6 +1414,8 @@ declare const serverIndexReadySchema: z.ZodObject<{
1333
1414
  arrayName: string;
1334
1415
  field: string;
1335
1416
  } | undefined;
1417
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
1418
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
1336
1419
  }>, "many">;
1337
1420
  duplicateErrors: z.ZodArray<z.ZodObject<{
1338
1421
  id: z.ZodString;
@@ -1369,16 +1452,20 @@ declare const serverIndexReadySchema: z.ZodObject<{
1369
1452
  reactVersion: z.ZodOptional<z.ZodString>;
1370
1453
  tailwindVersion: z.ZodOptional<z.ZodString>;
1371
1454
  overlayCssMode: z.ZodOptional<z.ZodLiteral<"self-contained">>;
1455
+ /** Project-level library detection (v0.8). */
1456
+ detectedLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>, "many">>;
1372
1457
  }, "strip", z.ZodTypeAny, {
1373
1458
  viteVersion?: string | undefined;
1374
1459
  reactVersion?: string | undefined;
1375
1460
  tailwindVersion?: string | undefined;
1376
1461
  overlayCssMode?: "self-contained" | undefined;
1462
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1377
1463
  }, {
1378
1464
  viteVersion?: string | undefined;
1379
1465
  reactVersion?: string | undefined;
1380
1466
  tailwindVersion?: string | undefined;
1381
1467
  overlayCssMode?: "self-contained" | undefined;
1468
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1382
1469
  }>>;
1383
1470
  }, "strip", z.ZodTypeAny, {
1384
1471
  entries: {
@@ -1443,6 +1530,8 @@ declare const serverIndexReadySchema: z.ZodObject<{
1443
1530
  arrayName: string;
1444
1531
  field: string;
1445
1532
  } | undefined;
1533
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
1534
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
1446
1535
  }[];
1447
1536
  type: "indexReady";
1448
1537
  protocolVersion: number;
@@ -1460,6 +1549,7 @@ declare const serverIndexReadySchema: z.ZodObject<{
1460
1549
  reactVersion?: string | undefined;
1461
1550
  tailwindVersion?: string | undefined;
1462
1551
  overlayCssMode?: "self-contained" | undefined;
1552
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1463
1553
  } | undefined;
1464
1554
  }, {
1465
1555
  entries: {
@@ -1524,6 +1614,8 @@ declare const serverIndexReadySchema: z.ZodObject<{
1524
1614
  arrayName: string;
1525
1615
  field: string;
1526
1616
  } | undefined;
1617
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
1618
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
1527
1619
  }[];
1528
1620
  type: "indexReady";
1529
1621
  protocolVersion: number;
@@ -1541,6 +1633,7 @@ declare const serverIndexReadySchema: z.ZodObject<{
1541
1633
  reactVersion?: string | undefined;
1542
1634
  tailwindVersion?: string | undefined;
1543
1635
  overlayCssMode?: "self-contained" | undefined;
1636
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1544
1637
  } | undefined;
1545
1638
  }>;
1546
1639
  type ServerIndexReady = z.infer<typeof serverIndexReadySchema>;
@@ -1875,6 +1968,32 @@ declare const serverPatchUndoAckSchema: z.ZodObject<{
1875
1968
  undoStackDepth?: number | undefined;
1876
1969
  }>;
1877
1970
  type ServerPatchUndoAck = z.infer<typeof serverPatchUndoAckSchema>;
1971
+ declare const serverTagElementAckSchema: z.ZodObject<{
1972
+ type: z.ZodLiteral<"tagElementAck">;
1973
+ protocolVersion: z.ZodNumber;
1974
+ requestId: z.ZodString;
1975
+ ok: z.ZodBoolean;
1976
+ id: z.ZodOptional<z.ZodString>;
1977
+ errorCode: z.ZodOptional<z.ZodString>;
1978
+ errorMessage: z.ZodOptional<z.ZodString>;
1979
+ }, "strip", z.ZodTypeAny, {
1980
+ type: "tagElementAck";
1981
+ protocolVersion: number;
1982
+ requestId: string;
1983
+ ok: boolean;
1984
+ id?: string | undefined;
1985
+ errorCode?: string | undefined;
1986
+ errorMessage?: string | undefined;
1987
+ }, {
1988
+ type: "tagElementAck";
1989
+ protocolVersion: number;
1990
+ requestId: string;
1991
+ ok: boolean;
1992
+ id?: string | undefined;
1993
+ errorCode?: string | undefined;
1994
+ errorMessage?: string | undefined;
1995
+ }>;
1996
+ type ServerTagElementAck = z.infer<typeof serverTagElementAckSchema>;
1878
1997
  declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1879
1998
  type: z.ZodLiteral<"pong">;
1880
1999
  protocolVersion: z.ZodNumber;
@@ -1884,16 +2003,20 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1884
2003
  reactVersion: z.ZodOptional<z.ZodString>;
1885
2004
  tailwindVersion: z.ZodOptional<z.ZodString>;
1886
2005
  overlayCssMode: z.ZodOptional<z.ZodLiteral<"self-contained">>;
2006
+ /** Project-level library detection (v0.8). */
2007
+ detectedLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>, "many">>;
1887
2008
  }, "strip", z.ZodTypeAny, {
1888
2009
  viteVersion?: string | undefined;
1889
2010
  reactVersion?: string | undefined;
1890
2011
  tailwindVersion?: string | undefined;
1891
2012
  overlayCssMode?: "self-contained" | undefined;
2013
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1892
2014
  }, {
1893
2015
  viteVersion?: string | undefined;
1894
2016
  reactVersion?: string | undefined;
1895
2017
  tailwindVersion?: string | undefined;
1896
2018
  overlayCssMode?: "self-contained" | undefined;
2019
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1897
2020
  }>>;
1898
2021
  }, "strip", z.ZodTypeAny, {
1899
2022
  type: "pong";
@@ -1904,6 +2027,7 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1904
2027
  reactVersion?: string | undefined;
1905
2028
  tailwindVersion?: string | undefined;
1906
2029
  overlayCssMode?: "self-contained" | undefined;
2030
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1907
2031
  } | undefined;
1908
2032
  }, {
1909
2033
  type: "pong";
@@ -1914,6 +2038,7 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
1914
2038
  reactVersion?: string | undefined;
1915
2039
  tailwindVersion?: string | undefined;
1916
2040
  overlayCssMode?: "self-contained" | undefined;
2041
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
1917
2042
  } | undefined;
1918
2043
  }>, z.ZodObject<{
1919
2044
  type: z.ZodLiteral<"error">;
@@ -2087,6 +2212,10 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2087
2212
  arrayName: string;
2088
2213
  field: string;
2089
2214
  }>>;
2215
+ /** Index v5: detected className expression mode for patch routing. */
2216
+ classNameMode: z.ZodOptional<z.ZodEnum<["literal-only", "cn-basic", "cn-conditional", "classnames-static", "unsupported"]>>;
2217
+ /** Index v6: shadcn / TailAdmin / DaisyUI hint for this host. */
2218
+ libraryHint: z.ZodOptional<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>>;
2090
2219
  }, "strip", z.ZodTypeAny, {
2091
2220
  file: string;
2092
2221
  line: number;
@@ -2149,6 +2278,8 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2149
2278
  arrayName: string;
2150
2279
  field: string;
2151
2280
  } | undefined;
2281
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
2282
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
2152
2283
  }, {
2153
2284
  file: string;
2154
2285
  line: number;
@@ -2211,6 +2342,8 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2211
2342
  arrayName: string;
2212
2343
  field: string;
2213
2344
  } | undefined;
2345
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
2346
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
2214
2347
  }>, "many">;
2215
2348
  duplicateErrors: z.ZodArray<z.ZodObject<{
2216
2349
  id: z.ZodString;
@@ -2247,16 +2380,20 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2247
2380
  reactVersion: z.ZodOptional<z.ZodString>;
2248
2381
  tailwindVersion: z.ZodOptional<z.ZodString>;
2249
2382
  overlayCssMode: z.ZodOptional<z.ZodLiteral<"self-contained">>;
2383
+ /** Project-level library detection (v0.8). */
2384
+ detectedLibraries: z.ZodOptional<z.ZodArray<z.ZodEnum<["shadcn", "tailadmin", "daisyui"]>, "many">>;
2250
2385
  }, "strip", z.ZodTypeAny, {
2251
2386
  viteVersion?: string | undefined;
2252
2387
  reactVersion?: string | undefined;
2253
2388
  tailwindVersion?: string | undefined;
2254
2389
  overlayCssMode?: "self-contained" | undefined;
2390
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
2255
2391
  }, {
2256
2392
  viteVersion?: string | undefined;
2257
2393
  reactVersion?: string | undefined;
2258
2394
  tailwindVersion?: string | undefined;
2259
2395
  overlayCssMode?: "self-contained" | undefined;
2396
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
2260
2397
  }>>;
2261
2398
  }, "strip", z.ZodTypeAny, {
2262
2399
  entries: {
@@ -2321,6 +2458,8 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2321
2458
  arrayName: string;
2322
2459
  field: string;
2323
2460
  } | undefined;
2461
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
2462
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
2324
2463
  }[];
2325
2464
  type: "indexReady";
2326
2465
  protocolVersion: number;
@@ -2338,6 +2477,7 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2338
2477
  reactVersion?: string | undefined;
2339
2478
  tailwindVersion?: string | undefined;
2340
2479
  overlayCssMode?: "self-contained" | undefined;
2480
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
2341
2481
  } | undefined;
2342
2482
  }, {
2343
2483
  entries: {
@@ -2402,6 +2542,8 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2402
2542
  arrayName: string;
2403
2543
  field: string;
2404
2544
  } | undefined;
2545
+ classNameMode?: "unsupported" | "literal-only" | "cn-basic" | "cn-conditional" | "classnames-static" | undefined;
2546
+ libraryHint?: "shadcn" | "tailadmin" | "daisyui" | undefined;
2405
2547
  }[];
2406
2548
  type: "indexReady";
2407
2549
  protocolVersion: number;
@@ -2419,6 +2561,7 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2419
2561
  reactVersion?: string | undefined;
2420
2562
  tailwindVersion?: string | undefined;
2421
2563
  overlayCssMode?: "self-contained" | undefined;
2564
+ detectedLibraries?: ("shadcn" | "tailadmin" | "daisyui")[] | undefined;
2422
2565
  } | undefined;
2423
2566
  }>, z.ZodObject<{
2424
2567
  type: z.ZodLiteral<"selectAck">;
@@ -2745,10 +2888,59 @@ declare const serverMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<
2745
2888
  errorCode?: string | undefined;
2746
2889
  errorMessage?: string | undefined;
2747
2890
  undoStackDepth?: number | undefined;
2891
+ }>, z.ZodObject<{
2892
+ type: z.ZodLiteral<"tagElementAck">;
2893
+ protocolVersion: z.ZodNumber;
2894
+ requestId: z.ZodString;
2895
+ ok: z.ZodBoolean;
2896
+ id: z.ZodOptional<z.ZodString>;
2897
+ errorCode: z.ZodOptional<z.ZodString>;
2898
+ errorMessage: z.ZodOptional<z.ZodString>;
2899
+ }, "strip", z.ZodTypeAny, {
2900
+ type: "tagElementAck";
2901
+ protocolVersion: number;
2902
+ requestId: string;
2903
+ ok: boolean;
2904
+ id?: string | undefined;
2905
+ errorCode?: string | undefined;
2906
+ errorMessage?: string | undefined;
2907
+ }, {
2908
+ type: "tagElementAck";
2909
+ protocolVersion: number;
2910
+ requestId: string;
2911
+ ok: boolean;
2912
+ id?: string | undefined;
2913
+ errorCode?: string | undefined;
2914
+ errorMessage?: string | undefined;
2748
2915
  }>]>;
2749
2916
  type ServerMessage = z.infer<typeof serverMessageSchema>;
2750
2917
  declare function parseClientMessage(raw: string): ClientMessage | null;
2751
2918
  declare function parseServerMessage(raw: string): ServerMessage | null;
2752
2919
  declare function serializeServerMessage(msg: ServerMessage): string;
2753
2920
 
2754
- export { type Breakpoint, type ClientMessage, type ClientPatchApply, type ClientPatchUndo, type ClientPing, type ClientSelect, type DuplicateIdError, type HierarchyRole, type IndexWireEntry, NUVIO_WS_PATH, PROTOCOL_VERSION, type PatchOp, type RiskLevel, type RowWireTarget, type RuntimeDiagnostics, type ServerIndexReady, type ServerMessage, type ServerPatchAck, type ServerPatchUndoAck, type ServerSelectAck, type StyleWireTarget, type TableDataFieldBinding, type TableMeta, type TextWireTarget, breakpointSchema, clientMessageSchema, clientPatchApplySchema, clientPatchUndoSchema, clientPingSchema, clientSelectSchema, duplicateIdErrorSchema, duplicateIdOccurrenceSchema, hierarchyRoleSchema, indexEntrySchema, parseClientMessage, parseServerMessage, patchOpDuplicateHostSchema, patchOpMergeTailwindSchema, patchOpMoveSiblingSchema, patchOpSchema, patchOpSetHiddenSchema, patchOpSetTableDataFieldSchema, patchOpSetTextSchema, riskLevelSchema, rowTargetSchema, runtimeDiagnosticsSchema, serializeServerMessage, serverErrorSchema, serverIndexReadySchema, serverMessageSchema, serverPatchAckSchema, serverPatchUndoAckSchema, serverPongSchema, serverSelectAckSchema, styleTargetSchema, tableDataFieldSchema, tableMetaSchema, textTargetSchema };
2921
+ declare const LIBRARY_IDS: readonly ["shadcn", "tailadmin", "daisyui"];
2922
+ declare function librarySegmentForTag(tagName: string, libraryId: LibraryId): string | undefined;
2923
+ declare function isShadcnCompoundTag(tagName: string): boolean;
2924
+ /** Infer library from absolute/relative source file path. */
2925
+ declare function inferLibraryFromFilePath(filePath: string): LibraryId | undefined;
2926
+ declare function resolveEntryLibraryHint(filePath: string, tagName: string, detectedLibraries: readonly LibraryId[]): LibraryId | undefined;
2927
+ declare function detectShadcnComponentMode(tagName: string | undefined): "card" | "button" | "table" | "form" | null;
2928
+ declare function libraryGuidanceForEntry(entry: IndexWireEntry): string | undefined;
2929
+ declare function formatLibraryList(libraries: readonly LibraryId[]): string;
2930
+
2931
+ /** Segmented id: `page.title`, `metric.orders.card` */
2932
+ declare const NUVIO_ID_PATTERN: RegExp;
2933
+ declare function isValidNuvioId(id: string): boolean;
2934
+ /**
2935
+ * Suggest a segmented nuvio id from element tag and optional library context.
2936
+ * Does not use element text or file paths.
2937
+ */
2938
+ declare function suggestNuvioId(options: {
2939
+ tagName: string;
2940
+ existingIds: ReadonlySet<string>;
2941
+ parentPrefix?: string;
2942
+ libraryHint?: LibraryId;
2943
+ componentName?: string;
2944
+ }): string;
2945
+
2946
+ export { type Breakpoint, type ClientMessage, type ClientPatchApply, type ClientPatchUndo, type ClientPing, type ClientSelect, type ClientTagElement, type DuplicateIdError, type HierarchyRole, type IndexWireEntry, LIBRARY_IDS, type LibraryId, NUVIO_ID_PATTERN, NUVIO_WS_PATH, PROTOCOL_VERSION, type PatchOp, type RiskLevel, type RowWireTarget, type RuntimeDiagnostics, type ServerIndexReady, type ServerMessage, type ServerPatchAck, type ServerPatchUndoAck, type ServerSelectAck, type ServerTagElementAck, type StyleWireTarget, type TableDataFieldBinding, type TableMeta, type TextWireTarget, type WireClassNameMode, breakpointSchema, classNameModeSchema, clientMessageSchema, clientPatchApplySchema, clientPatchUndoSchema, clientPingSchema, clientSelectSchema, clientTagElementSchema, detectShadcnComponentMode, duplicateIdErrorSchema, duplicateIdOccurrenceSchema, formatLibraryList, hierarchyRoleSchema, indexEntrySchema, inferLibraryFromFilePath, isShadcnCompoundTag, isValidNuvioId, libraryGuidanceForEntry, libraryIdSchema, librarySegmentForTag, parseClientMessage, parseServerMessage, patchOpDuplicateHostSchema, patchOpMergeTailwindSchema, patchOpMoveSiblingSchema, patchOpSchema, patchOpSetHiddenSchema, patchOpSetTableDataFieldSchema, patchOpSetTextSchema, resolveEntryLibraryHint, riskLevelSchema, rowTargetSchema, runtimeDiagnosticsSchema, serializeServerMessage, serverErrorSchema, serverIndexReadySchema, serverMessageSchema, serverPatchAckSchema, serverPatchUndoAckSchema, serverPongSchema, serverSelectAckSchema, serverTagElementAckSchema, styleTargetSchema, suggestNuvioId, tableDataFieldSchema, tableMetaSchema, textTargetSchema };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var NUVIO_WS_PATH = "/__nuvio/ws";
3
3
 
4
4
  // src/protocol.ts
5
5
  import { z } from "zod";
6
- var PROTOCOL_VERSION = 7;
6
+ var PROTOCOL_VERSION = 8;
7
7
  var riskLevelSchema = z.enum(["safe", "caution", "unsupported"]);
8
8
  var textTargetSchema = z.object({
9
9
  /** Stable within host: `data-nuvio-id` or `loc:line:column`. */
@@ -65,6 +65,14 @@ var tableDataFieldSchema = z.object({
65
65
  rowKey: z.string(),
66
66
  field: z.string()
67
67
  });
68
+ var classNameModeSchema = z.enum([
69
+ "literal-only",
70
+ "cn-basic",
71
+ "cn-conditional",
72
+ "classnames-static",
73
+ "unsupported"
74
+ ]);
75
+ var libraryIdSchema = z.enum(["shadcn", "tailadmin", "daisyui"]);
68
76
  var indexEntrySchema = z.object({
69
77
  id: z.string(),
70
78
  file: z.string(),
@@ -99,13 +107,19 @@ var indexEntrySchema = z.object({
99
107
  /** Index v4: static table data binding for Tier C. */
100
108
  tableMeta: tableMetaSchema.optional(),
101
109
  /** Index v4: when this host maps to a `tableData` field edit. */
102
- tableDataField: tableDataFieldSchema.optional()
110
+ tableDataField: tableDataFieldSchema.optional(),
111
+ /** Index v5: detected className expression mode for patch routing. */
112
+ classNameMode: classNameModeSchema.optional(),
113
+ /** Index v6: shadcn / TailAdmin / DaisyUI hint for this host. */
114
+ libraryHint: libraryIdSchema.optional()
103
115
  });
104
116
  var runtimeDiagnosticsSchema = z.object({
105
117
  viteVersion: z.string().optional(),
106
118
  reactVersion: z.string().optional(),
107
119
  tailwindVersion: z.string().optional(),
108
- overlayCssMode: z.literal("self-contained").optional()
120
+ overlayCssMode: z.literal("self-contained").optional(),
121
+ /** Project-level library detection (v0.8). */
122
+ detectedLibraries: z.array(libraryIdSchema).optional()
109
123
  });
110
124
  var duplicateIdOccurrenceSchema = z.object({
111
125
  file: z.string(),
@@ -183,11 +197,21 @@ var clientPatchUndoSchema = z.object({
183
197
  protocolVersion: z.number().int(),
184
198
  requestId: z.string().min(1)
185
199
  });
200
+ var clientTagElementSchema = z.object({
201
+ type: z.literal("tagElement"),
202
+ protocolVersion: z.number().int(),
203
+ requestId: z.string().min(1),
204
+ file: z.string().min(1),
205
+ line: z.number().int().positive(),
206
+ column: z.number().int().nonnegative(),
207
+ nuvioId: z.string().min(1)
208
+ });
186
209
  var clientMessageSchema = z.discriminatedUnion("type", [
187
210
  clientPingSchema,
188
211
  clientSelectSchema,
189
212
  clientPatchApplySchema,
190
- clientPatchUndoSchema
213
+ clientPatchUndoSchema,
214
+ clientTagElementSchema
191
215
  ]);
192
216
  var serverPongSchema = z.object({
193
217
  type: z.literal("pong"),
@@ -259,13 +283,23 @@ var serverPatchUndoAckSchema = z.object({
259
283
  errorCode: z.string().optional(),
260
284
  errorMessage: z.string().optional()
261
285
  });
286
+ var serverTagElementAckSchema = z.object({
287
+ type: z.literal("tagElementAck"),
288
+ protocolVersion: z.number().int(),
289
+ requestId: z.string(),
290
+ ok: z.boolean(),
291
+ id: z.string().optional(),
292
+ errorCode: z.string().optional(),
293
+ errorMessage: z.string().optional()
294
+ });
262
295
  var serverMessageSchema = z.discriminatedUnion("type", [
263
296
  serverPongSchema,
264
297
  serverErrorSchema,
265
298
  serverIndexReadySchema,
266
299
  serverSelectAckSchema,
267
300
  serverPatchAckSchema,
268
- serverPatchUndoAckSchema
301
+ serverPatchUndoAckSchema,
302
+ serverTagElementAckSchema
269
303
  ]);
270
304
  function parseClientMessage(raw) {
271
305
  let json;
@@ -290,19 +324,212 @@ function parseServerMessage(raw) {
290
324
  function serializeServerMessage(msg) {
291
325
  return JSON.stringify(msg);
292
326
  }
327
+
328
+ // src/library-registry.ts
329
+ var LIBRARY_IDS = ["shadcn", "tailadmin", "daisyui"];
330
+ var SHADCN_COMPOUND_TAGS = /* @__PURE__ */ new Set([
331
+ "Button",
332
+ "Card",
333
+ "CardHeader",
334
+ "CardTitle",
335
+ "CardDescription",
336
+ "CardContent",
337
+ "CardFooter",
338
+ "Input",
339
+ "Label",
340
+ "Badge",
341
+ "Table",
342
+ "TableHeader",
343
+ "TableBody",
344
+ "TableRow",
345
+ "TableCell",
346
+ "TableHead",
347
+ "Dialog",
348
+ "DialogTitle",
349
+ "DialogContent",
350
+ "DialogHeader"
351
+ ]);
352
+ var SHADCN_TAG_SEGMENTS = {
353
+ Button: "button",
354
+ Card: "card",
355
+ CardHeader: "header",
356
+ CardTitle: "title",
357
+ CardDescription: "description",
358
+ CardContent: "content",
359
+ CardFooter: "footer",
360
+ Input: "input",
361
+ Label: "label",
362
+ Badge: "badge",
363
+ Table: "table",
364
+ TableHeader: "header",
365
+ TableBody: "body",
366
+ TableRow: "row",
367
+ TableCell: "cell",
368
+ TableHead: "header",
369
+ Dialog: "dialog",
370
+ DialogTitle: "title",
371
+ DialogContent: "content",
372
+ DialogHeader: "header"
373
+ };
374
+ var DAISYUI_CLASS_HINTS = /* @__PURE__ */ new Set(["btn", "card", "table", "navbar", "badge", "input"]);
375
+ function librarySegmentForTag(tagName, libraryId) {
376
+ if (libraryId === "shadcn") {
377
+ return SHADCN_TAG_SEGMENTS[tagName];
378
+ }
379
+ if (libraryId === "daisyui") {
380
+ const lower = tagName.toLowerCase();
381
+ if (DAISYUI_CLASS_HINTS.has(lower)) {
382
+ return lower;
383
+ }
384
+ }
385
+ return void 0;
386
+ }
387
+ function isShadcnCompoundTag(tagName) {
388
+ return SHADCN_COMPOUND_TAGS.has(tagName);
389
+ }
390
+ function inferLibraryFromFilePath(filePath) {
391
+ const normalized = filePath.replace(/\\/g, "/").toLowerCase();
392
+ if (normalized.includes("/components/ui/")) {
393
+ return "shadcn";
394
+ }
395
+ if (normalized.includes("/layout/appsidebar") || normalized.includes("/components/ecommerce/") || normalized.includes("tailadmin")) {
396
+ return "tailadmin";
397
+ }
398
+ return void 0;
399
+ }
400
+ function resolveEntryLibraryHint(filePath, tagName, detectedLibraries) {
401
+ const fromPath = inferLibraryFromFilePath(filePath);
402
+ if (fromPath) {
403
+ return fromPath;
404
+ }
405
+ if (detectedLibraries.includes("shadcn") && isShadcnCompoundTag(tagName)) {
406
+ return "shadcn";
407
+ }
408
+ if (detectedLibraries.includes("daisyui")) {
409
+ const lower = tagName.toLowerCase();
410
+ if (DAISYUI_CLASS_HINTS.has(lower)) {
411
+ return "daisyui";
412
+ }
413
+ }
414
+ if (detectedLibraries.includes("tailadmin")) {
415
+ return "tailadmin";
416
+ }
417
+ return void 0;
418
+ }
419
+ function detectShadcnComponentMode(tagName) {
420
+ if (!tagName) {
421
+ return null;
422
+ }
423
+ if (tagName === "Button") {
424
+ return "button";
425
+ }
426
+ if (tagName === "Card" || tagName.startsWith("Card")) {
427
+ return "card";
428
+ }
429
+ if (tagName.startsWith("Table")) {
430
+ return "table";
431
+ }
432
+ if (tagName === "Input" || tagName === "Label") {
433
+ return "form";
434
+ }
435
+ return null;
436
+ }
437
+ function libraryGuidanceForEntry(entry) {
438
+ if (entry.libraryHint !== "shadcn") {
439
+ return void 0;
440
+ }
441
+ const tag = entry.tagName ?? "";
442
+ if (isShadcnCompoundTag(tag) && entry.riskLevel === "caution" && !entry.hasLiteralClassName) {
443
+ return "shadcn component \u2014 add className on the component call site, or tag a native child inside CardContent.";
444
+ }
445
+ if (tag.startsWith("Dialog") && entry.riskLevel === "unsupported") {
446
+ return "Dialog portal content may need a tagged host inside DialogContent.";
447
+ }
448
+ return void 0;
449
+ }
450
+ function formatLibraryList(libraries) {
451
+ if (libraries.length === 0) {
452
+ return "none detected";
453
+ }
454
+ return libraries.join(", ");
455
+ }
456
+
457
+ // src/suggest-nuvio-id.ts
458
+ var NUVIO_ID_PATTERN = /^[a-z][a-z0-9]*(\.[a-z][a-z0-9]*)+$/;
459
+ function isValidNuvioId(id) {
460
+ return NUVIO_ID_PATTERN.test(id);
461
+ }
462
+ var NATIVE_TAG_SEGMENT = {
463
+ h1: "title",
464
+ h2: "title",
465
+ h3: "title",
466
+ h4: "title",
467
+ h5: "title",
468
+ h6: "title",
469
+ p: "text",
470
+ span: "label",
471
+ button: "button",
472
+ a: "link",
473
+ label: "label",
474
+ td: "cell",
475
+ th: "header",
476
+ li: "item",
477
+ img: "image",
478
+ input: "input",
479
+ div: "block",
480
+ section: "section",
481
+ article: "article",
482
+ header: "header",
483
+ footer: "footer",
484
+ nav: "nav",
485
+ main: "main"
486
+ };
487
+ function uniqueId(base, existing) {
488
+ if (!existing.has(base)) {
489
+ return base;
490
+ }
491
+ for (let i = 2; i < 100; i++) {
492
+ const candidate = `${base}${i}`;
493
+ if (!existing.has(candidate)) {
494
+ return candidate;
495
+ }
496
+ }
497
+ return `${base}.copy`;
498
+ }
499
+ function suggestNuvioId(options) {
500
+ const tag = options.tagName;
501
+ const librarySegment = options.libraryHint ? librarySegmentForTag(tag, options.libraryHint) : void 0;
502
+ const nativeSegment = NATIVE_TAG_SEGMENT[tag.toLowerCase()];
503
+ const segment = librarySegment ?? nativeSegment ?? "element";
504
+ const prefix = options.parentPrefix?.trim();
505
+ const base = prefix ? `${prefix}.${segment}` : `page.${segment}`;
506
+ return uniqueId(base, options.existingIds);
507
+ }
293
508
  export {
509
+ LIBRARY_IDS,
510
+ NUVIO_ID_PATTERN,
294
511
  NUVIO_WS_PATH,
295
512
  PROTOCOL_VERSION,
296
513
  breakpointSchema,
514
+ classNameModeSchema,
297
515
  clientMessageSchema,
298
516
  clientPatchApplySchema,
299
517
  clientPatchUndoSchema,
300
518
  clientPingSchema,
301
519
  clientSelectSchema,
520
+ clientTagElementSchema,
521
+ detectShadcnComponentMode,
302
522
  duplicateIdErrorSchema,
303
523
  duplicateIdOccurrenceSchema,
524
+ formatLibraryList,
304
525
  hierarchyRoleSchema,
305
526
  indexEntrySchema,
527
+ inferLibraryFromFilePath,
528
+ isShadcnCompoundTag,
529
+ isValidNuvioId,
530
+ libraryGuidanceForEntry,
531
+ libraryIdSchema,
532
+ librarySegmentForTag,
306
533
  parseClientMessage,
307
534
  parseServerMessage,
308
535
  patchOpDuplicateHostSchema,
@@ -312,6 +539,7 @@ export {
312
539
  patchOpSetHiddenSchema,
313
540
  patchOpSetTableDataFieldSchema,
314
541
  patchOpSetTextSchema,
542
+ resolveEntryLibraryHint,
315
543
  riskLevelSchema,
316
544
  rowTargetSchema,
317
545
  runtimeDiagnosticsSchema,
@@ -323,7 +551,9 @@ export {
323
551
  serverPatchUndoAckSchema,
324
552
  serverPongSchema,
325
553
  serverSelectAckSchema,
554
+ serverTagElementAckSchema,
326
555
  styleTargetSchema,
556
+ suggestNuvioId,
327
557
  tableDataFieldSchema,
328
558
  tableMetaSchema,
329
559
  textTargetSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuvio/shared",
3
- "version": "0.5.5",
3
+ "version": "1.0.0",
4
4
  "description": "Nuvio wire protocol (Zod), shared types, and path helpers for dev tooling.",
5
5
  "license": "MIT",
6
6
  "repository": {