@vev/silke 1.1.7 → 1.1.9

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.
Files changed (100) hide show
  1. package/.turbo/turbo-build.log +800 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CLAUDE.md +102 -0
  4. package/dist/index.js +36 -36
  5. package/dist/index.js.LEGAL.txt +1 -1
  6. package/dist/styles.css +498 -282
  7. package/dist/types/components/index.d.ts +2 -0
  8. package/dist/types/components/silke-command-text-field/attachment-chip.d.ts +8 -0
  9. package/dist/types/components/silke-command-text-field/attachment-list.d.ts +15 -0
  10. package/dist/types/components/silke-command-text-field/file-utils.d.ts +33 -0
  11. package/dist/types/components/silke-command-text-field/file-utils.spec.d.ts +1 -0
  12. package/dist/types/components/silke-command-text-field/index.d.ts +6 -1
  13. package/dist/types/components/silke-command-text-field/silke-command-text-field.d.ts +23 -6
  14. package/dist/types/components/silke-command-text-field/utils.d.ts +14 -1
  15. package/dist/types/components/silke-conditions-input/utils.d.ts +1 -1
  16. package/dist/types/components/silke-css-number-field/silke-css-context.d.ts +2 -0
  17. package/dist/types/components/silke-css-number-field/silke-css-number-field.d.ts +2 -0
  18. package/dist/types/components/silke-css-number-field/utils.d.ts +1 -1
  19. package/dist/types/components/silke-form-schema/fields/color-field.d.ts +3 -0
  20. package/dist/types/components/silke-form-schema/fields/group-field.d.ts +3 -0
  21. package/dist/types/components/silke-form-schema/fields/object-field.d.ts +1 -1
  22. package/dist/types/components/silke-form-schema/fields/popover-field.d.ts +3 -0
  23. package/dist/types/components/silke-form-schema/fields/utils/generate-image.d.ts +5 -0
  24. package/dist/types/components/silke-form-schema/fields/utils/index.d.ts +1 -1
  25. package/dist/types/components/silke-form-schema/schema-utils.d.ts +6 -1
  26. package/dist/types/components/silke-form-schema/silke-schema-field.d.ts +2 -1
  27. package/dist/types/components/silke-gradient-picker/index.d.ts +3 -0
  28. package/dist/types/components/silke-icon/silke-icon.d.ts +1 -1
  29. package/dist/types/components/silke-list/silke-list.d.ts +6 -1
  30. package/dist/types/components/silke-list/types.d.ts +2 -0
  31. package/dist/types/components/silke-shortcut-button/silke-shortcut-button.d.ts +4 -1
  32. package/dist/types/components/silke-theme-card/index.d.ts +1 -0
  33. package/dist/types/components/silke-theme-card/silke-theme-card.d.ts +18 -0
  34. package/dist/types/components/silke-theme-swatch/index.d.ts +1 -0
  35. package/dist/types/components/silke-theme-swatch/silke-theme-swatch.d.ts +11 -0
  36. package/dist/types/icons.d.ts +7 -2
  37. package/package.json +32 -20
  38. package/src/components/index.ts +2 -0
  39. package/src/components/silke-autocomplete-field/silke-autocomplete-popup-native.tsx +25 -18
  40. package/src/components/silke-button/silke-dropdown-button.mdx +1 -1
  41. package/src/components/silke-color-picker/color.ts +5 -3
  42. package/src/components/silke-color-swatches/silke-swatches.tsx +3 -3
  43. package/src/components/silke-command-text-field/attachment-chip.tsx +71 -0
  44. package/src/components/silke-command-text-field/attachment-list.tsx +72 -0
  45. package/src/components/silke-command-text-field/file-utils.spec.ts +148 -0
  46. package/src/components/silke-command-text-field/file-utils.ts +159 -0
  47. package/src/components/silke-command-text-field/index.ts +14 -0
  48. package/src/components/silke-command-text-field/silke-command-text-field.mdx +109 -13
  49. package/src/components/silke-command-text-field/silke-command-text-field.module.scss +65 -40
  50. package/src/components/silke-command-text-field/silke-command-text-field.tsx +120 -135
  51. package/src/components/silke-command-text-field/utils.spec.ts +109 -1
  52. package/src/components/silke-command-text-field/utils.ts +44 -7
  53. package/src/components/silke-css-number-field/silke-css-context.tsx +2 -0
  54. package/src/components/silke-css-number-field/silke-css-number-field.tsx +7 -4
  55. package/src/components/silke-css-number-field/utils.ts +8 -2
  56. package/src/components/silke-form-schema/fields/array-field-modal.tsx +71 -46
  57. package/src/components/silke-form-schema/fields/array-field.tsx +160 -122
  58. package/src/components/silke-form-schema/fields/color-field.tsx +136 -0
  59. package/src/components/silke-form-schema/fields/group-field.tsx +49 -0
  60. package/src/components/silke-form-schema/fields/icon-field.tsx +59 -39
  61. package/src/components/silke-form-schema/fields/image-field.tsx +50 -39
  62. package/src/components/silke-form-schema/fields/number-field.tsx +148 -184
  63. package/src/components/silke-form-schema/fields/object-field.tsx +2 -0
  64. package/src/components/silke-form-schema/fields/popover-field.tsx +65 -0
  65. package/src/components/silke-form-schema/fields/select-field.tsx +43 -30
  66. package/src/components/silke-form-schema/fields/string-field.tsx +1 -1
  67. package/src/components/silke-form-schema/fields/styles.scss +2 -39
  68. package/src/components/silke-form-schema/fields/toggle-field.tsx +48 -15
  69. package/src/components/silke-form-schema/fields/utils/generate-image.ts +20 -0
  70. package/src/components/silke-form-schema/fields/utils/generate-title.ts +1 -1
  71. package/src/components/silke-form-schema/fields/utils/index.ts +1 -1
  72. package/src/components/silke-form-schema/schema-utils.ts +27 -1
  73. package/src/components/silke-form-schema/silke-form-schema.mdx +498 -311
  74. package/src/components/silke-form-schema/silke-schema-field.tsx +12 -3
  75. package/src/components/silke-form-schema/silke-schema-fields.tsx +9 -5
  76. package/src/components/silke-gradient-picker/index.ts +3 -0
  77. package/src/components/silke-icon/silke-icon.mdx +13 -1
  78. package/src/components/silke-icon/silke-icon.tsx +6 -2
  79. package/src/components/silke-list/silke-list.tsx +59 -26
  80. package/src/components/silke-list/types.ts +2 -0
  81. package/src/components/silke-navigation-link/silke-navigation-link.scss +1 -0
  82. package/src/components/silke-shortcut-button/silke-shortcut-button.scss +16 -0
  83. package/src/components/silke-shortcut-button/silke-shortcut-button.tsx +9 -0
  84. package/src/components/silke-slider/silke-slider.module.scss +1 -1
  85. package/src/components/silke-tag/silke-tag.scss +1 -1
  86. package/src/components/silke-text-field/silke-text-field-outline.tsx +9 -6
  87. package/src/components/silke-text-field/silke-text-field.scss +3 -0
  88. package/src/components/silke-text-field/silke-text-field.tsx +1 -1
  89. package/src/components/silke-theme-card/index.ts +1 -0
  90. package/src/components/silke-theme-card/silke-theme-card.mdx +50 -0
  91. package/src/components/silke-theme-card/silke-theme-card.module.scss +82 -0
  92. package/src/components/silke-theme-card/silke-theme-card.tsx +82 -0
  93. package/src/components/silke-theme-swatch/index.ts +1 -0
  94. package/src/components/silke-theme-swatch/silke-theme-swatch.mdx +59 -0
  95. package/src/components/silke-theme-swatch/silke-theme-swatch.module.scss +108 -0
  96. package/src/components/silke-theme-swatch/silke-theme-swatch.tsx +49 -0
  97. package/src/components/silke-variables-wrapper/silke-variables-wrapper.tsx +9 -8
  98. package/src/icons.tsx +41 -7
  99. package/tsconfig.build.tsbuildinfo +1 -1
  100. package/project.json +0 -12
@@ -34,7 +34,9 @@ export * from './silke-table';
34
34
  export * from './silke-tabs';
35
35
  export * from './silke-tag';
36
36
  export * from './silke-text';
37
+ export * from './silke-theme-card';
37
38
  export * from './silke-theme-editor';
39
+ export * from './silke-theme-swatch';
38
40
  export * from './silke-tile';
39
41
  export * from './silke-toolbar';
40
42
  export * from './silke-tooltip';
@@ -0,0 +1,8 @@
1
+ import { SilkeFileValue, SilkeImageValue } from './utils';
2
+ interface AttachmentChipProps {
3
+ attachment: SilkeImageValue | SilkeFileValue;
4
+ disabled?: boolean;
5
+ onRemove?: () => void;
6
+ }
7
+ export declare function AttachmentChip({ attachment, disabled, onRemove }: AttachmentChipProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { SilkeFileValue, SilkeImageValue } from './utils';
3
+ interface AttachmentListProps {
4
+ acceptedTypes: string[];
5
+ attachments: (SilkeImageValue | SilkeFileValue)[];
6
+ disabled?: boolean;
7
+ onAdd: (attachments: (SilkeImageValue | SilkeFileValue)[]) => void;
8
+ onRemove: (index: number) => void;
9
+ }
10
+ export interface AttachmentListHandle {
11
+ /** Open the file picker dialog */
12
+ openFilePicker: () => void;
13
+ }
14
+ export declare const AttachmentList: React.ForwardRefExoticComponent<AttachmentListProps & React.RefAttributes<AttachmentListHandle>>;
15
+ export {};
@@ -0,0 +1,33 @@
1
+ import type { SilkeIcons } from '../silke-icon/silke-icon';
2
+ import { SilkeFileValue, SilkeImageValue } from './utils';
3
+ /** File type category for the acceptedFileTypes prop */
4
+ export type SilkeFileCategory = 'image' | 'text';
5
+ /** Resolve file categories to a flat list of MIME patterns */
6
+ export declare function resolveFileCategories(categories: SilkeFileCategory[]): string[];
7
+ /**
8
+ * Check if a MIME type matches a set of MIME patterns.
9
+ * Supports exact matches ('text/csv') and wildcard subtypes ('image/*').
10
+ */
11
+ export declare function matchesMimePattern(mimeType: string, patterns: string[]): boolean;
12
+ /**
13
+ * Reads a File and converts it to a SilkeImageValue or SilkeFileValue.
14
+ * Images produce SilkeImageValue for backward compatibility; other files produce SilkeFileValue.
15
+ * Returns null if the file type is not in the accepted patterns.
16
+ */
17
+ export declare function fileToAttachmentValue(file: File, acceptedTypes: string[]): Promise<SilkeImageValue | SilkeFileValue | null>;
18
+ /**
19
+ * Extract the first matching file from a ClipboardEvent given accepted MIME patterns.
20
+ */
21
+ export declare function getFileFromClipboard(e: React.ClipboardEvent, acceptedTypes: string[]): File | null;
22
+ /**
23
+ * Extract the first matching file from a DragEvent given accepted MIME patterns.
24
+ */
25
+ export declare function getFileFromDragEvent(e: DragEvent, acceptedTypes: string[]): File | null;
26
+ /**
27
+ * Maps a MIME type to a SilkeIcon key for display.
28
+ */
29
+ export declare function getFileIcon(mimeType: string): SilkeIcons;
30
+ /**
31
+ * Truncate a filename for display, preserving the extension.
32
+ */
33
+ export declare function truncateFilename(name: string, maxLength?: number): string;
@@ -1,4 +1,9 @@
1
+ export { AttachmentChip } from './attachment-chip';
2
+ export { AttachmentList } from './attachment-list';
3
+ export type { AttachmentListHandle } from './attachment-list';
4
+ export { fileToAttachmentValue, getFileFromClipboard, getFileFromDragEvent, matchesMimePattern, resolveFileCategories, } from './file-utils';
5
+ export type { SilkeFileCategory } from './file-utils';
1
6
  export { fileToImageValue, imageValueToDataUrl } from './image-utils';
2
7
  export { parseTextToSilkeCommands } from './silke-command-parser';
3
8
  export * from './silke-command-text-field';
4
- export { SilkeCommand, SilkeCommandTextFieldValue, SilkeCommandType, SilkeImageValue, SilkeTextValue, convertSilkeCommandsToString, isImage, } from './utils';
9
+ export { SilkeCommand, SilkeCommandTextFieldValue, SilkeCommandType, SilkeFileValue, SilkeImageValue, SilkeTextValue, convertSilkeCommandsToString, isAttachment, isFile, isImage, } from './utils';
@@ -1,12 +1,20 @@
1
1
  import React from 'react';
2
2
  import { SilkeTextFieldOutlineProps } from '../silke-text-field/silke-text-field-outline';
3
+ import { SilkeFileCategory } from './file-utils';
3
4
  import { SilkeCommand, SilkeCommandTextFieldValue } from './utils';
4
- export type SilkeCommandTextFieldProps = Omit<SilkeTextFieldOutlineProps, 'children'> & {
5
+ export type SilkeCommandTextFieldProps = SilkeTextFieldOutlineProps & {
6
+ /**
7
+ * File type categories to accept as attachments.
8
+ * - `'image'` — all image types (png, jpeg, gif, etc.)
9
+ * - `'text'` — documents and text files (PDF, Word, Excel, CSV, TXT, JSON, etc.)
10
+ * Defaults to `[]` (no files accepted).
11
+ */
12
+ acceptedFileTypes?: SilkeFileCategory[];
5
13
  autoFocus?: boolean;
6
14
  availableCommands: SilkeCommand[];
7
15
  disabled?: boolean;
8
- /** When true, images cannot be added via paste or drag-and-drop */
9
- disableImages?: boolean;
16
+ /** Maximum height in pixels before the field starts scrolling */
17
+ maxHeight?: number;
10
18
  name?: string;
11
19
  onChange: (value: SilkeCommandTextFieldValue[]) => void;
12
20
  onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
@@ -20,6 +28,8 @@ export type SilkeCommandTextFieldHandle = {
20
28
  blur: () => void;
21
29
  /** Focus the input */
22
30
  focus: () => void;
31
+ /** Open the file picker dialog (requires acceptedFileTypes to be set) */
32
+ openFilePicker: () => void;
23
33
  /** Get the current value as a string */
24
34
  toString: (value?: SilkeCommandTextFieldValue[]) => string;
25
35
  /**
@@ -29,12 +39,19 @@ export type SilkeCommandTextFieldHandle = {
29
39
  */
30
40
  update: (command: SilkeCommand, index?: number) => void;
31
41
  };
32
- declare const SilkeCommandTextField: React.ForwardRefExoticComponent<Omit<SilkeTextFieldOutlineProps, "children"> & {
42
+ declare const SilkeCommandTextField: React.ForwardRefExoticComponent<SilkeTextFieldOutlineProps & {
43
+ /**
44
+ * File type categories to accept as attachments.
45
+ * - `'image'` — all image types (png, jpeg, gif, etc.)
46
+ * - `'text'` — documents and text files (PDF, Word, Excel, CSV, TXT, JSON, etc.)
47
+ * Defaults to `[]` (no files accepted).
48
+ */
49
+ acceptedFileTypes?: SilkeFileCategory[];
33
50
  autoFocus?: boolean;
34
51
  availableCommands: SilkeCommand[];
35
52
  disabled?: boolean;
36
- /** When true, images cannot be added via paste or drag-and-drop */
37
- disableImages?: boolean;
53
+ /** Maximum height in pixels before the field starts scrolling */
54
+ maxHeight?: number;
38
55
  name?: string;
39
56
  onChange: (value: SilkeCommandTextFieldValue[]) => void;
40
57
  onCommandFocus?: (index: number, command: SilkeCommandTextFieldValue | undefined) => void;
@@ -20,7 +20,16 @@ export type SilkeImageValue = {
20
20
  /** Optional filename */
21
21
  name?: string;
22
22
  };
23
- export type SilkeCommandTextFieldValue = SilkeCommand | SilkeTextValue | SilkeImageValue;
23
+ export type SilkeFileValue = {
24
+ type: 'file';
25
+ /** Base64-encoded file data */
26
+ data: string;
27
+ /** MIME type (e.g., 'text/csv', 'application/vnd.ms-excel') */
28
+ mimeType: string;
29
+ /** Filename */
30
+ name: string;
31
+ };
32
+ export type SilkeCommandTextFieldValue = SilkeCommand | SilkeTextValue | SilkeImageValue | SilkeFileValue;
24
33
  /** Key direction mappings for navigation and editing */
25
34
  export declare const KEY_DIRECTION: Record<string, number>;
26
35
  /** Get the caret offset within a contentEditable element */
@@ -47,6 +56,10 @@ export declare function isSilkeCommand(value: SilkeCommandTextFieldValue | undef
47
56
  export declare function isText(value: SilkeCommandTextFieldValue | undefined): value is SilkeTextValue;
48
57
  /** Check if a command value is an image */
49
58
  export declare function isImage(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue;
59
+ /** Check if a command value is a non-image file attachment */
60
+ export declare function isFile(value: SilkeCommandTextFieldValue | undefined): value is SilkeFileValue;
61
+ /** Check if a command value is any attachment (image or file) */
62
+ export declare function isAttachment(value: SilkeCommandTextFieldValue | undefined): value is SilkeImageValue | SilkeFileValue;
50
63
  /**
51
64
  * Calculate a match score for a command against a search query.
52
65
  * Higher scores indicate better matches.
@@ -8,4 +8,4 @@ export declare const getSuggestions: (searchValue: string, variables: SilkeCSSCo
8
8
  export declare const getSystemSuggestionOptions: (value: string | number | boolean, systemOptions?: VevConditionSuggestion[]) => ConditionSuggestion[];
9
9
  export declare const getWidgetSuggestionOptions: (value: string | number | boolean, widgetOptions?: VevProps[]) => ConditionSuggestion[];
10
10
  export declare const isWidgetOption: (value: string | number | boolean, widgetOptions?: VevProps[]) => boolean;
11
- export declare const getWidgetOptionType: (value: string | number | boolean, widgetOptions?: VevProps[]) => "string" | "number" | "boolean" | "object" | "link" | "audio" | "menu" | "select" | "video" | "image" | "layout" | "icon" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | "mainComponent" | undefined;
11
+ export declare const getWidgetOptionType: (value: string | number | boolean, widgetOptions?: VevProps[]) => "string" | "number" | "boolean" | "object" | "link" | "audio" | "menu" | "select" | "video" | "image" | "popover" | "color" | "layout" | "icon" | "group" | "upload" | "divider" | "variable" | "array" | "event" | "widgetSelect" | "mainComponent" | undefined;
@@ -27,6 +27,8 @@ export type SilkeCSSContextType = {
27
27
  value?: string;
28
28
  unit?: string;
29
29
  default?: boolean;
30
+ hidden?: boolean;
31
+ group?: string;
30
32
  }[];
31
33
  preferredColorMode?: ModeType;
32
34
  readonly?: boolean;
@@ -7,6 +7,8 @@ export type SilkeCssNumberFieldProps = FormFieldProps<string> & SilkeTextFieldOu
7
7
  options?: (SilkeOverflowMenuItem | 'divider')[];
8
8
  min?: number;
9
9
  max?: number;
10
+ /** Override the default decimal precision for the current format */
11
+ precision?: number;
10
12
  autoFocus?: boolean;
11
13
  allowAuto?: boolean | string;
12
14
  disableVariables?: boolean;
@@ -24,7 +24,7 @@ export declare const FORMAT_LABELS: {
24
24
  rad: string;
25
25
  s: string;
26
26
  };
27
- export declare function roundCSSNumber(value: number, format: string, min?: number, max?: number): number;
27
+ export declare function roundCSSNumber(value: number, format: string, min?: number, max?: number, precisionOverride?: number): number;
28
28
  export declare function formatNumberForDisplay(value: string): string;
29
29
  export declare function convertCSSNumberString(numberText: string, format: string, min?: number, max?: number): number;
30
30
  export declare function convertCSSNumberFormat(value: number, fromFormat: string, toFormat: string, context: SilkeCSSContextType, min?: number, max?: number, axis?: 'x' | 'y'): string;
@@ -0,0 +1,3 @@
1
+ import { SchemaFieldProps, ColorField as ColorFieldType } from '@vev/utils';
2
+ declare const ColorField: ({ schema, value, disabled, readonly, onChange, }: SchemaFieldProps<ColorFieldType>) => import("react/jsx-runtime").JSX.Element;
3
+ export default ColorField;
@@ -0,0 +1,3 @@
1
+ import { GroupField as GroupFieldType, SchemaFieldProps } from '@vev/utils';
2
+ /** Collapsible card section. Renders a clickable header with chevron inside a surface-1 card. */
3
+ export default function GroupField({ value, schema, disabled, readonly, }: SchemaFieldProps<GroupFieldType>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { ObjectField as ObjectFieldType, SchemaFieldProps } from '@vev/utils';
2
- export default function ObjectField({ value, schema, disabled, readonly, onChange, }: SchemaFieldProps<ObjectFieldType>): import("react/jsx-runtime").JSX.Element;
2
+ export default function ObjectField({ value, schema, disabled, readonly, onChange, itemIndex, }: SchemaFieldProps<ObjectFieldType>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { PopoverField as PopoverFieldType, SchemaFieldProps } from '@vev/utils';
2
+ /** Icon button that opens a popover with nested fields. Closes on outside click or Escape. */
3
+ export default function PopoverField({ value, schema, disabled, readonly, }: SchemaFieldProps<PopoverFieldType>): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { VevProps } from '@vev/utils';
3
3
  export declare const generateImage: (data: VevProps | VevProps[] | string, schema?: VevProps | VevProps[] | string) => string | ReactNode | undefined;
4
+ /**
5
+ * Finds the first image field in the schema and returns its URL from the item data,
6
+ * or `true` if the field exists but has no value (to signal a fallback icon).
7
+ */
8
+ export declare const getImageFieldUrl: (data: Record<string, any>, schema?: VevProps | VevProps[] | string) => string | true | undefined;
@@ -1,2 +1,2 @@
1
1
  export { generateTitle } from './generate-title';
2
- export { generateImage } from './generate-image';
2
+ export { generateImage, getImageFieldUrl } from './generate-image';
@@ -1,9 +1,14 @@
1
- import { EvalCallback, Schema, SchemaContextModel } from '@vev/utils';
1
+ import { EvalCallback, Schema, SchemaContextModel, VevProps } from '@vev/utils';
2
2
  export declare function isEvalCallback(value: any): value is EvalCallback;
3
3
  type InitialValue = {
4
4
  [key: string]: any;
5
5
  };
6
6
  export declare function getSchemaInitialValue<T extends InitialValue>(schema: Schema, context: Omit<SchemaContextModel, 'actions'>): Promise<InitialValue>;
7
+ /**
8
+ * Synchronously compute default/initial values from a schema.
9
+ * Handles static initialValue only (skips eval callbacks and functions).
10
+ */
11
+ export declare function getSchemaDefaultValue(schema: VevProps | VevProps[]): InitialValue;
7
12
  export declare function useStorageField<T>(name: string, storageScope: 'project' | 'workspace' | 'account'): {
8
13
  value: T | undefined;
9
14
  onChange: (value: T) => Promise<void>;
@@ -6,6 +6,7 @@ type SilkeSchemaFieldProps = {
6
6
  isFirst?: boolean;
7
7
  disabled?: boolean;
8
8
  readonly?: boolean;
9
+ itemIndex?: number;
9
10
  };
10
- export declare function SilkeSchemaField({ field, value: fieldValue, noPad, isFirst, disabled, readonly, }: SilkeSchemaFieldProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export declare function SilkeSchemaField({ field, value: fieldValue, noPad, isFirst, disabled, readonly, itemIndex, }: SilkeSchemaFieldProps): import("react/jsx-runtime").JSX.Element | null;
11
12
  export {};
@@ -1 +1,4 @@
1
1
  export * from './silke-gradient-picker';
2
+ export * from './silke-gradient-utils';
3
+ export { SilkeGradientSlider } from './silke-gradient-slider';
4
+ export { SilkeGradientPosition } from './silke-gradient-position';
@@ -2,7 +2,7 @@ import { IEmojiIcon } from '@vev/utils';
2
2
  import React, { HTMLAttributes } from 'react';
3
3
  import { SilkeIconDefinitions } from '../../icons';
4
4
  import { SilkeColor } from '../../silke-theme-provider';
5
- export type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon;
5
+ export type SilkeIcons = keyof typeof SilkeIconDefinitions | null | IEmojiIcon | `fa-${string}`;
6
6
  interface SilkeIconProps extends HTMLAttributes<HTMLElement> {
7
7
  icon: SilkeIcons | React.ReactElement;
8
8
  color?: SilkeColor | string;
@@ -4,7 +4,12 @@ type SilkeListProps = {
4
4
  size?: 's' | 'base';
5
5
  gap?: boolean;
6
6
  maxHeight?: number;
7
+ /** Enable drag-and-drop reordering of items */
8
+ sortable?: boolean;
9
+ disabled?: boolean;
7
10
  onSelect?: (item: SilkeListItemType) => void;
11
+ /** Called with the reordered items array after a drag-and-drop sort */
12
+ onSort?: (items: SilkeListItemType[]) => void;
8
13
  };
9
- export declare function SilkeList({ items, size, gap, maxHeight, onSelect }: SilkeListProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function SilkeList({ items, size, gap, maxHeight, sortable, disabled, onSelect, onSort }: SilkeListProps): import("react/jsx-runtime").JSX.Element;
10
15
  export {};
@@ -10,6 +10,8 @@ export type SilkeListItemData = {
10
10
  items?: SilkeListItemData[];
11
11
  link?: string;
12
12
  active?: boolean;
13
+ children?: React.ReactNode;
14
+ alwaysShowChildren?: boolean;
13
15
  onClick?: () => void;
14
16
  };
15
17
  export type SilkeListItemType = SilkeListItemData | React.ReactElement | 'divider';
@@ -6,10 +6,13 @@ export type SilkeShortcutButtonProps = {
6
6
  icon: SilkeIcons;
7
7
  shortcut?: KeyboardEventCode[];
8
8
  compressed?: boolean;
9
+ inverted?: boolean;
9
10
  centered?: boolean;
11
+ hidden?: boolean;
12
+ suffix?: React.ReactNode;
10
13
  onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
11
14
  };
12
- export declare function SilkeShortcutButton({ label, icon, shortcut, compressed, centered, onClick, }: SilkeShortcutButtonProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function SilkeShortcutButton({ label, icon, shortcut, compressed, inverted, centered, hidden, suffix, onClick, }: SilkeShortcutButtonProps): import("react/jsx-runtime").JSX.Element;
13
16
  export declare namespace SilkeShortcutButton {
14
17
  var displayName: string;
15
18
  }
@@ -0,0 +1 @@
1
+ export * from './silke-theme-card';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { SilkeOverflowMenuItem } from '../silke-overflow-menu';
3
+ interface SilkeThemeCardProps {
4
+ name: string;
5
+ description?: string;
6
+ primaryColor?: string;
7
+ secondaryColor?: string;
8
+ accentColor?: string;
9
+ bgColor?: string;
10
+ textColor?: string;
11
+ baseFont?: string;
12
+ isDefault?: boolean;
13
+ isSelected?: boolean;
14
+ onClick?: () => void;
15
+ menu?: (SilkeOverflowMenuItem | React.ReactElement | 'divider')[];
16
+ }
17
+ export declare function SilkeThemeCard({ name, description, primaryColor, secondaryColor, accentColor, bgColor, textColor, baseFont, isDefault, isSelected, onClick, menu, }: SilkeThemeCardProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1 @@
1
+ export * from './silke-theme-swatch';
@@ -0,0 +1,11 @@
1
+ declare const SHADE_KEYS: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
2
+ type ShadeKey = (typeof SHADE_KEYS)[number];
3
+ interface SilkeThemeSwatchProps {
4
+ label: string;
5
+ token?: string;
6
+ shades: Record<ShadeKey, string>;
7
+ selectedShade?: ShadeKey;
8
+ onSelect?: (shade: ShadeKey) => void;
9
+ }
10
+ export declare function SilkeThemeSwatch({ label, token, shades, selectedShade, onSelect, }: SilkeThemeSwatchProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -25,10 +25,12 @@ export declare const SilkeIconDefinitions: {
25
25
  'cloud.slash': string;
26
26
  ai: string;
27
27
  'ai.sparkle': string;
28
- 'ai.page': string;
28
+ 'ai.page': typeof AiGradientPage;
29
29
  'ai.sparkels': string;
30
30
  'ai.gradient': typeof AiGradientIcon;
31
31
  'ai.image': string;
32
+ 'ai.component': typeof AiGradientComponent;
33
+ 'ai.component.flat': string;
32
34
  'ai.text': string;
33
35
  'ai.file': string;
34
36
  sparkles: string;
@@ -453,7 +455,8 @@ export declare const SilkeIconDefinitions: {
453
455
  'animate.fill-backwards': typeof AnimationFillBackwards;
454
456
  'animate.fill-forwards': typeof AnimationFillForwards;
455
457
  'animate.fill-both': typeof AnimationFillBoth;
456
- qwiker: string;
458
+ 'theme.color': string;
459
+ 'theme.font': string;
457
460
  };
458
461
  export declare const StateIcons: {
459
462
  default: string;
@@ -494,4 +497,6 @@ declare function AnimationFillBackwards(): import("react/jsx-runtime").JSX.Eleme
494
497
  declare function AnimationFillForwards(): import("react/jsx-runtime").JSX.Element;
495
498
  declare function AnimationFillBoth(): import("react/jsx-runtime").JSX.Element;
496
499
  declare function AiGradientIcon(): import("react/jsx-runtime").JSX.Element;
500
+ declare function AiGradientPage(): import("react/jsx-runtime").JSX.Element;
501
+ declare function AiGradientComponent(): import("react/jsx-runtime").JSX.Element;
497
502
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vev/silke",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,32 +9,44 @@
9
9
  },
10
10
  "main": "dist/index.js",
11
11
  "types": "dist/types/index.d.ts",
12
+ "peerDependencies": {
13
+ "react": ">=16.0.0",
14
+ "react-dom": ">=16.0.0",
15
+ "react-router-dom": "^7.12.0"
16
+ },
17
+ "dependencies": {
18
+ "invokers": "^1.8.0",
19
+ "tinycolor2": "^1.6.0",
20
+ "@types/tinycolor2": "^1.4.6",
21
+ "dompurify": "^3.3.2",
22
+ "@codemirror/lang-css": "^6.0.0",
23
+ "@codemirror/lang-javascript": "^6.1.0",
24
+ "@codemirror/lang-json": "^6.0.0",
25
+ "@uiw/react-codemirror": "^4.12.3",
26
+ "@uiw/codemirror-theme-dracula": "^4.25.4",
27
+ "prism-react-renderer": "^2.4.1",
28
+ "@vev/interactions": "1.0.2",
29
+ "@vev/react": "0.3.4",
30
+ "@vev/utils": "1.2.17"
31
+ },
32
+ "devDependencies": {
33
+ "@mdx-js/react": "^3.1.0",
34
+ "concurrently": "^8.2.2",
35
+ "del-cli": "^5.1.0",
36
+ "eslint": "^10.0.0",
37
+ "jest": "^30.2.0",
38
+ "typescript": "^5.9.3"
39
+ },
12
40
  "scripts": {
13
- "build": "yarn clean && yarn build:types && yarn build:code",
41
+ "build": "pnpm clean && pnpm build:types && pnpm build:code",
14
42
  "build:code": "node ./esbuild.config.mjs",
15
43
  "build:types": "tsc --project tsconfig.build.json",
16
44
  "clean": "del-cli dist",
17
45
  "test": "jest --silent --forceExit --runInBand --passWithNoTests",
18
46
  "test:ci": "jest --runInBand --forceExit --reporters='github-actions' --passWithNoTests",
19
47
  "tsc": "tsc --project ./tsconfig.json --emitDeclarationOnly --outDir ./dist",
20
- "watch": "run -T concurrently \"yarn watch:tsc\" \"yarn watch:code\"",
48
+ "watch": "concurrently \"pnpm watch:tsc\" \"pnpm watch:code\"",
21
49
  "watch:code": "node esbuild.config.mjs --watch",
22
50
  "watch:tsc": "tsc --project ./tsconfig.build.json --emitDeclarationOnly --watch"
23
- },
24
- "peerDependencies": {
25
- "react": ">=16.0.0",
26
- "react-dom": ">=16.0.0",
27
- "react-router-dom": "^7.12.0"
28
- },
29
- "dependencies": {
30
- "@vev/interactions": "*",
31
- "@vev/react": "*",
32
- "@vev/utils": "*",
33
- "classnames": ">=2.2.0",
34
- "invokers": "^1.8.0"
35
- },
36
- "devDependencies": {
37
- "del-cli": "*",
38
- "jest": "*"
39
51
  }
40
- }
52
+ }
@@ -36,7 +36,9 @@ export * from './silke-table';
36
36
  export * from './silke-tabs';
37
37
  export * from './silke-tag';
38
38
  export * from './silke-text';
39
+ export * from './silke-theme-card';
39
40
  export * from './silke-theme-editor';
41
+ export * from './silke-theme-swatch';
40
42
  export * from './silke-tile';
41
43
  export * from './silke-toolbar';
42
44
  export * from './silke-tooltip';
@@ -452,7 +452,7 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
452
452
  </SilkeTextField>
453
453
  </SilkeBox>
454
454
  {!disableSearch && <SilkeDivider dark />}
455
- <SilkeBox column scroll flex hPad="xs">
455
+ <SilkeBox column scroll flex>
456
456
  {displayedItems.length === 0 && (
457
457
  <SilkeBox hPad="s" height={size} vAlign="center">
458
458
  <SilkeTextSmall color="neutral-60">No results</SilkeTextSmall>
@@ -486,23 +486,30 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
486
486
  {group.items.map((item) => {
487
487
  const currentItemIndex = itemIndex++;
488
488
  return item.divider ? (
489
- <SilkeDivider dark key={`hr-${currentItemIndex}`} />
489
+ <SilkeDivider dark vSpace="xs" key={`hr-${currentItemIndex}`} />
490
490
  ) : (
491
- <AutocompleteItem
492
- ItemRender={ItemRender}
493
- key={currentItemIndex}
494
- size={size}
495
- iconFontSize={iconFontSize}
496
- item={item}
497
- highlight={currentItemIndex === highlight}
498
- selected={isSelected(item.value)}
499
- multiple={form.multiple}
500
- onMouseDown={(e) => {
501
- e.preventDefault();
502
- e.stopPropagation();
503
- if (!item.divider && !item.disabled) handleSelect(item);
504
- }}
505
- />
491
+ <SilkeBox
492
+ key={`group-${groupIdx}-item-${itemIndex}`}
493
+ flex
494
+ fill
495
+ column
496
+ hPad="xs"
497
+ >
498
+ <AutocompleteItem
499
+ ItemRender={ItemRender}
500
+ size={size}
501
+ iconFontSize={iconFontSize}
502
+ item={item}
503
+ highlight={currentItemIndex === highlight || isSelected(item.value)}
504
+ selected={isSelected(item.value)}
505
+ multiple={form.multiple}
506
+ onMouseDown={(e) => {
507
+ e.preventDefault();
508
+ e.stopPropagation();
509
+ if (!item.divider && !item.disabled) handleSelect(item);
510
+ }}
511
+ />
512
+ </SilkeBox>
506
513
  );
507
514
  })}
508
515
  </React.Fragment>
@@ -527,7 +534,7 @@ export function SilkeAutocompletePopupNative<T>(props: SilkeAutocompletePopupNat
527
534
  {isHidingResults
528
535
  ? props.maxDisplayedItemsLabel || (
529
536
  <>
530
- <SilkeDivider dark />
537
+ <SilkeDivider dark vSpace="xs" />
531
538
  <SilkeBox pad="l">
532
539
  Currently displaying the {maxDisplayedItems} first results, please enter a more
533
540
  specific query to see the rest
@@ -56,7 +56,7 @@
56
56
  {
57
57
  label: 'Page draft',
58
58
  icon: 'ai.page',
59
- tag: { label: 'AI', size: 'tiny', kind: 'secondary', icon: 'ai.sparkle' },
59
+ tag: { label: 'Beta', color: 'dark', size: 'tiny' },
60
60
  groupLabel: 'Start with',
61
61
  onClick: () => {},
62
62
  },
@@ -31,8 +31,10 @@ export function getVariableValueV2(
31
31
  color: string,
32
32
  variables: { key: string; value?: string }[],
33
33
  ): string | undefined {
34
- const varName = color.trim().replace(/^var\(--vev-(.*)\)$/, '$1');
35
- return variables.find((v) => v.key === varName)?.value;
34
+ // Strip var(--vev-...) wrapper, ignoring optional CSS fallback after comma
35
+ const match = color.trim().match(/^var\(--vev-([^,)]+)/);
36
+ if (!match) return undefined;
37
+ return variables.find((v) => v.key === match[1])?.value;
36
38
  }
37
39
 
38
40
  export function isColorVariable(color: string): boolean {
@@ -40,7 +42,7 @@ export function isColorVariable(color: string): boolean {
40
42
  }
41
43
 
42
44
  export function isVariableV2(color: string | undefined): boolean {
43
- return !!color && color?.startsWith('var(--vev-');
45
+ return !!color && color.startsWith('var(--vev-');
44
46
  }
45
47
 
46
48
  export function rgbaToString(rgba: RGBA | number[] | string): string {
@@ -49,8 +49,8 @@ export function SilkeSwatches({
49
49
  } = useSilkeCSSContext();
50
50
  const [mode, setMode] = useState<ModeType>(
51
51
  defaultMode ||
52
- preferredColorMode ||
53
- (hidePalettes ? 'swatches' : hideSwatches ? 'palettes' : 'swatches'),
52
+ preferredColorMode ||
53
+ (hidePalettes ? 'swatches' : hideSwatches ? 'palettes' : 'swatches'),
54
54
  );
55
55
 
56
56
  const swatches = useMemo(() => {
@@ -58,7 +58,7 @@ export function SilkeSwatches({
58
58
  }, [rest.swatches, variables]);
59
59
 
60
60
  const colorVariables = React.useMemo(() => {
61
- return variablesv2.filter((v) => v.type === 'color');
61
+ return variablesv2.filter((v) => v.type === 'color' && !v.hidden);
62
62
  }, [variablesv2]);
63
63
 
64
64
  const modeOptions = useMemo(() => {