@sia.soul/sia-react-ui 0.1.86 → 0.1.87

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
@@ -10244,7 +10244,75 @@ var DIALECT_KEYWORDS = {
10244
10244
  "top",
10245
10245
  "try",
10246
10246
  "try_convert",
10247
- "unpivot"
10247
+ "unpivot",
10248
+ "backup",
10249
+ "break",
10250
+ "bulk",
10251
+ "checkpoint",
10252
+ "close",
10253
+ "continue",
10254
+ "cursor",
10255
+ "dbcc",
10256
+ "deallocate",
10257
+ "declare",
10258
+ "deny",
10259
+ "disk",
10260
+ "distributed",
10261
+ "dump",
10262
+ "errlvl",
10263
+ "external",
10264
+ "file",
10265
+ "fillfactor",
10266
+ "function",
10267
+ "goto",
10268
+ "holdlock",
10269
+ "identity_insert",
10270
+ "identitycol",
10271
+ "if",
10272
+ "kill",
10273
+ "lineno",
10274
+ "load",
10275
+ "national",
10276
+ "nocount",
10277
+ "off",
10278
+ "open",
10279
+ "opendatasource",
10280
+ "openquery",
10281
+ "openrowset",
10282
+ "openxml",
10283
+ "option",
10284
+ "percent",
10285
+ "plan",
10286
+ "print",
10287
+ "proc",
10288
+ "public",
10289
+ "read",
10290
+ "readtext",
10291
+ "reconfigure",
10292
+ "replication",
10293
+ "restore",
10294
+ "return",
10295
+ "revert",
10296
+ "rowcount",
10297
+ "rowguidcol",
10298
+ "rule",
10299
+ "save",
10300
+ "securityaudit",
10301
+ "session_user",
10302
+ "shutdown",
10303
+ "statistics",
10304
+ "system_user",
10305
+ "textsize",
10306
+ "tran",
10307
+ "tsequal",
10308
+ "updatetext",
10309
+ "use",
10310
+ "user",
10311
+ "varying",
10312
+ "waitfor",
10313
+ "while",
10314
+ "within",
10315
+ "writetext"
10248
10316
  ],
10249
10317
  "sql-sqlite": [
10250
10318
  "attach",
@@ -10261,6 +10329,115 @@ var DIALECT_KEYWORDS = {
10261
10329
  "without"
10262
10330
  ]
10263
10331
  };
10332
+ var COMMON_FUNCTIONS = ["abs", "avg", "coalesce", "count", "max", "min", "nullif", "round", "sum", "upper", "lower", "substring"];
10333
+ var SQLSERVER_FUNCTIONS = [
10334
+ "approx_count_distinct",
10335
+ "count_big",
10336
+ "grouping",
10337
+ "grouping_id",
10338
+ "checksum_agg",
10339
+ "stdev",
10340
+ "stdevp",
10341
+ "var",
10342
+ "varp",
10343
+ "string_agg",
10344
+ "isnull",
10345
+ "iif",
10346
+ "choose",
10347
+ "convert",
10348
+ "try_cast",
10349
+ "parse",
10350
+ "try_parse",
10351
+ "isnumeric",
10352
+ "getdate",
10353
+ "getutcdate",
10354
+ "sysdatetime",
10355
+ "sysdatetimeoffset",
10356
+ "sysutcdatetime",
10357
+ "dateadd",
10358
+ "datediff",
10359
+ "datediff_big",
10360
+ "datename",
10361
+ "datepart",
10362
+ "datefromparts",
10363
+ "datetimefromparts",
10364
+ "eomonth",
10365
+ "year",
10366
+ "month",
10367
+ "day",
10368
+ "isdate",
10369
+ "row_number",
10370
+ "rank",
10371
+ "dense_rank",
10372
+ "ntile",
10373
+ "lag",
10374
+ "lead",
10375
+ "first_value",
10376
+ "last_value",
10377
+ "percent_rank",
10378
+ "cume_dist",
10379
+ "len",
10380
+ "datalength",
10381
+ "concat",
10382
+ "concat_ws",
10383
+ "charindex",
10384
+ "patindex",
10385
+ "left",
10386
+ "right",
10387
+ "ltrim",
10388
+ "rtrim",
10389
+ "trim",
10390
+ "replace",
10391
+ "replicate",
10392
+ "reverse",
10393
+ "space",
10394
+ "stuff",
10395
+ "str",
10396
+ "string_split",
10397
+ "translate",
10398
+ "unicode",
10399
+ "quotename",
10400
+ "ceiling",
10401
+ "floor",
10402
+ "power",
10403
+ "sqrt",
10404
+ "square",
10405
+ "sign",
10406
+ "rand",
10407
+ "exp",
10408
+ "log",
10409
+ "log10",
10410
+ "json_value",
10411
+ "json_query",
10412
+ "json_modify",
10413
+ "isjson",
10414
+ "openjson",
10415
+ "newid",
10416
+ "newsequentialid",
10417
+ "object_id",
10418
+ "object_name",
10419
+ "schema_name",
10420
+ "db_name",
10421
+ "db_id",
10422
+ "col_name",
10423
+ "col_length",
10424
+ "type_name",
10425
+ "scope_identity",
10426
+ "ident_current",
10427
+ "ident_seed",
10428
+ "ident_incr",
10429
+ "error_number",
10430
+ "error_message",
10431
+ "error_line",
10432
+ "error_procedure",
10433
+ "error_severity",
10434
+ "error_state",
10435
+ "xact_state",
10436
+ "suser_sname",
10437
+ "user_name",
10438
+ "host_name",
10439
+ "app_name"
10440
+ ];
10264
10441
  var DIALECT_BUILTINS = {
10265
10442
  "sql-postgresql": [
10266
10443
  "bigserial",
@@ -10351,6 +10528,7 @@ function dialectTokenizer(language) {
10351
10528
  tokenPostfix: `.${language}`,
10352
10529
  keywords: [...COMMON_KEYWORDS, ...DIALECT_KEYWORDS[language]],
10353
10530
  builtins: DIALECT_BUILTINS[language],
10531
+ functions: [...COMMON_FUNCTIONS, ...language === "sql-sqlserver" ? SQLSERVER_FUNCTIONS : []],
10354
10532
  operators: ["=", ">", "<", "!", "~", "?", ":", "==", "<=", ">=", "!=", "<>", "+", "-", "*", "/", "%", "||", "&&"],
10355
10533
  brackets: [
10356
10534
  { open: "(", close: ")", token: "delimiter.parenthesis" },
@@ -10360,10 +10538,17 @@ function dialectTokenizer(language) {
10360
10538
  root: [
10361
10539
  { include: "@whitespace" },
10362
10540
  ...identifierRules,
10541
+ // T-SQL Unicode 字符串、局部/系统变量及参数占位符单独着色,不能吞掉后续语句。
10542
+ ...language === "sql-sqlserver" ? [
10543
+ [/N'/i, { token: "string.quote", next: "@string" }],
10544
+ [/@@?[\w$#]+/, "variable"],
10545
+ [/0x[\da-f]+/i, "number.hex"]
10546
+ ] : [],
10363
10547
  [/[a-zA-Z_@$#][\w@$#]*/, {
10364
10548
  cases: {
10365
10549
  "@keywords": "keyword",
10366
10550
  "@builtins": "type",
10551
+ "@functions": "predefined",
10367
10552
  "@default": "identifier"
10368
10553
  }
10369
10554
  }],
package/dist/index.d.cts CHANGED
@@ -1393,7 +1393,7 @@ interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
1393
1393
  /** 多行输入组件。 */
1394
1394
  declare const TextArea: react.ForwardRefExoticComponent<TextAreaProps & react.RefAttributes<HTMLTextAreaElement>>;
1395
1395
 
1396
- /** 代码编辑器支持的 SQL 方言名称。 */
1396
+ /** SQL 方言名称;sql-sqlserver 支持 T-SQL 保留字、常用内置函数、类型、变量和 Unicode 字符串着色,不执行语法有效性检查。 */
1397
1397
  type SqlDialectLanguage = "sql-postgresql" | "sql-mysql" | "sql-sqlserver" | "sql-sqlite";
1398
1398
 
1399
1399
  /** 代码编辑器的配色主题。 */
@@ -1554,7 +1554,7 @@ interface EditorProps {
1554
1554
  /** 键盘按下时调用,可用于处理快捷键。 */
1555
1555
  onKeyDown?: (event: EditorKeyDownEvent) => void;
1556
1556
  /**
1557
- * Monaco 语言标识
1557
+ * Monaco 语言标识。SQL Server 使用 sql-sqlserver,区分保留字、常用内置函数、类型、变量和 Unicode 字符串;JSON 使用 json。
1558
1558
  * @defaultValue "plaintext"
1559
1559
  */
1560
1560
  language?: EditorLanguage;
package/dist/index.d.ts CHANGED
@@ -1393,7 +1393,7 @@ interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
1393
1393
  /** 多行输入组件。 */
1394
1394
  declare const TextArea: react.ForwardRefExoticComponent<TextAreaProps & react.RefAttributes<HTMLTextAreaElement>>;
1395
1395
 
1396
- /** 代码编辑器支持的 SQL 方言名称。 */
1396
+ /** SQL 方言名称;sql-sqlserver 支持 T-SQL 保留字、常用内置函数、类型、变量和 Unicode 字符串着色,不执行语法有效性检查。 */
1397
1397
  type SqlDialectLanguage = "sql-postgresql" | "sql-mysql" | "sql-sqlserver" | "sql-sqlite";
1398
1398
 
1399
1399
  /** 代码编辑器的配色主题。 */
@@ -1554,7 +1554,7 @@ interface EditorProps {
1554
1554
  /** 键盘按下时调用,可用于处理快捷键。 */
1555
1555
  onKeyDown?: (event: EditorKeyDownEvent) => void;
1556
1556
  /**
1557
- * Monaco 语言标识
1557
+ * Monaco 语言标识。SQL Server 使用 sql-sqlserver,区分保留字、常用内置函数、类型、变量和 Unicode 字符串;JSON 使用 json。
1558
1558
  * @defaultValue "plaintext"
1559
1559
  */
1560
1560
  language?: EditorLanguage;
package/dist/index.js CHANGED
@@ -3077,7 +3077,75 @@ var DIALECT_KEYWORDS = {
3077
3077
  "top",
3078
3078
  "try",
3079
3079
  "try_convert",
3080
- "unpivot"
3080
+ "unpivot",
3081
+ "backup",
3082
+ "break",
3083
+ "bulk",
3084
+ "checkpoint",
3085
+ "close",
3086
+ "continue",
3087
+ "cursor",
3088
+ "dbcc",
3089
+ "deallocate",
3090
+ "declare",
3091
+ "deny",
3092
+ "disk",
3093
+ "distributed",
3094
+ "dump",
3095
+ "errlvl",
3096
+ "external",
3097
+ "file",
3098
+ "fillfactor",
3099
+ "function",
3100
+ "goto",
3101
+ "holdlock",
3102
+ "identity_insert",
3103
+ "identitycol",
3104
+ "if",
3105
+ "kill",
3106
+ "lineno",
3107
+ "load",
3108
+ "national",
3109
+ "nocount",
3110
+ "off",
3111
+ "open",
3112
+ "opendatasource",
3113
+ "openquery",
3114
+ "openrowset",
3115
+ "openxml",
3116
+ "option",
3117
+ "percent",
3118
+ "plan",
3119
+ "print",
3120
+ "proc",
3121
+ "public",
3122
+ "read",
3123
+ "readtext",
3124
+ "reconfigure",
3125
+ "replication",
3126
+ "restore",
3127
+ "return",
3128
+ "revert",
3129
+ "rowcount",
3130
+ "rowguidcol",
3131
+ "rule",
3132
+ "save",
3133
+ "securityaudit",
3134
+ "session_user",
3135
+ "shutdown",
3136
+ "statistics",
3137
+ "system_user",
3138
+ "textsize",
3139
+ "tran",
3140
+ "tsequal",
3141
+ "updatetext",
3142
+ "use",
3143
+ "user",
3144
+ "varying",
3145
+ "waitfor",
3146
+ "while",
3147
+ "within",
3148
+ "writetext"
3081
3149
  ],
3082
3150
  "sql-sqlite": [
3083
3151
  "attach",
@@ -3094,6 +3162,115 @@ var DIALECT_KEYWORDS = {
3094
3162
  "without"
3095
3163
  ]
3096
3164
  };
3165
+ var COMMON_FUNCTIONS = ["abs", "avg", "coalesce", "count", "max", "min", "nullif", "round", "sum", "upper", "lower", "substring"];
3166
+ var SQLSERVER_FUNCTIONS = [
3167
+ "approx_count_distinct",
3168
+ "count_big",
3169
+ "grouping",
3170
+ "grouping_id",
3171
+ "checksum_agg",
3172
+ "stdev",
3173
+ "stdevp",
3174
+ "var",
3175
+ "varp",
3176
+ "string_agg",
3177
+ "isnull",
3178
+ "iif",
3179
+ "choose",
3180
+ "convert",
3181
+ "try_cast",
3182
+ "parse",
3183
+ "try_parse",
3184
+ "isnumeric",
3185
+ "getdate",
3186
+ "getutcdate",
3187
+ "sysdatetime",
3188
+ "sysdatetimeoffset",
3189
+ "sysutcdatetime",
3190
+ "dateadd",
3191
+ "datediff",
3192
+ "datediff_big",
3193
+ "datename",
3194
+ "datepart",
3195
+ "datefromparts",
3196
+ "datetimefromparts",
3197
+ "eomonth",
3198
+ "year",
3199
+ "month",
3200
+ "day",
3201
+ "isdate",
3202
+ "row_number",
3203
+ "rank",
3204
+ "dense_rank",
3205
+ "ntile",
3206
+ "lag",
3207
+ "lead",
3208
+ "first_value",
3209
+ "last_value",
3210
+ "percent_rank",
3211
+ "cume_dist",
3212
+ "len",
3213
+ "datalength",
3214
+ "concat",
3215
+ "concat_ws",
3216
+ "charindex",
3217
+ "patindex",
3218
+ "left",
3219
+ "right",
3220
+ "ltrim",
3221
+ "rtrim",
3222
+ "trim",
3223
+ "replace",
3224
+ "replicate",
3225
+ "reverse",
3226
+ "space",
3227
+ "stuff",
3228
+ "str",
3229
+ "string_split",
3230
+ "translate",
3231
+ "unicode",
3232
+ "quotename",
3233
+ "ceiling",
3234
+ "floor",
3235
+ "power",
3236
+ "sqrt",
3237
+ "square",
3238
+ "sign",
3239
+ "rand",
3240
+ "exp",
3241
+ "log",
3242
+ "log10",
3243
+ "json_value",
3244
+ "json_query",
3245
+ "json_modify",
3246
+ "isjson",
3247
+ "openjson",
3248
+ "newid",
3249
+ "newsequentialid",
3250
+ "object_id",
3251
+ "object_name",
3252
+ "schema_name",
3253
+ "db_name",
3254
+ "db_id",
3255
+ "col_name",
3256
+ "col_length",
3257
+ "type_name",
3258
+ "scope_identity",
3259
+ "ident_current",
3260
+ "ident_seed",
3261
+ "ident_incr",
3262
+ "error_number",
3263
+ "error_message",
3264
+ "error_line",
3265
+ "error_procedure",
3266
+ "error_severity",
3267
+ "error_state",
3268
+ "xact_state",
3269
+ "suser_sname",
3270
+ "user_name",
3271
+ "host_name",
3272
+ "app_name"
3273
+ ];
3097
3274
  var DIALECT_BUILTINS = {
3098
3275
  "sql-postgresql": [
3099
3276
  "bigserial",
@@ -3184,6 +3361,7 @@ function dialectTokenizer(language) {
3184
3361
  tokenPostfix: `.${language}`,
3185
3362
  keywords: [...COMMON_KEYWORDS, ...DIALECT_KEYWORDS[language]],
3186
3363
  builtins: DIALECT_BUILTINS[language],
3364
+ functions: [...COMMON_FUNCTIONS, ...language === "sql-sqlserver" ? SQLSERVER_FUNCTIONS : []],
3187
3365
  operators: ["=", ">", "<", "!", "~", "?", ":", "==", "<=", ">=", "!=", "<>", "+", "-", "*", "/", "%", "||", "&&"],
3188
3366
  brackets: [
3189
3367
  { open: "(", close: ")", token: "delimiter.parenthesis" },
@@ -3193,10 +3371,17 @@ function dialectTokenizer(language) {
3193
3371
  root: [
3194
3372
  { include: "@whitespace" },
3195
3373
  ...identifierRules,
3374
+ // T-SQL Unicode 字符串、局部/系统变量及参数占位符单独着色,不能吞掉后续语句。
3375
+ ...language === "sql-sqlserver" ? [
3376
+ [/N'/i, { token: "string.quote", next: "@string" }],
3377
+ [/@@?[\w$#]+/, "variable"],
3378
+ [/0x[\da-f]+/i, "number.hex"]
3379
+ ] : [],
3196
3380
  [/[a-zA-Z_@$#][\w@$#]*/, {
3197
3381
  cases: {
3198
3382
  "@keywords": "keyword",
3199
3383
  "@builtins": "type",
3384
+ "@functions": "predefined",
3200
3385
  "@default": "identifier"
3201
3386
  }
3202
3387
  }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",