@arcanejs/react-toolkit 0.6.1 → 0.8.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/README.md +4 -5
- package/dist/chunk-4MWL22HM.mjs +245 -0
- package/dist/chunk-HM5MCE4Y.js +245 -0
- package/dist/colors.d.mts +64 -11
- package/dist/colors.d.ts +64 -11
- package/dist/colors.js +8 -7
- package/dist/colors.mjs +2 -1
- package/dist/data.d.mts +17 -1
- package/dist/data.d.ts +17 -1
- package/dist/data.js +10 -0
- package/dist/data.mjs +10 -0
- package/dist/index.d.mts +88 -26
- package/dist/index.d.ts +88 -26
- package/dist/index.js +31 -225
- package/dist/index.mjs +7 -201
- package/package.json +11 -11
- package/dist/chunk-HVMRFXJ2.mjs +0 -49
- package/dist/chunk-RKOUSLUW.js +0 -49
- package/dist/types-D0Wa4a4d.d.mts +0 -66
- package/dist/types-D0Wa4a4d.d.ts +0 -66
package/dist/colors.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkHM5MCE4Yjs = require('./chunk-HM5MCE4Y.js');
|
|
6
|
+
require('./chunk-RT2VSMJL.js');
|
|
6
7
|
|
|
7
8
|
// src/colors.tsx
|
|
8
9
|
var _react = require('react');
|
|
@@ -55,10 +56,10 @@ var HslColorPicker = ({
|
|
|
55
56
|
},
|
|
56
57
|
[onChange]
|
|
57
58
|
);
|
|
58
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
59
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
59
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkHM5MCE4Yjs.Group, { ...DEFAULT_GROUP_PROPS, ...groupProps, children: [
|
|
60
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHM5MCE4Yjs.Rect, { color: `hsl(${hue}deg ${saturation}% ${lightness}% / ${alpha})` }),
|
|
60
61
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
61
|
-
|
|
62
|
+
_chunkHM5MCE4Yjs.SliderButton,
|
|
62
63
|
{
|
|
63
64
|
value: hue,
|
|
64
65
|
onChange: setHue,
|
|
@@ -70,7 +71,7 @@ var HslColorPicker = ({
|
|
|
70
71
|
}
|
|
71
72
|
),
|
|
72
73
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
73
|
-
|
|
74
|
+
_chunkHM5MCE4Yjs.SliderButton,
|
|
74
75
|
{
|
|
75
76
|
value: saturation,
|
|
76
77
|
onChange: setSat,
|
|
@@ -86,7 +87,7 @@ var HslColorPicker = ({
|
|
|
86
87
|
}
|
|
87
88
|
),
|
|
88
89
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
89
|
-
|
|
90
|
+
_chunkHM5MCE4Yjs.SliderButton,
|
|
90
91
|
{
|
|
91
92
|
value: lightness,
|
|
92
93
|
onChange: setLightness,
|
|
@@ -102,7 +103,7 @@ var HslColorPicker = ({
|
|
|
102
103
|
}
|
|
103
104
|
),
|
|
104
105
|
showAlpha && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
105
|
-
|
|
106
|
+
_chunkHM5MCE4Yjs.SliderButton,
|
|
106
107
|
{
|
|
107
108
|
value: alpha,
|
|
108
109
|
onChange: setAlpha,
|
package/dist/colors.mjs
CHANGED
package/dist/data.d.mts
CHANGED
|
@@ -24,6 +24,20 @@ type ProviderProps = DataFileUsage & {
|
|
|
24
24
|
type DataFileUpdater<T> = (update: (current: T) => T) => void;
|
|
25
25
|
type DataFileContext<T> = {
|
|
26
26
|
data: T;
|
|
27
|
+
/**
|
|
28
|
+
* Last timestamp where {@link DataFileContext.data data} was updated
|
|
29
|
+
* in-memory.
|
|
30
|
+
*
|
|
31
|
+
* **Note: This is not the last time the data was saved to disk.**
|
|
32
|
+
* More specifically:
|
|
33
|
+
* - If the data has been loaded from disk and not changed,
|
|
34
|
+
* then this will be the timestamp that it was loaded from disk.
|
|
35
|
+
* - If the data has been updated since first loaded into memory,
|
|
36
|
+
* then this will be the timestamp of the last update.
|
|
37
|
+
*
|
|
38
|
+
* Uses the local timestamp in milliseconds, i.e. `Date.now()`.
|
|
39
|
+
*/
|
|
40
|
+
lastUpdatedMillis: number;
|
|
27
41
|
updateData: DataFileUpdater<T>;
|
|
28
42
|
/**
|
|
29
43
|
* Can be called to force an attempt to re-save the data to disk
|
|
@@ -54,6 +68,8 @@ declare function useDataFileContext<T>(dataFile: DataFileDefinition<T>): DataFil
|
|
|
54
68
|
*/
|
|
55
69
|
declare function useDataFile<T>(dataFile: DataFileDefinition<T>, usage: DataFileUsage): DataFileCore<T>;
|
|
56
70
|
type DataState<T> = {
|
|
71
|
+
lastUpdatedMillis: number;
|
|
72
|
+
} & ({
|
|
57
73
|
status: 'loading';
|
|
58
74
|
/**
|
|
59
75
|
* The data is not yet loaded, so this will be undefined,
|
|
@@ -72,7 +88,7 @@ type DataState<T> = {
|
|
|
72
88
|
} | {
|
|
73
89
|
status: 'ready';
|
|
74
90
|
data: T;
|
|
75
|
-
};
|
|
91
|
+
});
|
|
76
92
|
type UseDataFileCoreProps<T> = WithPathChange & {
|
|
77
93
|
schema: ZodType<T>;
|
|
78
94
|
defaultValue: T;
|
package/dist/data.d.ts
CHANGED
|
@@ -24,6 +24,20 @@ type ProviderProps = DataFileUsage & {
|
|
|
24
24
|
type DataFileUpdater<T> = (update: (current: T) => T) => void;
|
|
25
25
|
type DataFileContext<T> = {
|
|
26
26
|
data: T;
|
|
27
|
+
/**
|
|
28
|
+
* Last timestamp where {@link DataFileContext.data data} was updated
|
|
29
|
+
* in-memory.
|
|
30
|
+
*
|
|
31
|
+
* **Note: This is not the last time the data was saved to disk.**
|
|
32
|
+
* More specifically:
|
|
33
|
+
* - If the data has been loaded from disk and not changed,
|
|
34
|
+
* then this will be the timestamp that it was loaded from disk.
|
|
35
|
+
* - If the data has been updated since first loaded into memory,
|
|
36
|
+
* then this will be the timestamp of the last update.
|
|
37
|
+
*
|
|
38
|
+
* Uses the local timestamp in milliseconds, i.e. `Date.now()`.
|
|
39
|
+
*/
|
|
40
|
+
lastUpdatedMillis: number;
|
|
27
41
|
updateData: DataFileUpdater<T>;
|
|
28
42
|
/**
|
|
29
43
|
* Can be called to force an attempt to re-save the data to disk
|
|
@@ -54,6 +68,8 @@ declare function useDataFileContext<T>(dataFile: DataFileDefinition<T>): DataFil
|
|
|
54
68
|
*/
|
|
55
69
|
declare function useDataFile<T>(dataFile: DataFileDefinition<T>, usage: DataFileUsage): DataFileCore<T>;
|
|
56
70
|
type DataState<T> = {
|
|
71
|
+
lastUpdatedMillis: number;
|
|
72
|
+
} & ({
|
|
57
73
|
status: 'loading';
|
|
58
74
|
/**
|
|
59
75
|
* The data is not yet loaded, so this will be undefined,
|
|
@@ -72,7 +88,7 @@ type DataState<T> = {
|
|
|
72
88
|
} | {
|
|
73
89
|
status: 'ready';
|
|
74
90
|
data: T;
|
|
75
|
-
};
|
|
91
|
+
});
|
|
76
92
|
type UseDataFileCoreProps<T> = WithPathChange & {
|
|
77
93
|
schema: ZodType<T>;
|
|
78
94
|
defaultValue: T;
|
package/dist/data.js
CHANGED
|
@@ -39,6 +39,7 @@ function useDataFileCore({
|
|
|
39
39
|
path: null,
|
|
40
40
|
data: void 0,
|
|
41
41
|
previousData: void 0,
|
|
42
|
+
lastUpdatedMillis: Date.now(),
|
|
42
43
|
state: {
|
|
43
44
|
state: "saved"
|
|
44
45
|
}
|
|
@@ -53,6 +54,7 @@ function useDataFileCore({
|
|
|
53
54
|
}
|
|
54
55
|
}, [schema, defaultValue]);
|
|
55
56
|
const [data, setData] = _react.useState.call(void 0, {
|
|
57
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
56
58
|
status: "loading",
|
|
57
59
|
data: void 0
|
|
58
60
|
});
|
|
@@ -61,6 +63,7 @@ function useDataFileCore({
|
|
|
61
63
|
const data2 = state.current.data;
|
|
62
64
|
if (state.current.state.state === "error") {
|
|
63
65
|
setData({
|
|
66
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
64
67
|
status: "error",
|
|
65
68
|
error: state.current.state.error,
|
|
66
69
|
data: data2
|
|
@@ -69,12 +72,14 @@ function useDataFileCore({
|
|
|
69
72
|
}
|
|
70
73
|
if (data2 === void 0) {
|
|
71
74
|
setData({
|
|
75
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
72
76
|
status: "loading",
|
|
73
77
|
data: void 0
|
|
74
78
|
});
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
81
|
setData({
|
|
82
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
78
83
|
status: "ready",
|
|
79
84
|
data: data2
|
|
80
85
|
});
|
|
@@ -131,6 +136,7 @@ function useDataFileCore({
|
|
|
131
136
|
const parsedData = schema.parse(JSON.parse(data2));
|
|
132
137
|
if (state.current.path === path) {
|
|
133
138
|
state.current.data = parsedData;
|
|
139
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
134
140
|
state.current.state = { state: "saved" };
|
|
135
141
|
updateDataFromState();
|
|
136
142
|
}
|
|
@@ -141,6 +147,7 @@ function useDataFileCore({
|
|
|
141
147
|
if (error.code === "ENOENT") {
|
|
142
148
|
const initialData = onPathChange === "transfer" && state.current.previousData !== void 0 ? state.current.previousData : defaultValue;
|
|
143
149
|
state.current.data = initialData;
|
|
150
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
144
151
|
state.current.state = { state: "dirty" };
|
|
145
152
|
_optionalChain([log, 'optionalAccess', _ => _.info, 'call', _2 => _2(
|
|
146
153
|
"Creating a new file at %s with initial data %o",
|
|
@@ -164,6 +171,7 @@ function useDataFileCore({
|
|
|
164
171
|
throw new Error("Attempt to update data before it has been loaded");
|
|
165
172
|
}
|
|
166
173
|
state.current.data = update(state.current.data);
|
|
174
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
167
175
|
state.current.state = { state: "dirty" };
|
|
168
176
|
saveData();
|
|
169
177
|
updateDataFromState();
|
|
@@ -182,6 +190,7 @@ function createDataFileDefinition({
|
|
|
182
190
|
}) {
|
|
183
191
|
const context = _react.createContext.call(void 0, {
|
|
184
192
|
data: defaultValue,
|
|
193
|
+
lastUpdatedMillis: Date.now(),
|
|
185
194
|
updateData: () => {
|
|
186
195
|
throw new Error("Data file provider not used");
|
|
187
196
|
},
|
|
@@ -207,6 +216,7 @@ function createDataFileDefinition({
|
|
|
207
216
|
const providedContext = _react.useMemo.call(void 0,
|
|
208
217
|
() => ({
|
|
209
218
|
data: data.status !== "loading" && data.data !== void 0 ? data.data : defaultValue,
|
|
219
|
+
lastUpdatedMillis: data.lastUpdatedMillis,
|
|
210
220
|
updateData,
|
|
211
221
|
saveData,
|
|
212
222
|
error: data.status === "error" ? data.error : void 0
|
package/dist/data.mjs
CHANGED
|
@@ -39,6 +39,7 @@ function useDataFileCore({
|
|
|
39
39
|
path: null,
|
|
40
40
|
data: void 0,
|
|
41
41
|
previousData: void 0,
|
|
42
|
+
lastUpdatedMillis: Date.now(),
|
|
42
43
|
state: {
|
|
43
44
|
state: "saved"
|
|
44
45
|
}
|
|
@@ -53,6 +54,7 @@ function useDataFileCore({
|
|
|
53
54
|
}
|
|
54
55
|
}, [schema, defaultValue]);
|
|
55
56
|
const [data, setData] = useState({
|
|
57
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
56
58
|
status: "loading",
|
|
57
59
|
data: void 0
|
|
58
60
|
});
|
|
@@ -61,6 +63,7 @@ function useDataFileCore({
|
|
|
61
63
|
const data2 = state.current.data;
|
|
62
64
|
if (state.current.state.state === "error") {
|
|
63
65
|
setData({
|
|
66
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
64
67
|
status: "error",
|
|
65
68
|
error: state.current.state.error,
|
|
66
69
|
data: data2
|
|
@@ -69,12 +72,14 @@ function useDataFileCore({
|
|
|
69
72
|
}
|
|
70
73
|
if (data2 === void 0) {
|
|
71
74
|
setData({
|
|
75
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
72
76
|
status: "loading",
|
|
73
77
|
data: void 0
|
|
74
78
|
});
|
|
75
79
|
return;
|
|
76
80
|
}
|
|
77
81
|
setData({
|
|
82
|
+
lastUpdatedMillis: state.current.lastUpdatedMillis,
|
|
78
83
|
status: "ready",
|
|
79
84
|
data: data2
|
|
80
85
|
});
|
|
@@ -131,6 +136,7 @@ function useDataFileCore({
|
|
|
131
136
|
const parsedData = schema.parse(JSON.parse(data2));
|
|
132
137
|
if (state.current.path === path) {
|
|
133
138
|
state.current.data = parsedData;
|
|
139
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
134
140
|
state.current.state = { state: "saved" };
|
|
135
141
|
updateDataFromState();
|
|
136
142
|
}
|
|
@@ -141,6 +147,7 @@ function useDataFileCore({
|
|
|
141
147
|
if (error.code === "ENOENT") {
|
|
142
148
|
const initialData = onPathChange === "transfer" && state.current.previousData !== void 0 ? state.current.previousData : defaultValue;
|
|
143
149
|
state.current.data = initialData;
|
|
150
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
144
151
|
state.current.state = { state: "dirty" };
|
|
145
152
|
log?.info(
|
|
146
153
|
"Creating a new file at %s with initial data %o",
|
|
@@ -164,6 +171,7 @@ function useDataFileCore({
|
|
|
164
171
|
throw new Error("Attempt to update data before it has been loaded");
|
|
165
172
|
}
|
|
166
173
|
state.current.data = update(state.current.data);
|
|
174
|
+
state.current.lastUpdatedMillis = Date.now();
|
|
167
175
|
state.current.state = { state: "dirty" };
|
|
168
176
|
saveData();
|
|
169
177
|
updateDataFromState();
|
|
@@ -182,6 +190,7 @@ function createDataFileDefinition({
|
|
|
182
190
|
}) {
|
|
183
191
|
const context = createContext({
|
|
184
192
|
data: defaultValue,
|
|
193
|
+
lastUpdatedMillis: Date.now(),
|
|
185
194
|
updateData: () => {
|
|
186
195
|
throw new Error("Data file provider not used");
|
|
187
196
|
},
|
|
@@ -207,6 +216,7 @@ function createDataFileDefinition({
|
|
|
207
216
|
const providedContext = useMemo(
|
|
208
217
|
() => ({
|
|
209
218
|
data: data.status !== "loading" && data.data !== void 0 ? data.data : defaultValue,
|
|
219
|
+
lastUpdatedMillis: data.lastUpdatedMillis,
|
|
210
220
|
updateData,
|
|
211
221
|
saveData,
|
|
212
222
|
error: data.status === "error" ? data.error : void 0
|
package/dist/index.d.mts
CHANGED
|
@@ -1,32 +1,94 @@
|
|
|
1
|
+
import * as _arcanejs_protocol_core from '@arcanejs/protocol/core';
|
|
2
|
+
import * as _arcanejs_protocol_styles from '@arcanejs/protocol/styles';
|
|
3
|
+
import * as _arcanejs_toolkit_components_group from '@arcanejs/toolkit/components/group';
|
|
4
|
+
import { Props } from '@arcanejs/toolkit/components/group';
|
|
5
|
+
import * as _arcanejs_toolkit_components_button from '@arcanejs/toolkit/components/button';
|
|
6
|
+
import React__default from 'react';
|
|
1
7
|
import * as ld from '@arcanejs/toolkit';
|
|
2
|
-
import {
|
|
3
|
-
import { L as LightDeskIntrinsicElements } from './types-D0Wa4a4d.mjs';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { Button as Button$1 } from '@arcanejs/toolkit/components/button';
|
|
6
|
-
import { Label as Label$1 } from '@arcanejs/toolkit/components/label';
|
|
7
|
-
import { Rect as Rect$1 } from '@arcanejs/toolkit/components/rect';
|
|
8
|
-
import { SliderButton as SliderButton$1 } from '@arcanejs/toolkit/components/slider-button';
|
|
9
|
-
import { Switch as Switch$1 } from '@arcanejs/toolkit/components/switch';
|
|
10
|
-
import { Tab as Tab$1, Tabs as Tabs$1 } from '@arcanejs/toolkit/components/tabs';
|
|
11
|
-
import { Timeline as Timeline$1 } from '@arcanejs/toolkit/components/timeline';
|
|
12
|
-
import { TextInput as TextInput$1 } from '@arcanejs/toolkit/components/text-input';
|
|
8
|
+
import { AnyComponent, BaseParent, Base } from '@arcanejs/toolkit/components/base';
|
|
13
9
|
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
type ComponentClass = new (...args: any[]) => AnyComponent;
|
|
11
|
+
type ComponentsDefinition = {
|
|
12
|
+
[key: string]: ComponentClass;
|
|
13
|
+
};
|
|
14
|
+
type Child = JSX.Element | null | undefined | false | string;
|
|
15
|
+
type Children = Child | Child[];
|
|
16
|
+
type PropsOfComponent<T extends ComponentClass> = T extends new (props?: infer P) => BaseParent<any, any, any> ? Partial<P & {
|
|
17
|
+
children: Children;
|
|
18
|
+
}> : T extends new (props: infer P) => BaseParent<any, any, any> ? P & {
|
|
19
|
+
children?: Children;
|
|
20
|
+
} : T extends new (props?: infer P) => Base<any, any, any> ? Partial<P> : T extends new (props: infer P) => Base<any, any, any> ? P : never;
|
|
21
|
+
type InstanceType<T extends ComponentClass> = T extends new (...args: any[]) => infer R ? R : never;
|
|
22
|
+
type Creators<D extends ComponentsDefinition> = {
|
|
23
|
+
[K in keyof D]: (props: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}) => AnyComponent;
|
|
26
|
+
};
|
|
27
|
+
type ComponentFunctionForComponent<T extends ComponentClass> = React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<PropsOfComponent<T>> & React__default.RefAttributes<InstanceType<T>>>;
|
|
28
|
+
type ComponentFunctions<D extends ComponentsDefinition> = {
|
|
29
|
+
[K in keyof D]: ComponentFunctionForComponent<D[K]>;
|
|
30
|
+
};
|
|
31
|
+
type PreparedComponents<D extends ComponentsDefinition> = {
|
|
32
|
+
_namespace: string;
|
|
33
|
+
_creators: Creators<D>;
|
|
34
|
+
} & ComponentFunctions<D>;
|
|
35
|
+
declare const prepareComponents: <D extends ComponentsDefinition>(namespace: string, defn: D) => PreparedComponents<D>;
|
|
26
36
|
|
|
37
|
+
type ReactToolkitConfig = {
|
|
38
|
+
componentNamespaces: Array<PreparedComponents<any>>;
|
|
39
|
+
};
|
|
27
40
|
declare const ToolkitRenderer: {
|
|
28
|
-
renderGroup: (component: JSX.Element, container: ld.Group) => void;
|
|
29
|
-
render: (component: JSX.Element, container: ld.Toolkit, rootGroupProps?: Props) => void;
|
|
41
|
+
renderGroup: (component: JSX.Element, container: ld.Group, config?: ReactToolkitConfig) => void;
|
|
42
|
+
render: (component: JSX.Element, container: ld.Toolkit, rootGroupProps?: Props, config?: ReactToolkitConfig) => void;
|
|
30
43
|
};
|
|
31
44
|
|
|
32
|
-
|
|
45
|
+
declare const Button: React__default.ForwardRefExoticComponent<Partial<Partial<_arcanejs_toolkit_components_button.InternalProps>> & React__default.RefAttributes<ld.Button>>;
|
|
46
|
+
declare const Group: React__default.ForwardRefExoticComponent<Partial<Partial<_arcanejs_toolkit_components_group.InternalProps> & {
|
|
47
|
+
children: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
48
|
+
}> & React__default.RefAttributes<ld.Group>>;
|
|
49
|
+
declare const GroupHeader: React__default.ForwardRefExoticComponent<Record<never, never> & {
|
|
50
|
+
children?: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
51
|
+
} & React__default.RefAttributes<ld.GroupHeader>>;
|
|
52
|
+
declare const Label: React__default.ForwardRefExoticComponent<Partial<_arcanejs_protocol_styles.LabelComponentStyle & {
|
|
53
|
+
text: string | null;
|
|
54
|
+
}> & React__default.RefAttributes<ld.Label>>;
|
|
55
|
+
declare const Rect: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
56
|
+
color: string;
|
|
57
|
+
grow?: boolean | undefined;
|
|
58
|
+
}>> & React__default.RefAttributes<ld.Rect>>;
|
|
59
|
+
declare const SliderButton: React__default.ForwardRefExoticComponent<Partial<Pick<Pick<_arcanejs_protocol_core.SliderButtonComponent, "grow" | "min" | "max" | "step" | "gradient"> & {
|
|
60
|
+
value?: number | undefined;
|
|
61
|
+
defaultValue?: number | undefined;
|
|
62
|
+
onChange?: ((value: number) => void | Promise<void>) | undefined;
|
|
63
|
+
}, "value"> & Partial<Omit<Pick<_arcanejs_protocol_core.SliderButtonComponent, "grow" | "min" | "max" | "step" | "gradient"> & {
|
|
64
|
+
value?: number | undefined;
|
|
65
|
+
defaultValue?: number | undefined;
|
|
66
|
+
onChange?: ((value: number) => void | Promise<void>) | undefined;
|
|
67
|
+
}, "value">>> & React__default.RefAttributes<ld.SliderButton>>;
|
|
68
|
+
declare const Switch: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
69
|
+
value?: "on" | "off" | undefined;
|
|
70
|
+
defaultValue?: "on" | "off" | undefined;
|
|
71
|
+
onChange?: ((state: "on" | "off") => void | Promise<void>) | undefined;
|
|
72
|
+
}>> & React__default.RefAttributes<ld.Switch>>;
|
|
73
|
+
declare const Tab: React__default.ForwardRefExoticComponent<{
|
|
74
|
+
name: string;
|
|
75
|
+
} & {
|
|
76
|
+
children?: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
77
|
+
} & React__default.RefAttributes<ld.Tab>>;
|
|
78
|
+
declare const Tabs: React__default.ForwardRefExoticComponent<Partial<{} & {
|
|
79
|
+
children: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
80
|
+
}> & React__default.RefAttributes<ld.Tabs>>;
|
|
81
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
82
|
+
value: string | null;
|
|
83
|
+
onChange?: ((value: string) => void | Promise<void>) | undefined;
|
|
84
|
+
}>> & React__default.RefAttributes<ld.TextInput>>;
|
|
85
|
+
declare const Timeline: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
86
|
+
state: _arcanejs_protocol_core.TimelineState;
|
|
87
|
+
title: string | null;
|
|
88
|
+
subtitles: string[] | null;
|
|
89
|
+
source: {
|
|
90
|
+
name: string;
|
|
91
|
+
} | null | undefined;
|
|
92
|
+
}>> & React__default.RefAttributes<ld.Timeline>>;
|
|
93
|
+
|
|
94
|
+
export { Button, Group, GroupHeader, Label, Rect, SliderButton, Switch, Tab, Tabs, TextInput, Timeline, ToolkitRenderer, prepareComponents };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,94 @@
|
|
|
1
|
+
import * as _arcanejs_protocol_core from '@arcanejs/protocol/core';
|
|
2
|
+
import * as _arcanejs_protocol_styles from '@arcanejs/protocol/styles';
|
|
3
|
+
import * as _arcanejs_toolkit_components_group from '@arcanejs/toolkit/components/group';
|
|
4
|
+
import { Props } from '@arcanejs/toolkit/components/group';
|
|
5
|
+
import * as _arcanejs_toolkit_components_button from '@arcanejs/toolkit/components/button';
|
|
6
|
+
import React__default from 'react';
|
|
1
7
|
import * as ld from '@arcanejs/toolkit';
|
|
2
|
-
import {
|
|
3
|
-
import { L as LightDeskIntrinsicElements } from './types-D0Wa4a4d.js';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { Button as Button$1 } from '@arcanejs/toolkit/components/button';
|
|
6
|
-
import { Label as Label$1 } from '@arcanejs/toolkit/components/label';
|
|
7
|
-
import { Rect as Rect$1 } from '@arcanejs/toolkit/components/rect';
|
|
8
|
-
import { SliderButton as SliderButton$1 } from '@arcanejs/toolkit/components/slider-button';
|
|
9
|
-
import { Switch as Switch$1 } from '@arcanejs/toolkit/components/switch';
|
|
10
|
-
import { Tab as Tab$1, Tabs as Tabs$1 } from '@arcanejs/toolkit/components/tabs';
|
|
11
|
-
import { Timeline as Timeline$1 } from '@arcanejs/toolkit/components/timeline';
|
|
12
|
-
import { TextInput as TextInput$1 } from '@arcanejs/toolkit/components/text-input';
|
|
8
|
+
import { AnyComponent, BaseParent, Base } from '@arcanejs/toolkit/components/base';
|
|
13
9
|
|
|
14
|
-
type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
type ComponentClass = new (...args: any[]) => AnyComponent;
|
|
11
|
+
type ComponentsDefinition = {
|
|
12
|
+
[key: string]: ComponentClass;
|
|
13
|
+
};
|
|
14
|
+
type Child = JSX.Element | null | undefined | false | string;
|
|
15
|
+
type Children = Child | Child[];
|
|
16
|
+
type PropsOfComponent<T extends ComponentClass> = T extends new (props?: infer P) => BaseParent<any, any, any> ? Partial<P & {
|
|
17
|
+
children: Children;
|
|
18
|
+
}> : T extends new (props: infer P) => BaseParent<any, any, any> ? P & {
|
|
19
|
+
children?: Children;
|
|
20
|
+
} : T extends new (props?: infer P) => Base<any, any, any> ? Partial<P> : T extends new (props: infer P) => Base<any, any, any> ? P : never;
|
|
21
|
+
type InstanceType<T extends ComponentClass> = T extends new (...args: any[]) => infer R ? R : never;
|
|
22
|
+
type Creators<D extends ComponentsDefinition> = {
|
|
23
|
+
[K in keyof D]: (props: {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}) => AnyComponent;
|
|
26
|
+
};
|
|
27
|
+
type ComponentFunctionForComponent<T extends ComponentClass> = React__default.ForwardRefExoticComponent<React__default.PropsWithoutRef<PropsOfComponent<T>> & React__default.RefAttributes<InstanceType<T>>>;
|
|
28
|
+
type ComponentFunctions<D extends ComponentsDefinition> = {
|
|
29
|
+
[K in keyof D]: ComponentFunctionForComponent<D[K]>;
|
|
30
|
+
};
|
|
31
|
+
type PreparedComponents<D extends ComponentsDefinition> = {
|
|
32
|
+
_namespace: string;
|
|
33
|
+
_creators: Creators<D>;
|
|
34
|
+
} & ComponentFunctions<D>;
|
|
35
|
+
declare const prepareComponents: <D extends ComponentsDefinition>(namespace: string, defn: D) => PreparedComponents<D>;
|
|
26
36
|
|
|
37
|
+
type ReactToolkitConfig = {
|
|
38
|
+
componentNamespaces: Array<PreparedComponents<any>>;
|
|
39
|
+
};
|
|
27
40
|
declare const ToolkitRenderer: {
|
|
28
|
-
renderGroup: (component: JSX.Element, container: ld.Group) => void;
|
|
29
|
-
render: (component: JSX.Element, container: ld.Toolkit, rootGroupProps?: Props) => void;
|
|
41
|
+
renderGroup: (component: JSX.Element, container: ld.Group, config?: ReactToolkitConfig) => void;
|
|
42
|
+
render: (component: JSX.Element, container: ld.Toolkit, rootGroupProps?: Props, config?: ReactToolkitConfig) => void;
|
|
30
43
|
};
|
|
31
44
|
|
|
32
|
-
|
|
45
|
+
declare const Button: React__default.ForwardRefExoticComponent<Partial<Partial<_arcanejs_toolkit_components_button.InternalProps>> & React__default.RefAttributes<ld.Button>>;
|
|
46
|
+
declare const Group: React__default.ForwardRefExoticComponent<Partial<Partial<_arcanejs_toolkit_components_group.InternalProps> & {
|
|
47
|
+
children: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
48
|
+
}> & React__default.RefAttributes<ld.Group>>;
|
|
49
|
+
declare const GroupHeader: React__default.ForwardRefExoticComponent<Record<never, never> & {
|
|
50
|
+
children?: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
51
|
+
} & React__default.RefAttributes<ld.GroupHeader>>;
|
|
52
|
+
declare const Label: React__default.ForwardRefExoticComponent<Partial<_arcanejs_protocol_styles.LabelComponentStyle & {
|
|
53
|
+
text: string | null;
|
|
54
|
+
}> & React__default.RefAttributes<ld.Label>>;
|
|
55
|
+
declare const Rect: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
56
|
+
color: string;
|
|
57
|
+
grow?: boolean | undefined;
|
|
58
|
+
}>> & React__default.RefAttributes<ld.Rect>>;
|
|
59
|
+
declare const SliderButton: React__default.ForwardRefExoticComponent<Partial<Pick<Pick<_arcanejs_protocol_core.SliderButtonComponent, "grow" | "min" | "max" | "step" | "gradient"> & {
|
|
60
|
+
value?: number | undefined;
|
|
61
|
+
defaultValue?: number | undefined;
|
|
62
|
+
onChange?: ((value: number) => void | Promise<void>) | undefined;
|
|
63
|
+
}, "value"> & Partial<Omit<Pick<_arcanejs_protocol_core.SliderButtonComponent, "grow" | "min" | "max" | "step" | "gradient"> & {
|
|
64
|
+
value?: number | undefined;
|
|
65
|
+
defaultValue?: number | undefined;
|
|
66
|
+
onChange?: ((value: number) => void | Promise<void>) | undefined;
|
|
67
|
+
}, "value">>> & React__default.RefAttributes<ld.SliderButton>>;
|
|
68
|
+
declare const Switch: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
69
|
+
value?: "on" | "off" | undefined;
|
|
70
|
+
defaultValue?: "on" | "off" | undefined;
|
|
71
|
+
onChange?: ((state: "on" | "off") => void | Promise<void>) | undefined;
|
|
72
|
+
}>> & React__default.RefAttributes<ld.Switch>>;
|
|
73
|
+
declare const Tab: React__default.ForwardRefExoticComponent<{
|
|
74
|
+
name: string;
|
|
75
|
+
} & {
|
|
76
|
+
children?: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
77
|
+
} & React__default.RefAttributes<ld.Tab>>;
|
|
78
|
+
declare const Tabs: React__default.ForwardRefExoticComponent<Partial<{} & {
|
|
79
|
+
children: (string | false | JSX.Element | null | undefined) | (string | false | JSX.Element | null | undefined)[];
|
|
80
|
+
}> & React__default.RefAttributes<ld.Tabs>>;
|
|
81
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
82
|
+
value: string | null;
|
|
83
|
+
onChange?: ((value: string) => void | Promise<void>) | undefined;
|
|
84
|
+
}>> & React__default.RefAttributes<ld.TextInput>>;
|
|
85
|
+
declare const Timeline: React__default.ForwardRefExoticComponent<Partial<Partial<{
|
|
86
|
+
state: _arcanejs_protocol_core.TimelineState;
|
|
87
|
+
title: string | null;
|
|
88
|
+
subtitles: string[] | null;
|
|
89
|
+
source: {
|
|
90
|
+
name: string;
|
|
91
|
+
} | null | undefined;
|
|
92
|
+
}>> & React__default.RefAttributes<ld.Timeline>>;
|
|
93
|
+
|
|
94
|
+
export { Button, Group, GroupHeader, Label, Rect, SliderButton, Switch, Tab, Tabs, TextInput, Timeline, ToolkitRenderer, prepareComponents };
|