vira 31.25.0 → 31.26.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.
@@ -154,7 +154,7 @@ export const ViraTag = defineViraElement()({
154
154
  'vira-tag-border-radius': '1000px',
155
155
  'vira-tag-gap': '6px',
156
156
  'vira-tag-horizontal-padding': '12px',
157
- 'vira-tag-border-width': '2px',
157
+ 'vira-tag-border-width': '1px',
158
158
  },
159
159
  events: {
160
160
  toggle: defineElementEvent(),
@@ -6,4 +6,7 @@
6
6
  */
7
7
  export declare const viraFontCssVars: import("lit-css-vars").CssVarDefinitions<{
8
8
  readonly 'vira-monospace': "monospace";
9
+ readonly 'vira-font-weight-normal': "normal";
10
+ readonly 'vira-font-weight-medium': "500";
11
+ readonly 'vira-font-weight-bold': "bold";
9
12
  }>;
@@ -7,4 +7,7 @@ import { defineCssVars } from 'lit-css-vars';
7
7
  */
8
8
  export const viraFontCssVars = defineCssVars({
9
9
  'vira-monospace': 'monospace',
10
+ 'vira-font-weight-normal': 'normal',
11
+ 'vira-font-weight-medium': '500',
12
+ 'vira-font-weight-bold': 'bold',
10
13
  });
@@ -24,7 +24,7 @@ export declare const viraFormCssVars: import("lit-css-vars").CssVarDefinitions<{
24
24
  readonly 'vira-form-positive-hover-color': import("element-vir").CSSResult;
25
25
  readonly 'vira-form-positive-active-color': import("element-vir").CSSResult;
26
26
  readonly 'vira-form-success-color': import("element-vir").CSSResult;
27
- readonly 'vira-form-label-font-weight': "bold";
27
+ readonly 'vira-form-label-font-weight': import("element-vir").CSSResult;
28
28
  readonly 'vira-form-small-text-size': "14px";
29
29
  readonly 'vira-form-medium-text-size': "16px";
30
30
  readonly 'vira-form-large-text-size': "22px";
@@ -1,6 +1,7 @@
1
1
  import { css, unsafeCSS } from 'element-vir';
2
2
  import { defineCssVars } from 'lit-css-vars';
3
3
  import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
4
+ import { viraFontCssVars } from './font.js';
4
5
  import { viraColorPalette } from './vira-color-palette.js';
5
6
  import { viraTheme } from './vira-color-theme.js';
6
7
  const defaultViraFormRadius = '8px';
@@ -30,7 +31,7 @@ export const viraFormCssVars = defineCssVars({
30
31
  'vira-form-positive-hover-color': viraTheme.colors['vira-green-behind-bg-header'].background.value,
31
32
  'vira-form-positive-active-color': viraTheme.colors['vira-green-behind-bg-body'].background.value,
32
33
  'vira-form-success-color': viraTheme.colors['vira-green-behind-bg-non-body'].background.value,
33
- 'vira-form-label-font-weight': 'bold',
34
+ 'vira-form-label-font-weight': viraFontCssVars['vira-font-weight-bold'].value,
34
35
  'vira-form-small-text-size': '14px',
35
36
  'vira-form-medium-text-size': '16px',
36
37
  'vira-form-large-text-size': '22px',
@@ -133,7 +133,24 @@ export declare function getAdditionalPropertiesSchema(parentSchema: ViraJsonSche
133
133
  *
134
134
  * @category Internal
135
135
  */
136
- export declare function getEnumValues(schema: ViraJsonSchema | undefined, context: SchemaResolveContext): ReadonlyArray<JsonValue> | undefined;
136
+ export declare function getSchemaEnumValues(schema: ViraJsonSchema | undefined, context: SchemaResolveContext): ReadonlyArray<JsonValue> | undefined;
137
+ /**
138
+ * Collects the string `enum`/`const` values declared by any branch of a schema, ignoring branches
139
+ * that declare no enum/const. Unlike {@link getSchemaEnumValues}, a schema that mixes an enum branch
140
+ * with a free-form branch still yields the enum values (rather than bailing out). Non-string enum
141
+ * entries are excluded.
142
+ *
143
+ * @category Internal
144
+ */
145
+ export declare function getStringEnumValues(schema: ViraJsonSchema | undefined, context: SchemaResolveContext): ReadonlyArray<string>;
146
+ /**
147
+ * Returns whether the schema permits an arbitrary (non-enum, non-const) string in any of its
148
+ * branches. Used alongside {@link getStringEnumValues} to detect fields that accept both a fixed set
149
+ * of enum options and free-form text.
150
+ *
151
+ * @category Internal
152
+ */
153
+ export declare function allowsFreeformString(schema: ViraJsonSchema | undefined, context: SchemaResolveContext): boolean;
137
154
  /**
138
155
  * Returns the list of required property names declared by the object branch of a schema.
139
156
  *
@@ -357,7 +357,7 @@ export function getAdditionalPropertiesSchema(parentSchema, context) {
357
357
  *
358
358
  * @category Internal
359
359
  */
360
- export function getEnumValues(schema, context) {
360
+ export function getSchemaEnumValues(schema, context) {
361
361
  const branches = expandSchemaBranches(schema, context);
362
362
  if (branches.length === 0) {
363
363
  return undefined;
@@ -378,6 +378,42 @@ export function getEnumValues(schema, context) {
378
378
  }
379
379
  return collected.length > 0 ? collected : undefined;
380
380
  }
381
+ /**
382
+ * Collects the string `enum`/`const` values declared by any branch of a schema, ignoring branches
383
+ * that declare no enum/const. Unlike {@link getSchemaEnumValues}, a schema that mixes an enum branch
384
+ * with a free-form branch still yields the enum values (rather than bailing out). Non-string enum
385
+ * entries are excluded.
386
+ *
387
+ * @category Internal
388
+ */
389
+ export function getStringEnumValues(schema, context) {
390
+ const branches = expandSchemaBranches(schema, context);
391
+ const values = branches.flatMap((branch) => {
392
+ if ('enum' in branch && check.isArray(branch.enum)) {
393
+ return branch.enum.filter(check.isString);
394
+ }
395
+ else if ('const' in branch && check.isString(branch.const)) {
396
+ return [branch.const];
397
+ }
398
+ return [];
399
+ });
400
+ return removeDuplicates(values);
401
+ }
402
+ /**
403
+ * Returns whether the schema permits an arbitrary (non-enum, non-const) string in any of its
404
+ * branches. Used alongside {@link getStringEnumValues} to detect fields that accept both a fixed set
405
+ * of enum options and free-form text.
406
+ *
407
+ * @category Internal
408
+ */
409
+ export function allowsFreeformString(schema, context) {
410
+ return expandSchemaBranches(schema, context).some((branch) => {
411
+ if ('enum' in branch || 'const' in branch) {
412
+ return false;
413
+ }
414
+ return getAllowedJsonTypes(branch, context).includes(ViraJsonType.String);
415
+ });
416
+ }
381
417
  /**
382
418
  * Returns the list of required property names declared by the object branch of a schema.
383
419
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "31.25.0",
3
+ "version": "31.26.0",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",