@simplysm/solid 13.0.97 → 13.0.99
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/README.md +256 -0
- package/docs/data.md +342 -0
- package/docs/disclosure.md +188 -0
- package/docs/display.md +137 -0
- package/docs/features.md +310 -0
- package/docs/feedback.md +233 -0
- package/docs/form-control.md +620 -0
- package/docs/helpers.md +206 -0
- package/docs/hooks.md +142 -0
- package/docs/layout.md +212 -0
- package/docs/providers.md +197 -0
- package/docs/styles.md +133 -0
- package/package.json +5 -5
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Providers
|
|
2
|
+
|
|
3
|
+
Source: `src/providers/**`
|
|
4
|
+
|
|
5
|
+
## `ConfigProvider`
|
|
6
|
+
|
|
7
|
+
App-wide configuration context providing `clientName` used as storage key prefix.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export interface AppConfig {
|
|
11
|
+
clientName: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ConfigContext: Context<AppConfig>;
|
|
15
|
+
export function useConfig(): AppConfig;
|
|
16
|
+
export const ConfigProvider: ParentComponent<{ clientName: string }>;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## `SyncStorageProvider`
|
|
22
|
+
|
|
23
|
+
Sync storage provider with configurable adapter (defaults to localStorage). Supports async adapters for cross-device sync.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
export interface StorageAdapter {
|
|
27
|
+
getItem(key: string): string | null | Promise<string | null>;
|
|
28
|
+
setItem(key: string, value: string): void | Promise<unknown>;
|
|
29
|
+
removeItem(key: string): void | Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SyncStorageContextValue {
|
|
33
|
+
adapter: Accessor<StorageAdapter>;
|
|
34
|
+
configure: (fn: (origin: StorageAdapter) => StorageAdapter) => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const SyncStorageContext: Context<SyncStorageContextValue>;
|
|
38
|
+
export function useSyncStorage(): SyncStorageContextValue | undefined;
|
|
39
|
+
export const SyncStorageProvider: ParentComponent;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## `LoggerProvider`
|
|
45
|
+
|
|
46
|
+
Logger adapter provider. Defaults to consola. Configurable via decorator pattern.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
export interface LogAdapter {
|
|
50
|
+
write(severity: "error" | "warn" | "info" | "log", ...data: any[]): Promise<void> | void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface LoggerContextValue {
|
|
54
|
+
adapter: Accessor<LogAdapter>;
|
|
55
|
+
configure: (fn: (origin: LogAdapter) => LogAdapter) => void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const LoggerContext: Context<LoggerContextValue>;
|
|
59
|
+
export const LoggerProvider: ParentComponent;
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## `ThemeProvider`
|
|
65
|
+
|
|
66
|
+
Theme mode provider with OS dark mode detection. Persists to storage via `useSyncConfig`. Toggles `dark` class on `<html>`.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
export type ThemeMode = "light" | "dark" | "system";
|
|
70
|
+
export type ResolvedTheme = "light" | "dark";
|
|
71
|
+
|
|
72
|
+
export function useTheme(): {
|
|
73
|
+
mode: () => ThemeMode;
|
|
74
|
+
setMode: (mode: ThemeMode) => void;
|
|
75
|
+
resolvedTheme: () => ResolvedTheme;
|
|
76
|
+
cycleMode: () => void;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const ThemeProvider: ParentComponent;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## `ServiceClientProvider`
|
|
85
|
+
|
|
86
|
+
WebSocket service client provider with key-based multi-connection management. Displays request/response progress via notifications.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
export interface ServiceClientContextValue {
|
|
90
|
+
connect: (key?: string, options?: Partial<ServiceConnectionOptions>) => Promise<void>;
|
|
91
|
+
close: (key?: string) => Promise<void>;
|
|
92
|
+
get: (key?: string) => ServiceClient;
|
|
93
|
+
isConnected: (key?: string) => boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const ServiceClientContext: Context<ServiceClientContextValue>;
|
|
97
|
+
export function useServiceClient(): ServiceClientContextValue;
|
|
98
|
+
export const ServiceClientProvider: ParentComponent;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## `SharedDataProvider`
|
|
104
|
+
|
|
105
|
+
Reactive shared data provider that subscribes to server events for real-time data updates.
|
|
106
|
+
|
|
107
|
+
### `SharedDataDefinition`
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
export interface SharedDataDefinition<TData> {
|
|
111
|
+
serviceKey?: string;
|
|
112
|
+
fetch: (changeKeys?: Array<string | number>) => Promise<TData[]>;
|
|
113
|
+
getKey: (item: TData) => string | number;
|
|
114
|
+
orderBy: [(item: TData) => unknown, "asc" | "desc"][];
|
|
115
|
+
filter?: unknown;
|
|
116
|
+
itemSearchText?: (item: TData) => string;
|
|
117
|
+
isItemHidden?: (item: TData) => boolean;
|
|
118
|
+
getParentKey?: (item: TData) => string | number | undefined;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### `SharedDataAccessor`
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
export interface SharedDataAccessor<TData> {
|
|
126
|
+
items: Accessor<TData[]>;
|
|
127
|
+
get: (key: string | number | undefined) => TData | undefined;
|
|
128
|
+
emit: (changeKeys?: Array<string | number>) => Promise<void>;
|
|
129
|
+
getKey: (item: TData) => string | number;
|
|
130
|
+
itemSearchText?: (item: TData) => string;
|
|
131
|
+
isItemHidden?: (item: TData) => boolean;
|
|
132
|
+
getParentKey?: (item: TData) => string | number | undefined;
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## `SharedDataChangeEvent`
|
|
139
|
+
|
|
140
|
+
Server-client shared data change event definition.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
export const SharedDataChangeEvent: EventDefinition<
|
|
144
|
+
{ name: string; filter: unknown },
|
|
145
|
+
(string | number)[] | undefined
|
|
146
|
+
>;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## `SystemProvider`
|
|
152
|
+
|
|
153
|
+
All-in-one provider that composes Config, I18n, SyncStorage, Logger, Notification, ErrorLogger, PwaUpdate, Clipboard, Theme, ServiceClient, SharedData, and Busy providers.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
export const SystemProvider: ParentComponent<{
|
|
157
|
+
clientName: string;
|
|
158
|
+
busyVariant?: BusyVariant;
|
|
159
|
+
}>;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## `I18nProvider`
|
|
165
|
+
|
|
166
|
+
Internationalization provider with built-in `en` and `ko` dictionaries.
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
export function useI18n(): I18nContextValue;
|
|
170
|
+
export const I18nProvider: ParentComponent;
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### `I18nContextValue`
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
export interface I18nContextValue {
|
|
177
|
+
t: (key: string, params?: Record<string, string>) => string;
|
|
178
|
+
locale: Accessor<string>;
|
|
179
|
+
setLocale: (locale: string) => void;
|
|
180
|
+
configure: (options: I18nConfigureOptions) => void;
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### `I18nConfigureOptions`
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
export interface I18nConfigureOptions {
|
|
188
|
+
locale?: string;
|
|
189
|
+
dict?: Record<string, Record<string, unknown>>;
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### `FlatDict`
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
export type FlatDict = Record<string, string>;
|
|
197
|
+
```
|
package/docs/styles.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Styles & Directives
|
|
2
|
+
|
|
3
|
+
Source: `src/styles/**`, `src/directives/**`
|
|
4
|
+
|
|
5
|
+
## Base Styles (`base.styles`)
|
|
6
|
+
|
|
7
|
+
Foundational design tokens for borders, backgrounds, and text.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export const border: {
|
|
11
|
+
default: string; // border-base-200 dark:border-base-700
|
|
12
|
+
subtle: string; // border-base-200 dark:border-base-700
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const bg: {
|
|
16
|
+
surface: string; // bg-white dark:bg-base-900
|
|
17
|
+
muted: string; // bg-base-100 dark:bg-base-800
|
|
18
|
+
subtle: string; // bg-base-200 dark:bg-base-700
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const text: {
|
|
22
|
+
default: string; // text-base-900 dark:text-base-100
|
|
23
|
+
muted: string; // text-base-400 dark:text-base-500
|
|
24
|
+
placeholder: string; // placeholder:text-base-400 dark:placeholder:text-base-500
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Control Styles (`control.styles`)
|
|
31
|
+
|
|
32
|
+
Size and state tokens for interactive components.
|
|
33
|
+
|
|
34
|
+
### `ComponentSize`
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
export type ComponentSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### `state`
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
export const state: {
|
|
44
|
+
disabled: string; // pointer-events-none cursor-default opacity-30
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `pad`
|
|
49
|
+
|
|
50
|
+
Size-specific padding classes:
|
|
51
|
+
|
|
52
|
+
| Size | Value |
|
|
53
|
+
|------|-------|
|
|
54
|
+
| `xs` | `px-1 py-0` |
|
|
55
|
+
| `sm` | `px-1.5 py-0.5` |
|
|
56
|
+
| `md` | `px-2 py-1` |
|
|
57
|
+
| `lg` | `px-3 py-2` |
|
|
58
|
+
| `xl` | `px-4 py-3` |
|
|
59
|
+
|
|
60
|
+
### `gap`
|
|
61
|
+
|
|
62
|
+
Size-specific gap classes:
|
|
63
|
+
|
|
64
|
+
| Size | Value |
|
|
65
|
+
|------|-------|
|
|
66
|
+
| `xs` | `gap-0` |
|
|
67
|
+
| `sm` | `gap-0.5` |
|
|
68
|
+
| `md` | `gap-1` |
|
|
69
|
+
| `lg` | `gap-1.5` |
|
|
70
|
+
| `xl` | `gap-2` |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Theme Styles (`theme.styles`)
|
|
75
|
+
|
|
76
|
+
Semantic color theme tokens for components.
|
|
77
|
+
|
|
78
|
+
### `SemanticTheme`
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
export type SemanticTheme = "primary" | "info" | "success" | "warning" | "danger" | "base";
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `themeTokens`
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
export const themeTokens: Record<SemanticTheme, {
|
|
88
|
+
solid: string; // Solid background + white text
|
|
89
|
+
solidHover: string; // Hover effect for solid
|
|
90
|
+
light: string; // Light background + dark text
|
|
91
|
+
text: string; // Text color only
|
|
92
|
+
hoverBg: string; // Hover background
|
|
93
|
+
border: string; // Border color
|
|
94
|
+
}>;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Each theme (`primary`, `info`, `success`, `warning`, `danger`, `base`) provides all six token fields.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Ripple Directive (`ripple`)
|
|
102
|
+
|
|
103
|
+
Directive that adds a material-design ripple effect to interactive elements.
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
export function ripple(el: HTMLElement, accessor: Accessor<boolean>): void;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Usage
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<button use:ripple={!props.disabled}>Click me</button>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Behavior
|
|
116
|
+
|
|
117
|
+
- Creates an internal ripple container with `overflow: hidden`
|
|
118
|
+
- Sets `position: relative` on static-positioned elements (restores on cleanup)
|
|
119
|
+
- Single ripple mode: removes previous ripple on new click
|
|
120
|
+
- Respects `prefers-reduced-motion: reduce`
|
|
121
|
+
- Full cleanup on unmount
|
|
122
|
+
|
|
123
|
+
### TypeScript Declaration
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
declare module "solid-js" {
|
|
127
|
+
namespace JSX {
|
|
128
|
+
interface Directives {
|
|
129
|
+
ripple: boolean;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simplysm/solid",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.99",
|
|
4
4
|
"description": "Simplysm package - SolidJS library",
|
|
5
5
|
"author": "simplysm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"tabbable": "^6.4.0",
|
|
54
54
|
"tailwind-merge": "^3.5.0",
|
|
55
55
|
"tailwindcss": "^3.4.19",
|
|
56
|
-
"@simplysm/core-browser": "13.0.
|
|
57
|
-
"@simplysm/core-common": "13.0.
|
|
58
|
-
"@simplysm/service-
|
|
59
|
-
"@simplysm/service-
|
|
56
|
+
"@simplysm/core-browser": "13.0.99",
|
|
57
|
+
"@simplysm/core-common": "13.0.99",
|
|
58
|
+
"@simplysm/service-common": "13.0.99",
|
|
59
|
+
"@simplysm/service-client": "13.0.99"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@solidjs/testing-library": "^0.8.10"
|