@arcanejs/react-toolkit 0.12.5 → 0.14.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 +273 -193
- package/dist/{chunk-Q54JXYCV.js → chunk-EJVUDIQP.js} +94 -38
- package/dist/{chunk-CAHNLXTY.mjs → chunk-TP2BI3OM.mjs} +93 -37
- package/dist/colors.js +7 -7
- package/dist/colors.mjs +1 -1
- package/dist/data.d.mts +12 -2
- package/dist/data.d.ts +12 -2
- package/dist/data.js +49 -12
- package/dist/data.mjs +47 -10
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +8 -8
|
@@ -4,12 +4,13 @@ var _chunkRT2VSMJLjs = require('./chunk-RT2VSMJL.js');
|
|
|
4
4
|
|
|
5
5
|
// src/index.tsx
|
|
6
6
|
var _reactreconciler = require('react-reconciler'); var _reactreconciler2 = _interopRequireDefault(_reactreconciler);
|
|
7
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
7
8
|
var _constants = require('react-reconciler/constants');
|
|
8
9
|
var _toolkit = require('@arcanejs/toolkit'); var ld = _interopRequireWildcard(_toolkit);
|
|
9
10
|
var _base = require('@arcanejs/toolkit/components/base');
|
|
10
11
|
|
|
11
12
|
// src/registry.ts
|
|
12
|
-
|
|
13
|
+
|
|
13
14
|
var prepareComponents = (namespace, defn) => {
|
|
14
15
|
const entries = Object.entries(defn);
|
|
15
16
|
const _creators = entries.reduce((acc, [key, cls]) => {
|
|
@@ -67,9 +68,48 @@ var CoreComponents = prepareComponents("core", {
|
|
|
67
68
|
// src/index.tsx
|
|
68
69
|
var _jsxruntime = require('react/jsx-runtime');
|
|
69
70
|
var canSetProps = (instance) => instance instanceof _base.Base;
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
var getPropsToSet = (props) => {
|
|
72
|
+
const updates = {};
|
|
73
|
+
for (const [key, val] of Object.entries(props)) {
|
|
74
|
+
if (key !== "children") {
|
|
75
|
+
updates[key] = val;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return updates;
|
|
79
|
+
};
|
|
80
|
+
var setInstanceProps = (instance, props) => {
|
|
81
|
+
if (canSetProps(instance)) {
|
|
82
|
+
instance.setProps(props);
|
|
83
|
+
} else {
|
|
84
|
+
throw new Error(`Unexpected Instance: ${instance}`);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var scheduleMicrotaskCompat = typeof queueMicrotask === "function" ? queueMicrotask : (cb) => {
|
|
88
|
+
Promise.resolve().then(cb);
|
|
89
|
+
};
|
|
90
|
+
var reportRendererError = (error) => {
|
|
91
|
+
console.error(error);
|
|
92
|
+
};
|
|
93
|
+
var createContainerCompat = (reconciler, container) => {
|
|
94
|
+
const createContainer = reconciler.createContainer;
|
|
95
|
+
if (createContainer.length <= 4) {
|
|
96
|
+
return createContainer(container, 0, false, null);
|
|
97
|
+
}
|
|
98
|
+
return createContainer(
|
|
99
|
+
container,
|
|
100
|
+
0,
|
|
101
|
+
null,
|
|
102
|
+
false,
|
|
103
|
+
null,
|
|
104
|
+
"",
|
|
105
|
+
reportRendererError,
|
|
106
|
+
reportRendererError,
|
|
107
|
+
reportRendererError,
|
|
108
|
+
null
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
var ROOT_HOST_CONTEXT = {};
|
|
112
|
+
var hostConfig = ({ componentNamespaces }) => {
|
|
73
113
|
const processedNamespaces = {};
|
|
74
114
|
for (const namespace of componentNamespaces) {
|
|
75
115
|
if (processedNamespaces[namespace._namespace]) {
|
|
@@ -77,12 +117,17 @@ var hostConfig = ({
|
|
|
77
117
|
}
|
|
78
118
|
processedNamespaces[namespace._namespace] = namespace;
|
|
79
119
|
}
|
|
80
|
-
|
|
120
|
+
const hostTransitionContext = _react2.default.createContext(null);
|
|
121
|
+
let currentUpdatePriority = _constants.DefaultEventPriority;
|
|
122
|
+
const config = {
|
|
81
123
|
supportsMutation: true,
|
|
82
124
|
supportsPersistence: false,
|
|
83
125
|
noTimeout: -1,
|
|
84
126
|
isPrimaryRenderer: true,
|
|
85
127
|
supportsHydration: false,
|
|
128
|
+
supportsMicrotasks: true,
|
|
129
|
+
NotPendingTransition: null,
|
|
130
|
+
HostTransitionContext: hostTransitionContext,
|
|
86
131
|
afterActiveInstanceBlur: () => null,
|
|
87
132
|
appendChild: (parentInstance, child) => {
|
|
88
133
|
if (parentInstance instanceof _base.BaseParent) {
|
|
@@ -104,14 +149,23 @@ var hostConfig = ({
|
|
|
104
149
|
beforeActiveInstanceBlur: () => null,
|
|
105
150
|
cancelTimeout: (id) => clearTimeout(id),
|
|
106
151
|
clearContainer: (container) => container.removeAllChildren(),
|
|
107
|
-
commitMount: () => {
|
|
152
|
+
commitMount: (_instance, _type, _props) => {
|
|
108
153
|
throw new Error(`Unexpected call to commitMount()`);
|
|
109
154
|
},
|
|
110
|
-
commitUpdate(instance,
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
155
|
+
commitUpdate(instance, ...args) {
|
|
156
|
+
if (typeof args[0] === "string") {
|
|
157
|
+
const nextProps2 = args[2];
|
|
158
|
+
setInstanceProps(instance, getPropsToSet(nextProps2));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const updatePayload = args[0];
|
|
162
|
+
if (updatePayload) {
|
|
163
|
+
setInstanceProps(instance, updatePayload);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const nextProps = args[3];
|
|
167
|
+
if (nextProps) {
|
|
168
|
+
setInstanceProps(instance, getPropsToSet(nextProps));
|
|
115
169
|
}
|
|
116
170
|
},
|
|
117
171
|
commitTextUpdate: (textInstance, _oldText, newText) => textInstance.setText(newText),
|
|
@@ -137,6 +191,7 @@ var hostConfig = ({
|
|
|
137
191
|
detachDeletedInstance: () => null,
|
|
138
192
|
getChildHostContext: (parentHostContext) => parentHostContext,
|
|
139
193
|
getCurrentEventPriority: () => _constants.DefaultEventPriority,
|
|
194
|
+
getCurrentUpdatePriority: () => currentUpdatePriority,
|
|
140
195
|
getInstanceFromNode: () => {
|
|
141
196
|
throw new Error("Not yet implemented.");
|
|
142
197
|
},
|
|
@@ -144,7 +199,7 @@ var hostConfig = ({
|
|
|
144
199
|
throw new Error("Not yet implemented.");
|
|
145
200
|
},
|
|
146
201
|
getPublicInstance: (instance) => instance,
|
|
147
|
-
getRootHostContext: () =>
|
|
202
|
+
getRootHostContext: () => ROOT_HOST_CONTEXT,
|
|
148
203
|
insertBefore: (parentInstance, child, beforeChild) => {
|
|
149
204
|
if (parentInstance instanceof _base.BaseParent) {
|
|
150
205
|
parentInstance.insertBefore(child, beforeChild);
|
|
@@ -154,21 +209,17 @@ var hostConfig = ({
|
|
|
154
209
|
},
|
|
155
210
|
insertInContainerBefore: (container, child, beforeChild) => container.insertBefore(child, beforeChild),
|
|
156
211
|
finalizeInitialChildren: () => false,
|
|
212
|
+
maySuspendCommit: () => false,
|
|
213
|
+
preloadInstance: () => false,
|
|
157
214
|
prepareForCommit: () => null,
|
|
158
215
|
preparePortalMount: () => null,
|
|
159
216
|
prepareScopeUpdate: () => null,
|
|
160
217
|
prepareUpdate: (_instance, _type, _oldProps, newProps, _rootContainer, _hostContext) => {
|
|
161
|
-
const updates =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
if (Object.keys(updates).length) {
|
|
168
|
-
return updates;
|
|
169
|
-
} else {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
218
|
+
const updates = getPropsToSet(newProps);
|
|
219
|
+
return Object.keys(updates).length ? updates : null;
|
|
220
|
+
},
|
|
221
|
+
requestPostPaintCallback: (callback) => {
|
|
222
|
+
setTimeout(() => callback(Date.now()), 0);
|
|
172
223
|
},
|
|
173
224
|
removeChild(parentInstance, child) {
|
|
174
225
|
if (parentInstance instanceof _base.BaseParent) {
|
|
@@ -182,31 +233,36 @@ var hostConfig = ({
|
|
|
182
233
|
resetTextContent: () => {
|
|
183
234
|
throw new Error(`Unexpected call to resetTextContent()`);
|
|
184
235
|
},
|
|
236
|
+
resetFormInstance: () => null,
|
|
237
|
+
resolveEventTimeStamp: () => Date.now(),
|
|
238
|
+
resolveEventType: () => null,
|
|
239
|
+
resolveUpdatePriority: () => currentUpdatePriority,
|
|
185
240
|
scheduleTimeout: (fn, delay) => setTimeout(fn, delay),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
console.log("Not-implemented: hideInstance");
|
|
190
|
-
},
|
|
191
|
-
hideTextInstance: () => {
|
|
192
|
-
console.log("Not-implemented: hideTextInstance");
|
|
241
|
+
scheduleMicrotask: scheduleMicrotaskCompat,
|
|
242
|
+
setCurrentUpdatePriority: (newPriority) => {
|
|
243
|
+
currentUpdatePriority = newPriority;
|
|
193
244
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
245
|
+
shouldAttemptEagerTransition: () => false,
|
|
246
|
+
shouldSetTextContent: () => false,
|
|
247
|
+
startSuspendingCommit: () => null,
|
|
248
|
+
suspendInstance: () => null,
|
|
249
|
+
trackSchedulerEvent: () => null,
|
|
250
|
+
waitForCommitToBeReady: () => null,
|
|
251
|
+
hideInstance: () => null,
|
|
252
|
+
hideTextInstance: () => null,
|
|
253
|
+
unhideInstance: () => null,
|
|
254
|
+
unhideTextInstance: () => null
|
|
200
255
|
};
|
|
256
|
+
return config;
|
|
201
257
|
};
|
|
202
258
|
var ToolkitRenderer = {
|
|
203
259
|
renderGroup: (component, container, config = {
|
|
204
260
|
componentNamespaces: [CoreComponents]
|
|
205
261
|
}) => {
|
|
206
262
|
const reconciler = _reactreconciler2.default.call(void 0, hostConfig(config));
|
|
207
|
-
const root = reconciler
|
|
263
|
+
const root = createContainerCompat(reconciler, container);
|
|
208
264
|
const componentWithContexts = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkRT2VSMJLjs.LoggerContext.Provider, { value: container.log, children: component });
|
|
209
|
-
reconciler.updateContainer(componentWithContexts, root, null);
|
|
265
|
+
reconciler.updateContainer(componentWithContexts, root, null, void 0);
|
|
210
266
|
},
|
|
211
267
|
render: (component, container, rootGroupProps, config = {
|
|
212
268
|
componentNamespaces: [CoreComponents]
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/index.tsx
|
|
6
6
|
import Reconciler from "react-reconciler";
|
|
7
|
+
import React2 from "react";
|
|
7
8
|
import { DefaultEventPriority } from "react-reconciler/constants";
|
|
8
9
|
import * as ld from "@arcanejs/toolkit";
|
|
9
10
|
import { Base, BaseParent } from "@arcanejs/toolkit/components/base";
|
|
@@ -67,9 +68,48 @@ var CoreComponents = prepareComponents("core", {
|
|
|
67
68
|
// src/index.tsx
|
|
68
69
|
import { jsx } from "react/jsx-runtime";
|
|
69
70
|
var canSetProps = (instance) => instance instanceof Base;
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
var getPropsToSet = (props) => {
|
|
72
|
+
const updates = {};
|
|
73
|
+
for (const [key, val] of Object.entries(props)) {
|
|
74
|
+
if (key !== "children") {
|
|
75
|
+
updates[key] = val;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return updates;
|
|
79
|
+
};
|
|
80
|
+
var setInstanceProps = (instance, props) => {
|
|
81
|
+
if (canSetProps(instance)) {
|
|
82
|
+
instance.setProps(props);
|
|
83
|
+
} else {
|
|
84
|
+
throw new Error(`Unexpected Instance: ${instance}`);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
var scheduleMicrotaskCompat = typeof queueMicrotask === "function" ? queueMicrotask : (cb) => {
|
|
88
|
+
Promise.resolve().then(cb);
|
|
89
|
+
};
|
|
90
|
+
var reportRendererError = (error) => {
|
|
91
|
+
console.error(error);
|
|
92
|
+
};
|
|
93
|
+
var createContainerCompat = (reconciler, container) => {
|
|
94
|
+
const createContainer = reconciler.createContainer;
|
|
95
|
+
if (createContainer.length <= 4) {
|
|
96
|
+
return createContainer(container, 0, false, null);
|
|
97
|
+
}
|
|
98
|
+
return createContainer(
|
|
99
|
+
container,
|
|
100
|
+
0,
|
|
101
|
+
null,
|
|
102
|
+
false,
|
|
103
|
+
null,
|
|
104
|
+
"",
|
|
105
|
+
reportRendererError,
|
|
106
|
+
reportRendererError,
|
|
107
|
+
reportRendererError,
|
|
108
|
+
null
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
var ROOT_HOST_CONTEXT = {};
|
|
112
|
+
var hostConfig = ({ componentNamespaces }) => {
|
|
73
113
|
const processedNamespaces = {};
|
|
74
114
|
for (const namespace of componentNamespaces) {
|
|
75
115
|
if (processedNamespaces[namespace._namespace]) {
|
|
@@ -77,12 +117,17 @@ var hostConfig = ({
|
|
|
77
117
|
}
|
|
78
118
|
processedNamespaces[namespace._namespace] = namespace;
|
|
79
119
|
}
|
|
80
|
-
|
|
120
|
+
const hostTransitionContext = React2.createContext(null);
|
|
121
|
+
let currentUpdatePriority = DefaultEventPriority;
|
|
122
|
+
const config = {
|
|
81
123
|
supportsMutation: true,
|
|
82
124
|
supportsPersistence: false,
|
|
83
125
|
noTimeout: -1,
|
|
84
126
|
isPrimaryRenderer: true,
|
|
85
127
|
supportsHydration: false,
|
|
128
|
+
supportsMicrotasks: true,
|
|
129
|
+
NotPendingTransition: null,
|
|
130
|
+
HostTransitionContext: hostTransitionContext,
|
|
86
131
|
afterActiveInstanceBlur: () => null,
|
|
87
132
|
appendChild: (parentInstance, child) => {
|
|
88
133
|
if (parentInstance instanceof BaseParent) {
|
|
@@ -104,14 +149,23 @@ var hostConfig = ({
|
|
|
104
149
|
beforeActiveInstanceBlur: () => null,
|
|
105
150
|
cancelTimeout: (id) => clearTimeout(id),
|
|
106
151
|
clearContainer: (container) => container.removeAllChildren(),
|
|
107
|
-
commitMount: () => {
|
|
152
|
+
commitMount: (_instance, _type, _props) => {
|
|
108
153
|
throw new Error(`Unexpected call to commitMount()`);
|
|
109
154
|
},
|
|
110
|
-
commitUpdate(instance,
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
155
|
+
commitUpdate(instance, ...args) {
|
|
156
|
+
if (typeof args[0] === "string") {
|
|
157
|
+
const nextProps2 = args[2];
|
|
158
|
+
setInstanceProps(instance, getPropsToSet(nextProps2));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const updatePayload = args[0];
|
|
162
|
+
if (updatePayload) {
|
|
163
|
+
setInstanceProps(instance, updatePayload);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const nextProps = args[3];
|
|
167
|
+
if (nextProps) {
|
|
168
|
+
setInstanceProps(instance, getPropsToSet(nextProps));
|
|
115
169
|
}
|
|
116
170
|
},
|
|
117
171
|
commitTextUpdate: (textInstance, _oldText, newText) => textInstance.setText(newText),
|
|
@@ -137,6 +191,7 @@ var hostConfig = ({
|
|
|
137
191
|
detachDeletedInstance: () => null,
|
|
138
192
|
getChildHostContext: (parentHostContext) => parentHostContext,
|
|
139
193
|
getCurrentEventPriority: () => DefaultEventPriority,
|
|
194
|
+
getCurrentUpdatePriority: () => currentUpdatePriority,
|
|
140
195
|
getInstanceFromNode: () => {
|
|
141
196
|
throw new Error("Not yet implemented.");
|
|
142
197
|
},
|
|
@@ -144,7 +199,7 @@ var hostConfig = ({
|
|
|
144
199
|
throw new Error("Not yet implemented.");
|
|
145
200
|
},
|
|
146
201
|
getPublicInstance: (instance) => instance,
|
|
147
|
-
getRootHostContext: () =>
|
|
202
|
+
getRootHostContext: () => ROOT_HOST_CONTEXT,
|
|
148
203
|
insertBefore: (parentInstance, child, beforeChild) => {
|
|
149
204
|
if (parentInstance instanceof BaseParent) {
|
|
150
205
|
parentInstance.insertBefore(child, beforeChild);
|
|
@@ -154,21 +209,17 @@ var hostConfig = ({
|
|
|
154
209
|
},
|
|
155
210
|
insertInContainerBefore: (container, child, beforeChild) => container.insertBefore(child, beforeChild),
|
|
156
211
|
finalizeInitialChildren: () => false,
|
|
212
|
+
maySuspendCommit: () => false,
|
|
213
|
+
preloadInstance: () => false,
|
|
157
214
|
prepareForCommit: () => null,
|
|
158
215
|
preparePortalMount: () => null,
|
|
159
216
|
prepareScopeUpdate: () => null,
|
|
160
217
|
prepareUpdate: (_instance, _type, _oldProps, newProps, _rootContainer, _hostContext) => {
|
|
161
|
-
const updates =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
if (Object.keys(updates).length) {
|
|
168
|
-
return updates;
|
|
169
|
-
} else {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
218
|
+
const updates = getPropsToSet(newProps);
|
|
219
|
+
return Object.keys(updates).length ? updates : null;
|
|
220
|
+
},
|
|
221
|
+
requestPostPaintCallback: (callback) => {
|
|
222
|
+
setTimeout(() => callback(Date.now()), 0);
|
|
172
223
|
},
|
|
173
224
|
removeChild(parentInstance, child) {
|
|
174
225
|
if (parentInstance instanceof BaseParent) {
|
|
@@ -182,31 +233,36 @@ var hostConfig = ({
|
|
|
182
233
|
resetTextContent: () => {
|
|
183
234
|
throw new Error(`Unexpected call to resetTextContent()`);
|
|
184
235
|
},
|
|
236
|
+
resetFormInstance: () => null,
|
|
237
|
+
resolveEventTimeStamp: () => Date.now(),
|
|
238
|
+
resolveEventType: () => null,
|
|
239
|
+
resolveUpdatePriority: () => currentUpdatePriority,
|
|
185
240
|
scheduleTimeout: (fn, delay) => setTimeout(fn, delay),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
console.log("Not-implemented: hideInstance");
|
|
190
|
-
},
|
|
191
|
-
hideTextInstance: () => {
|
|
192
|
-
console.log("Not-implemented: hideTextInstance");
|
|
193
|
-
},
|
|
194
|
-
unhideInstance: () => {
|
|
195
|
-
console.log("Not-implemented: unhideInstance");
|
|
241
|
+
scheduleMicrotask: scheduleMicrotaskCompat,
|
|
242
|
+
setCurrentUpdatePriority: (newPriority) => {
|
|
243
|
+
currentUpdatePriority = newPriority;
|
|
196
244
|
},
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
245
|
+
shouldAttemptEagerTransition: () => false,
|
|
246
|
+
shouldSetTextContent: () => false,
|
|
247
|
+
startSuspendingCommit: () => null,
|
|
248
|
+
suspendInstance: () => null,
|
|
249
|
+
trackSchedulerEvent: () => null,
|
|
250
|
+
waitForCommitToBeReady: () => null,
|
|
251
|
+
hideInstance: () => null,
|
|
252
|
+
hideTextInstance: () => null,
|
|
253
|
+
unhideInstance: () => null,
|
|
254
|
+
unhideTextInstance: () => null
|
|
200
255
|
};
|
|
256
|
+
return config;
|
|
201
257
|
};
|
|
202
258
|
var ToolkitRenderer = {
|
|
203
259
|
renderGroup: (component, container, config = {
|
|
204
260
|
componentNamespaces: [CoreComponents]
|
|
205
261
|
}) => {
|
|
206
262
|
const reconciler = Reconciler(hostConfig(config));
|
|
207
|
-
const root = reconciler
|
|
263
|
+
const root = createContainerCompat(reconciler, container);
|
|
208
264
|
const componentWithContexts = /* @__PURE__ */ jsx(LoggerContext.Provider, { value: container.log, children: component });
|
|
209
|
-
reconciler.updateContainer(componentWithContexts, root, null);
|
|
265
|
+
reconciler.updateContainer(componentWithContexts, root, null, void 0);
|
|
210
266
|
},
|
|
211
267
|
render: (component, container, rootGroupProps, config = {
|
|
212
268
|
componentNamespaces: [CoreComponents]
|
package/dist/colors.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkEJVUDIQPjs = require('./chunk-EJVUDIQP.js');
|
|
6
6
|
require('./chunk-RT2VSMJL.js');
|
|
7
7
|
|
|
8
8
|
// src/colors.tsx
|
|
@@ -56,10 +56,10 @@ var HslColorPicker = ({
|
|
|
56
56
|
},
|
|
57
57
|
[onChange]
|
|
58
58
|
);
|
|
59
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
60
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
59
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJVUDIQPjs.Group, { ...DEFAULT_GROUP_PROPS, ...groupProps, children: [
|
|
60
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJVUDIQPjs.Rect, { color: `hsl(${hue}deg ${saturation}% ${lightness}% / ${alpha})` }),
|
|
61
61
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
62
|
-
|
|
62
|
+
_chunkEJVUDIQPjs.SliderButton,
|
|
63
63
|
{
|
|
64
64
|
value: hue,
|
|
65
65
|
onChange: setHue,
|
|
@@ -71,7 +71,7 @@ var HslColorPicker = ({
|
|
|
71
71
|
}
|
|
72
72
|
),
|
|
73
73
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
74
|
-
|
|
74
|
+
_chunkEJVUDIQPjs.SliderButton,
|
|
75
75
|
{
|
|
76
76
|
value: saturation,
|
|
77
77
|
onChange: setSat,
|
|
@@ -87,7 +87,7 @@ var HslColorPicker = ({
|
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
89
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
|
-
|
|
90
|
+
_chunkEJVUDIQPjs.SliderButton,
|
|
91
91
|
{
|
|
92
92
|
value: lightness,
|
|
93
93
|
onChange: setLightness,
|
|
@@ -103,7 +103,7 @@ var HslColorPicker = ({
|
|
|
103
103
|
}
|
|
104
104
|
),
|
|
105
105
|
showAlpha && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
106
|
-
|
|
106
|
+
_chunkEJVUDIQPjs.SliderButton,
|
|
107
107
|
{
|
|
108
108
|
value: alpha,
|
|
109
109
|
onChange: setAlpha,
|
package/dist/colors.mjs
CHANGED
package/dist/data.d.mts
CHANGED
|
@@ -17,6 +17,8 @@ type DataFileUsage = WithPathChange & {
|
|
|
17
17
|
* this will be relative to the current working directory.
|
|
18
18
|
*/
|
|
19
19
|
path: string;
|
|
20
|
+
/** Callback that will be called if any error occurs during loading or saving the file */
|
|
21
|
+
onError?: (error: ArcaneDataFileError) => void;
|
|
20
22
|
};
|
|
21
23
|
type ProviderProps = DataFileUsage & {
|
|
22
24
|
children: ReactNode;
|
|
@@ -93,10 +95,18 @@ type DataState<T> = {
|
|
|
93
95
|
status: 'ready';
|
|
94
96
|
data: T;
|
|
95
97
|
});
|
|
98
|
+
type DataFileOperation = 'load' | 'save' | 'usage';
|
|
99
|
+
declare class ArcaneDataFileError extends Error {
|
|
100
|
+
readonly operation: DataFileOperation;
|
|
101
|
+
readonly path: string | null;
|
|
102
|
+
constructor(message: string, operation: DataFileOperation, path: string | null, cause?: unknown);
|
|
103
|
+
}
|
|
104
|
+
type ErrorListener = (error: ArcaneDataFileError) => void;
|
|
96
105
|
type UseDataFileCoreProps<T> = WithPathChange & {
|
|
97
106
|
schema: ZodType<T>;
|
|
98
107
|
defaultValue: T;
|
|
99
108
|
path: string;
|
|
109
|
+
onError?: (error: ArcaneDataFileError) => void;
|
|
100
110
|
};
|
|
101
111
|
type DataFileCore<T> = {
|
|
102
112
|
data: DataState<T>;
|
|
@@ -106,11 +116,11 @@ type DataFileCore<T> = {
|
|
|
106
116
|
/**
|
|
107
117
|
* Primary hook for & logic for using data files.
|
|
108
118
|
*/
|
|
109
|
-
declare function useDataFileCore<T>({ schema, defaultValue, path, onPathChange, }: UseDataFileCoreProps<T>): DataFileCore<T>;
|
|
119
|
+
declare function useDataFileCore<T>({ schema, defaultValue, path, onPathChange, onError, }: UseDataFileCoreProps<T>): DataFileCore<T>;
|
|
110
120
|
type CreateDataFileDefinitionProps<T extends ZodType> = {
|
|
111
121
|
schema: T;
|
|
112
122
|
defaultValue: z.infer<T>;
|
|
113
123
|
};
|
|
114
124
|
declare function createDataFileDefinition<T extends ZodType>({ schema, defaultValue, }: CreateDataFileDefinitionProps<T>): DataFileDefinition<z.infer<T>>;
|
|
115
125
|
|
|
116
|
-
export { type CreateDataFileDefinitionProps, type DataFileContext, type DataFileCore, type DataFileDefinition, type DataFileUpdater, type DataState, type ProviderProps, type UseDataFileCoreProps, createDataFileDefinition, useDataFile, useDataFileContext, useDataFileCore, useDataFileData, useDataFileUpdater };
|
|
126
|
+
export { ArcaneDataFileError, type CreateDataFileDefinitionProps, type DataFileContext, type DataFileCore, type DataFileDefinition, type DataFileOperation, type DataFileUpdater, type DataState, type ErrorListener, type ProviderProps, type UseDataFileCoreProps, createDataFileDefinition, useDataFile, useDataFileContext, useDataFileCore, useDataFileData, useDataFileUpdater };
|
package/dist/data.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ type DataFileUsage = WithPathChange & {
|
|
|
17
17
|
* this will be relative to the current working directory.
|
|
18
18
|
*/
|
|
19
19
|
path: string;
|
|
20
|
+
/** Callback that will be called if any error occurs during loading or saving the file */
|
|
21
|
+
onError?: (error: ArcaneDataFileError) => void;
|
|
20
22
|
};
|
|
21
23
|
type ProviderProps = DataFileUsage & {
|
|
22
24
|
children: ReactNode;
|
|
@@ -93,10 +95,18 @@ type DataState<T> = {
|
|
|
93
95
|
status: 'ready';
|
|
94
96
|
data: T;
|
|
95
97
|
});
|
|
98
|
+
type DataFileOperation = 'load' | 'save' | 'usage';
|
|
99
|
+
declare class ArcaneDataFileError extends Error {
|
|
100
|
+
readonly operation: DataFileOperation;
|
|
101
|
+
readonly path: string | null;
|
|
102
|
+
constructor(message: string, operation: DataFileOperation, path: string | null, cause?: unknown);
|
|
103
|
+
}
|
|
104
|
+
type ErrorListener = (error: ArcaneDataFileError) => void;
|
|
96
105
|
type UseDataFileCoreProps<T> = WithPathChange & {
|
|
97
106
|
schema: ZodType<T>;
|
|
98
107
|
defaultValue: T;
|
|
99
108
|
path: string;
|
|
109
|
+
onError?: (error: ArcaneDataFileError) => void;
|
|
100
110
|
};
|
|
101
111
|
type DataFileCore<T> = {
|
|
102
112
|
data: DataState<T>;
|
|
@@ -106,11 +116,11 @@ type DataFileCore<T> = {
|
|
|
106
116
|
/**
|
|
107
117
|
* Primary hook for & logic for using data files.
|
|
108
118
|
*/
|
|
109
|
-
declare function useDataFileCore<T>({ schema, defaultValue, path, onPathChange, }: UseDataFileCoreProps<T>): DataFileCore<T>;
|
|
119
|
+
declare function useDataFileCore<T>({ schema, defaultValue, path, onPathChange, onError, }: UseDataFileCoreProps<T>): DataFileCore<T>;
|
|
110
120
|
type CreateDataFileDefinitionProps<T extends ZodType> = {
|
|
111
121
|
schema: T;
|
|
112
122
|
defaultValue: z.infer<T>;
|
|
113
123
|
};
|
|
114
124
|
declare function createDataFileDefinition<T extends ZodType>({ schema, defaultValue, }: CreateDataFileDefinitionProps<T>): DataFileDefinition<z.infer<T>>;
|
|
115
125
|
|
|
116
|
-
export { type CreateDataFileDefinitionProps, type DataFileContext, type DataFileCore, type DataFileDefinition, type DataFileUpdater, type DataState, type ProviderProps, type UseDataFileCoreProps, createDataFileDefinition, useDataFile, useDataFileContext, useDataFileCore, useDataFileData, useDataFileUpdater };
|
|
126
|
+
export { ArcaneDataFileError, type CreateDataFileDefinitionProps, type DataFileContext, type DataFileCore, type DataFileDefinition, type DataFileOperation, type DataFileUpdater, type DataState, type ErrorListener, type ProviderProps, type UseDataFileCoreProps, createDataFileDefinition, useDataFile, useDataFileContext, useDataFileCore, useDataFileData, useDataFileUpdater };
|