@valbuild/react 0.91.3 → 0.92.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/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2025 Fredrik Ekholdt and Blank AS
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -153,6 +153,97 @@ function _toConsumableArray(r) {
153
153
  * RichText is accessible by users (after conversion via useVal / fetchVal)
154
154
  **/
155
155
 
156
+ /**
157
+ * Resolves the matching sub-schema for a tagged union based on the discriminator key.
158
+ * Returns the matching schema or null if no match is found.
159
+ */
160
+ function resolveTaggedUnionSchema(source, schema) {
161
+ var schemaKey = schema.key;
162
+ if (typeof schemaKey !== "string") {
163
+ return null;
164
+ }
165
+ if (!source || slicedToArray._typeof(source) !== "object" || Array.isArray(source)) {
166
+ return null;
167
+ }
168
+ var key = source[schemaKey];
169
+ if (!key || typeof key !== "string") {
170
+ return null;
171
+ }
172
+ var matchingSchema = schema.items.find(function (s) {
173
+ if (isObjectSchema(s) && s.items && s.items[schemaKey]) {
174
+ var keySchema = s.items[schemaKey];
175
+ if (isLiteralSchema(keySchema)) {
176
+ return keySchema.value === key;
177
+ } else {
178
+ console.warn("Expected literal schema at key in union, but found: ", keySchema, {
179
+ key: key,
180
+ schema: s
181
+ });
182
+ }
183
+ } else {
184
+ console.warn("Expected union containing object schema, but found: ", s);
185
+ }
186
+ return false;
187
+ });
188
+ return matchingSchema || null;
189
+ }
190
+
191
+ /**
192
+ * Resolves the matching sub-schema for a literal union (string-based).
193
+ * Returns the matching schema or null if no match is found.
194
+ */
195
+ function resolveLiteralUnionSchema(source, schema) {
196
+ var _ref;
197
+ if (typeof schema.key === "string") {
198
+ return null; // Not a literal union
199
+ }
200
+ var matchingSchema = (_ref = [schema.key]).concat.apply(_ref, _toConsumableArray(schema.items)).find(function (s) {
201
+ if (isLiteralSchema(s)) {
202
+ return s.value === source;
203
+ }
204
+ return false;
205
+ });
206
+ return matchingSchema || null;
207
+ }
208
+
209
+ /**
210
+ * Handles richtext schema traversal with callback support.
211
+ * Processes richtext structures (string, array, or object format).
212
+ */
213
+ function handleRichTextSchema(sourceOrSelector, recOpts, rec) {
214
+ if (typeof sourceOrSelector === "string") {
215
+ return rec(sourceOrSelector, {
216
+ path: recOpts.path,
217
+ schema: {
218
+ type: "string"
219
+ }
220
+ });
221
+ }
222
+ if (Array.isArray(sourceOrSelector)) {
223
+ var arraySelector = sourceOrSelector.map(function (el) {
224
+ return rec(el, {
225
+ path: recOpts.path,
226
+ schema: recOpts.schema
227
+ });
228
+ });
229
+ return arraySelector;
230
+ } else if (slicedToArray._typeof(sourceOrSelector) === "object") {
231
+ if (!sourceOrSelector) {
232
+ return null;
233
+ }
234
+ var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
235
+ var _ref3 = slicedToArray._slicedToArray(_ref2, 2),
236
+ key = _ref3[0],
237
+ value = _ref3[1];
238
+ return [key, key === "tag" || key === "styles" ? value : rec(value, {
239
+ path: recOpts.path,
240
+ schema: recOpts.schema
241
+ })];
242
+ }));
243
+ return richtextSelector;
244
+ }
245
+ return sourceOrSelector;
246
+ }
156
247
  function stegaEncode(input, opts) {
157
248
  function rec(sourceOrSelector, recOpts) {
158
249
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isKeyOfSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
@@ -165,81 +256,30 @@ function stegaEncode(input, opts) {
165
256
  return sourceOrSelector;
166
257
  }
167
258
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
168
- if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
169
- var _key = sourceOrSelector[recOpts.schema.key];
170
- if (_key) {
171
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
- var schema = recOpts.schema.items.find(function (s) {
173
- if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
174
- var keySchema = s.items[recOpts.schema.key];
175
- if (isLiteralSchema(keySchema)) {
176
- return keySchema.value === _key;
177
- } else {
178
- console.warn("Expected literal schema at key in , but found: ", keySchema, {
179
- key: _key,
180
- schema: s
181
- });
182
- }
183
- } else {
184
- console.warn("Expected union containing object schema, but found: ", s);
185
- }
186
- });
187
- if (schema) {
188
- return rec(sourceOrSelector, {
189
- path: recOpts.path,
190
- schema: schema
191
- });
192
- }
193
- }
194
- // illegal value, return as is
195
- return sourceOrSelector;
196
- }
197
- if (typeof sourceOrSelector === "string" && recOpts.schema.key && typeof recOpts.schema.key !== "string") {
198
- var _ref;
259
+ // Handle tagged union
260
+ var taggedSchema = resolveTaggedUnionSchema(sourceOrSelector, recOpts.schema);
261
+ if (taggedSchema) {
199
262
  return rec(sourceOrSelector, {
200
263
  path: recOpts.path,
201
- schema: (_ref = [recOpts.schema.key]).concat.apply(_ref, _toConsumableArray(recOpts.schema.items)).find(function (s) {
202
- if (isLiteralSchema(s)) {
203
- return s.value === sourceOrSelector;
204
- }
205
- })
264
+ schema: taggedSchema
206
265
  });
207
266
  }
208
- }
209
- if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
267
+ // Handle literal union
210
268
  if (typeof sourceOrSelector === "string") {
211
- return rec(sourceOrSelector, {
212
- path: recOpts.path,
213
- schema: {
214
- type: "string"
215
- }
216
- });
217
- }
218
- if (Array.isArray(sourceOrSelector)) {
219
- var arraySelector = sourceOrSelector.map(function (el) {
220
- return rec(el, {
269
+ var literalSchema = resolveLiteralUnionSchema(sourceOrSelector, recOpts.schema);
270
+ if (literalSchema) {
271
+ return rec(sourceOrSelector, {
221
272
  path: recOpts.path,
222
- schema: recOpts.schema
273
+ schema: literalSchema
223
274
  });
224
- });
225
- return arraySelector;
226
- } else if (slicedToArray._typeof(sourceOrSelector) === "object") {
227
- if (!sourceOrSelector) {
228
- return null;
229
275
  }
230
- var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
231
- var _ref3 = slicedToArray._slicedToArray(_ref2, 2),
232
- key = _ref3[0],
233
- value = _ref3[1];
234
- return [key, key === "tag" || key === "styles" ? value : rec(value, {
235
- path: recOpts.path,
236
- schema: recOpts.schema
237
- })];
238
- }));
239
- return richtextSelector;
240
276
  }
277
+ // No match found, return as is
241
278
  return sourceOrSelector;
242
279
  }
280
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
281
+ return handleRichTextSchema(sourceOrSelector, recOpts, rec);
282
+ }
243
283
  if (slicedToArray._typeof(sourceOrSelector) === "object") {
244
284
  if (!sourceOrSelector) {
245
285
  return null;
@@ -282,11 +322,11 @@ function stegaEncode(input, opts) {
282
322
  var entries = Object.entries(sourceOrSelector);
283
323
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
284
324
  var _entries$_i = slicedToArray._slicedToArray(_entries[_i], 2),
285
- _key2 = _entries$_i[0],
325
+ _key = _entries$_i[0],
286
326
  value = _entries$_i[1];
287
- res[_key2] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
288
- path: core.Internal.createValPathOfItem(recOpts.path, _key2),
289
- schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key2] : unknownSchema(recOpts.schema)
327
+ res[_key] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
328
+ path: core.Internal.createValPathOfItem(recOpts.path, _key),
329
+ schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key] : unknownSchema(recOpts.schema)
290
330
  });
291
331
  }
292
332
  return res;
@@ -151,6 +151,97 @@ function _toConsumableArray(r) {
151
151
  * RichText is accessible by users (after conversion via useVal / fetchVal)
152
152
  **/
153
153
 
154
+ /**
155
+ * Resolves the matching sub-schema for a tagged union based on the discriminator key.
156
+ * Returns the matching schema or null if no match is found.
157
+ */
158
+ function resolveTaggedUnionSchema(source, schema) {
159
+ var schemaKey = schema.key;
160
+ if (typeof schemaKey !== "string") {
161
+ return null;
162
+ }
163
+ if (!source || _typeof(source) !== "object" || Array.isArray(source)) {
164
+ return null;
165
+ }
166
+ var key = source[schemaKey];
167
+ if (!key || typeof key !== "string") {
168
+ return null;
169
+ }
170
+ var matchingSchema = schema.items.find(function (s) {
171
+ if (isObjectSchema(s) && s.items && s.items[schemaKey]) {
172
+ var keySchema = s.items[schemaKey];
173
+ if (isLiteralSchema(keySchema)) {
174
+ return keySchema.value === key;
175
+ } else {
176
+ console.warn("Expected literal schema at key in union, but found: ", keySchema, {
177
+ key: key,
178
+ schema: s
179
+ });
180
+ }
181
+ } else {
182
+ console.warn("Expected union containing object schema, but found: ", s);
183
+ }
184
+ return false;
185
+ });
186
+ return matchingSchema || null;
187
+ }
188
+
189
+ /**
190
+ * Resolves the matching sub-schema for a literal union (string-based).
191
+ * Returns the matching schema or null if no match is found.
192
+ */
193
+ function resolveLiteralUnionSchema(source, schema) {
194
+ var _ref;
195
+ if (typeof schema.key === "string") {
196
+ return null; // Not a literal union
197
+ }
198
+ var matchingSchema = (_ref = [schema.key]).concat.apply(_ref, _toConsumableArray(schema.items)).find(function (s) {
199
+ if (isLiteralSchema(s)) {
200
+ return s.value === source;
201
+ }
202
+ return false;
203
+ });
204
+ return matchingSchema || null;
205
+ }
206
+
207
+ /**
208
+ * Handles richtext schema traversal with callback support.
209
+ * Processes richtext structures (string, array, or object format).
210
+ */
211
+ function handleRichTextSchema(sourceOrSelector, recOpts, rec) {
212
+ if (typeof sourceOrSelector === "string") {
213
+ return rec(sourceOrSelector, {
214
+ path: recOpts.path,
215
+ schema: {
216
+ type: "string"
217
+ }
218
+ });
219
+ }
220
+ if (Array.isArray(sourceOrSelector)) {
221
+ var arraySelector = sourceOrSelector.map(function (el) {
222
+ return rec(el, {
223
+ path: recOpts.path,
224
+ schema: recOpts.schema
225
+ });
226
+ });
227
+ return arraySelector;
228
+ } else if (_typeof(sourceOrSelector) === "object") {
229
+ if (!sourceOrSelector) {
230
+ return null;
231
+ }
232
+ var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
233
+ var _ref3 = _slicedToArray(_ref2, 2),
234
+ key = _ref3[0],
235
+ value = _ref3[1];
236
+ return [key, key === "tag" || key === "styles" ? value : rec(value, {
237
+ path: recOpts.path,
238
+ schema: recOpts.schema
239
+ })];
240
+ }));
241
+ return richtextSelector;
242
+ }
243
+ return sourceOrSelector;
244
+ }
154
245
  function stegaEncode(input, opts) {
155
246
  function rec(sourceOrSelector, recOpts) {
156
247
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isKeyOfSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
@@ -163,81 +254,30 @@ function stegaEncode(input, opts) {
163
254
  return sourceOrSelector;
164
255
  }
165
256
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
166
- if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
167
- var _key = sourceOrSelector[recOpts.schema.key];
168
- if (_key) {
169
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
- var schema = recOpts.schema.items.find(function (s) {
171
- if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
172
- var keySchema = s.items[recOpts.schema.key];
173
- if (isLiteralSchema(keySchema)) {
174
- return keySchema.value === _key;
175
- } else {
176
- console.warn("Expected literal schema at key in , but found: ", keySchema, {
177
- key: _key,
178
- schema: s
179
- });
180
- }
181
- } else {
182
- console.warn("Expected union containing object schema, but found: ", s);
183
- }
184
- });
185
- if (schema) {
186
- return rec(sourceOrSelector, {
187
- path: recOpts.path,
188
- schema: schema
189
- });
190
- }
191
- }
192
- // illegal value, return as is
193
- return sourceOrSelector;
194
- }
195
- if (typeof sourceOrSelector === "string" && recOpts.schema.key && typeof recOpts.schema.key !== "string") {
196
- var _ref;
257
+ // Handle tagged union
258
+ var taggedSchema = resolveTaggedUnionSchema(sourceOrSelector, recOpts.schema);
259
+ if (taggedSchema) {
197
260
  return rec(sourceOrSelector, {
198
261
  path: recOpts.path,
199
- schema: (_ref = [recOpts.schema.key]).concat.apply(_ref, _toConsumableArray(recOpts.schema.items)).find(function (s) {
200
- if (isLiteralSchema(s)) {
201
- return s.value === sourceOrSelector;
202
- }
203
- })
262
+ schema: taggedSchema
204
263
  });
205
264
  }
206
- }
207
- if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
265
+ // Handle literal union
208
266
  if (typeof sourceOrSelector === "string") {
209
- return rec(sourceOrSelector, {
210
- path: recOpts.path,
211
- schema: {
212
- type: "string"
213
- }
214
- });
215
- }
216
- if (Array.isArray(sourceOrSelector)) {
217
- var arraySelector = sourceOrSelector.map(function (el) {
218
- return rec(el, {
267
+ var literalSchema = resolveLiteralUnionSchema(sourceOrSelector, recOpts.schema);
268
+ if (literalSchema) {
269
+ return rec(sourceOrSelector, {
219
270
  path: recOpts.path,
220
- schema: recOpts.schema
271
+ schema: literalSchema
221
272
  });
222
- });
223
- return arraySelector;
224
- } else if (_typeof(sourceOrSelector) === "object") {
225
- if (!sourceOrSelector) {
226
- return null;
227
273
  }
228
- var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
229
- var _ref3 = _slicedToArray(_ref2, 2),
230
- key = _ref3[0],
231
- value = _ref3[1];
232
- return [key, key === "tag" || key === "styles" ? value : rec(value, {
233
- path: recOpts.path,
234
- schema: recOpts.schema
235
- })];
236
- }));
237
- return richtextSelector;
238
274
  }
275
+ // No match found, return as is
239
276
  return sourceOrSelector;
240
277
  }
278
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
279
+ return handleRichTextSchema(sourceOrSelector, recOpts, rec);
280
+ }
241
281
  if (_typeof(sourceOrSelector) === "object") {
242
282
  if (!sourceOrSelector) {
243
283
  return null;
@@ -280,11 +320,11 @@ function stegaEncode(input, opts) {
280
320
  var entries = Object.entries(sourceOrSelector);
281
321
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
282
322
  var _entries$_i = _slicedToArray(_entries[_i], 2),
283
- _key2 = _entries$_i[0],
323
+ _key = _entries$_i[0],
284
324
  value = _entries$_i[1];
285
- res[_key2] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
286
- path: Internal.createValPathOfItem(recOpts.path, _key2),
287
- schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key2] : unknownSchema(recOpts.schema)
325
+ res[_key] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
326
+ path: Internal.createValPathOfItem(recOpts.path, _key),
327
+ schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key] : unknownSchema(recOpts.schema)
288
328
  });
289
329
  }
290
330
  return res;
@@ -153,6 +153,97 @@ function _toConsumableArray(r) {
153
153
  * RichText is accessible by users (after conversion via useVal / fetchVal)
154
154
  **/
155
155
 
156
+ /**
157
+ * Resolves the matching sub-schema for a tagged union based on the discriminator key.
158
+ * Returns the matching schema or null if no match is found.
159
+ */
160
+ function resolveTaggedUnionSchema(source, schema) {
161
+ var schemaKey = schema.key;
162
+ if (typeof schemaKey !== "string") {
163
+ return null;
164
+ }
165
+ if (!source || slicedToArray._typeof(source) !== "object" || Array.isArray(source)) {
166
+ return null;
167
+ }
168
+ var key = source[schemaKey];
169
+ if (!key || typeof key !== "string") {
170
+ return null;
171
+ }
172
+ var matchingSchema = schema.items.find(function (s) {
173
+ if (isObjectSchema(s) && s.items && s.items[schemaKey]) {
174
+ var keySchema = s.items[schemaKey];
175
+ if (isLiteralSchema(keySchema)) {
176
+ return keySchema.value === key;
177
+ } else {
178
+ console.warn("Expected literal schema at key in union, but found: ", keySchema, {
179
+ key: key,
180
+ schema: s
181
+ });
182
+ }
183
+ } else {
184
+ console.warn("Expected union containing object schema, but found: ", s);
185
+ }
186
+ return false;
187
+ });
188
+ return matchingSchema || null;
189
+ }
190
+
191
+ /**
192
+ * Resolves the matching sub-schema for a literal union (string-based).
193
+ * Returns the matching schema or null if no match is found.
194
+ */
195
+ function resolveLiteralUnionSchema(source, schema) {
196
+ var _ref;
197
+ if (typeof schema.key === "string") {
198
+ return null; // Not a literal union
199
+ }
200
+ var matchingSchema = (_ref = [schema.key]).concat.apply(_ref, _toConsumableArray(schema.items)).find(function (s) {
201
+ if (isLiteralSchema(s)) {
202
+ return s.value === source;
203
+ }
204
+ return false;
205
+ });
206
+ return matchingSchema || null;
207
+ }
208
+
209
+ /**
210
+ * Handles richtext schema traversal with callback support.
211
+ * Processes richtext structures (string, array, or object format).
212
+ */
213
+ function handleRichTextSchema(sourceOrSelector, recOpts, rec) {
214
+ if (typeof sourceOrSelector === "string") {
215
+ return rec(sourceOrSelector, {
216
+ path: recOpts.path,
217
+ schema: {
218
+ type: "string"
219
+ }
220
+ });
221
+ }
222
+ if (Array.isArray(sourceOrSelector)) {
223
+ var arraySelector = sourceOrSelector.map(function (el) {
224
+ return rec(el, {
225
+ path: recOpts.path,
226
+ schema: recOpts.schema
227
+ });
228
+ });
229
+ return arraySelector;
230
+ } else if (slicedToArray._typeof(sourceOrSelector) === "object") {
231
+ if (!sourceOrSelector) {
232
+ return null;
233
+ }
234
+ var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
235
+ var _ref3 = slicedToArray._slicedToArray(_ref2, 2),
236
+ key = _ref3[0],
237
+ value = _ref3[1];
238
+ return [key, key === "tag" || key === "styles" ? value : rec(value, {
239
+ path: recOpts.path,
240
+ schema: recOpts.schema
241
+ })];
242
+ }));
243
+ return richtextSelector;
244
+ }
245
+ return sourceOrSelector;
246
+ }
156
247
  function stegaEncode(input, opts) {
157
248
  function rec(sourceOrSelector, recOpts) {
158
249
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isKeyOfSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
@@ -165,81 +256,30 @@ function stegaEncode(input, opts) {
165
256
  return sourceOrSelector;
166
257
  }
167
258
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
168
- if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
169
- var _key = sourceOrSelector[recOpts.schema.key];
170
- if (_key) {
171
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
- var schema = recOpts.schema.items.find(function (s) {
173
- if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
174
- var keySchema = s.items[recOpts.schema.key];
175
- if (isLiteralSchema(keySchema)) {
176
- return keySchema.value === _key;
177
- } else {
178
- console.warn("Expected literal schema at key in , but found: ", keySchema, {
179
- key: _key,
180
- schema: s
181
- });
182
- }
183
- } else {
184
- console.warn("Expected union containing object schema, but found: ", s);
185
- }
186
- });
187
- if (schema) {
188
- return rec(sourceOrSelector, {
189
- path: recOpts.path,
190
- schema: schema
191
- });
192
- }
193
- }
194
- // illegal value, return as is
195
- return sourceOrSelector;
196
- }
197
- if (typeof sourceOrSelector === "string" && recOpts.schema.key && typeof recOpts.schema.key !== "string") {
198
- var _ref;
259
+ // Handle tagged union
260
+ var taggedSchema = resolveTaggedUnionSchema(sourceOrSelector, recOpts.schema);
261
+ if (taggedSchema) {
199
262
  return rec(sourceOrSelector, {
200
263
  path: recOpts.path,
201
- schema: (_ref = [recOpts.schema.key]).concat.apply(_ref, _toConsumableArray(recOpts.schema.items)).find(function (s) {
202
- if (isLiteralSchema(s)) {
203
- return s.value === sourceOrSelector;
204
- }
205
- })
264
+ schema: taggedSchema
206
265
  });
207
266
  }
208
- }
209
- if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
267
+ // Handle literal union
210
268
  if (typeof sourceOrSelector === "string") {
211
- return rec(sourceOrSelector, {
212
- path: recOpts.path,
213
- schema: {
214
- type: "string"
215
- }
216
- });
217
- }
218
- if (Array.isArray(sourceOrSelector)) {
219
- var arraySelector = sourceOrSelector.map(function (el) {
220
- return rec(el, {
269
+ var literalSchema = resolveLiteralUnionSchema(sourceOrSelector, recOpts.schema);
270
+ if (literalSchema) {
271
+ return rec(sourceOrSelector, {
221
272
  path: recOpts.path,
222
- schema: recOpts.schema
273
+ schema: literalSchema
223
274
  });
224
- });
225
- return arraySelector;
226
- } else if (slicedToArray._typeof(sourceOrSelector) === "object") {
227
- if (!sourceOrSelector) {
228
- return null;
229
275
  }
230
- var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
231
- var _ref3 = slicedToArray._slicedToArray(_ref2, 2),
232
- key = _ref3[0],
233
- value = _ref3[1];
234
- return [key, key === "tag" || key === "styles" ? value : rec(value, {
235
- path: recOpts.path,
236
- schema: recOpts.schema
237
- })];
238
- }));
239
- return richtextSelector;
240
276
  }
277
+ // No match found, return as is
241
278
  return sourceOrSelector;
242
279
  }
280
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
281
+ return handleRichTextSchema(sourceOrSelector, recOpts, rec);
282
+ }
243
283
  if (slicedToArray._typeof(sourceOrSelector) === "object") {
244
284
  if (!sourceOrSelector) {
245
285
  return null;
@@ -282,11 +322,11 @@ function stegaEncode(input, opts) {
282
322
  var entries = Object.entries(sourceOrSelector);
283
323
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
284
324
  var _entries$_i = slicedToArray._slicedToArray(_entries[_i], 2),
285
- _key2 = _entries$_i[0],
325
+ _key = _entries$_i[0],
286
326
  value = _entries$_i[1];
287
- res[_key2] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
288
- path: core.Internal.createValPathOfItem(recOpts.path, _key2),
289
- schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key2] : unknownSchema(recOpts.schema)
327
+ res[_key] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
328
+ path: core.Internal.createValPathOfItem(recOpts.path, _key),
329
+ schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key] : unknownSchema(recOpts.schema)
290
330
  });
291
331
  }
292
332
  return res;
@@ -151,6 +151,97 @@ function _toConsumableArray(r) {
151
151
  * RichText is accessible by users (after conversion via useVal / fetchVal)
152
152
  **/
153
153
 
154
+ /**
155
+ * Resolves the matching sub-schema for a tagged union based on the discriminator key.
156
+ * Returns the matching schema or null if no match is found.
157
+ */
158
+ function resolveTaggedUnionSchema(source, schema) {
159
+ var schemaKey = schema.key;
160
+ if (typeof schemaKey !== "string") {
161
+ return null;
162
+ }
163
+ if (!source || _typeof(source) !== "object" || Array.isArray(source)) {
164
+ return null;
165
+ }
166
+ var key = source[schemaKey];
167
+ if (!key || typeof key !== "string") {
168
+ return null;
169
+ }
170
+ var matchingSchema = schema.items.find(function (s) {
171
+ if (isObjectSchema(s) && s.items && s.items[schemaKey]) {
172
+ var keySchema = s.items[schemaKey];
173
+ if (isLiteralSchema(keySchema)) {
174
+ return keySchema.value === key;
175
+ } else {
176
+ console.warn("Expected literal schema at key in union, but found: ", keySchema, {
177
+ key: key,
178
+ schema: s
179
+ });
180
+ }
181
+ } else {
182
+ console.warn("Expected union containing object schema, but found: ", s);
183
+ }
184
+ return false;
185
+ });
186
+ return matchingSchema || null;
187
+ }
188
+
189
+ /**
190
+ * Resolves the matching sub-schema for a literal union (string-based).
191
+ * Returns the matching schema or null if no match is found.
192
+ */
193
+ function resolveLiteralUnionSchema(source, schema) {
194
+ var _ref;
195
+ if (typeof schema.key === "string") {
196
+ return null; // Not a literal union
197
+ }
198
+ var matchingSchema = (_ref = [schema.key]).concat.apply(_ref, _toConsumableArray(schema.items)).find(function (s) {
199
+ if (isLiteralSchema(s)) {
200
+ return s.value === source;
201
+ }
202
+ return false;
203
+ });
204
+ return matchingSchema || null;
205
+ }
206
+
207
+ /**
208
+ * Handles richtext schema traversal with callback support.
209
+ * Processes richtext structures (string, array, or object format).
210
+ */
211
+ function handleRichTextSchema(sourceOrSelector, recOpts, rec) {
212
+ if (typeof sourceOrSelector === "string") {
213
+ return rec(sourceOrSelector, {
214
+ path: recOpts.path,
215
+ schema: {
216
+ type: "string"
217
+ }
218
+ });
219
+ }
220
+ if (Array.isArray(sourceOrSelector)) {
221
+ var arraySelector = sourceOrSelector.map(function (el) {
222
+ return rec(el, {
223
+ path: recOpts.path,
224
+ schema: recOpts.schema
225
+ });
226
+ });
227
+ return arraySelector;
228
+ } else if (_typeof(sourceOrSelector) === "object") {
229
+ if (!sourceOrSelector) {
230
+ return null;
231
+ }
232
+ var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
233
+ var _ref3 = _slicedToArray(_ref2, 2),
234
+ key = _ref3[0],
235
+ value = _ref3[1];
236
+ return [key, key === "tag" || key === "styles" ? value : rec(value, {
237
+ path: recOpts.path,
238
+ schema: recOpts.schema
239
+ })];
240
+ }));
241
+ return richtextSelector;
242
+ }
243
+ return sourceOrSelector;
244
+ }
154
245
  function stegaEncode(input, opts) {
155
246
  function rec(sourceOrSelector, recOpts) {
156
247
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isKeyOfSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
@@ -163,81 +254,30 @@ function stegaEncode(input, opts) {
163
254
  return sourceOrSelector;
164
255
  }
165
256
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
166
- if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
167
- var _key = sourceOrSelector[recOpts.schema.key];
168
- if (_key) {
169
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
- var schema = recOpts.schema.items.find(function (s) {
171
- if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
172
- var keySchema = s.items[recOpts.schema.key];
173
- if (isLiteralSchema(keySchema)) {
174
- return keySchema.value === _key;
175
- } else {
176
- console.warn("Expected literal schema at key in , but found: ", keySchema, {
177
- key: _key,
178
- schema: s
179
- });
180
- }
181
- } else {
182
- console.warn("Expected union containing object schema, but found: ", s);
183
- }
184
- });
185
- if (schema) {
186
- return rec(sourceOrSelector, {
187
- path: recOpts.path,
188
- schema: schema
189
- });
190
- }
191
- }
192
- // illegal value, return as is
193
- return sourceOrSelector;
194
- }
195
- if (typeof sourceOrSelector === "string" && recOpts.schema.key && typeof recOpts.schema.key !== "string") {
196
- var _ref;
257
+ // Handle tagged union
258
+ var taggedSchema = resolveTaggedUnionSchema(sourceOrSelector, recOpts.schema);
259
+ if (taggedSchema) {
197
260
  return rec(sourceOrSelector, {
198
261
  path: recOpts.path,
199
- schema: (_ref = [recOpts.schema.key]).concat.apply(_ref, _toConsumableArray(recOpts.schema.items)).find(function (s) {
200
- if (isLiteralSchema(s)) {
201
- return s.value === sourceOrSelector;
202
- }
203
- })
262
+ schema: taggedSchema
204
263
  });
205
264
  }
206
- }
207
- if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
265
+ // Handle literal union
208
266
  if (typeof sourceOrSelector === "string") {
209
- return rec(sourceOrSelector, {
210
- path: recOpts.path,
211
- schema: {
212
- type: "string"
213
- }
214
- });
215
- }
216
- if (Array.isArray(sourceOrSelector)) {
217
- var arraySelector = sourceOrSelector.map(function (el) {
218
- return rec(el, {
267
+ var literalSchema = resolveLiteralUnionSchema(sourceOrSelector, recOpts.schema);
268
+ if (literalSchema) {
269
+ return rec(sourceOrSelector, {
219
270
  path: recOpts.path,
220
- schema: recOpts.schema
271
+ schema: literalSchema
221
272
  });
222
- });
223
- return arraySelector;
224
- } else if (_typeof(sourceOrSelector) === "object") {
225
- if (!sourceOrSelector) {
226
- return null;
227
273
  }
228
- var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
229
- var _ref3 = _slicedToArray(_ref2, 2),
230
- key = _ref3[0],
231
- value = _ref3[1];
232
- return [key, key === "tag" || key === "styles" ? value : rec(value, {
233
- path: recOpts.path,
234
- schema: recOpts.schema
235
- })];
236
- }));
237
- return richtextSelector;
238
274
  }
275
+ // No match found, return as is
239
276
  return sourceOrSelector;
240
277
  }
278
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
279
+ return handleRichTextSchema(sourceOrSelector, recOpts, rec);
280
+ }
241
281
  if (_typeof(sourceOrSelector) === "object") {
242
282
  if (!sourceOrSelector) {
243
283
  return null;
@@ -280,11 +320,11 @@ function stegaEncode(input, opts) {
280
320
  var entries = Object.entries(sourceOrSelector);
281
321
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
282
322
  var _entries$_i = _slicedToArray(_entries[_i], 2),
283
- _key2 = _entries$_i[0],
323
+ _key = _entries$_i[0],
284
324
  value = _entries$_i[1];
285
- res[_key2] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
286
- path: Internal.createValPathOfItem(recOpts.path, _key2),
287
- schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key2] : unknownSchema(recOpts.schema)
325
+ res[_key] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
326
+ path: Internal.createValPathOfItem(recOpts.path, _key),
327
+ schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key] : unknownSchema(recOpts.schema)
288
328
  });
289
329
  }
290
330
  return res;
@@ -151,6 +151,97 @@ function _toConsumableArray(r) {
151
151
  * RichText is accessible by users (after conversion via useVal / fetchVal)
152
152
  **/
153
153
 
154
+ /**
155
+ * Resolves the matching sub-schema for a tagged union based on the discriminator key.
156
+ * Returns the matching schema or null if no match is found.
157
+ */
158
+ function resolveTaggedUnionSchema(source, schema) {
159
+ var schemaKey = schema.key;
160
+ if (typeof schemaKey !== "string") {
161
+ return null;
162
+ }
163
+ if (!source || _typeof(source) !== "object" || Array.isArray(source)) {
164
+ return null;
165
+ }
166
+ var key = source[schemaKey];
167
+ if (!key || typeof key !== "string") {
168
+ return null;
169
+ }
170
+ var matchingSchema = schema.items.find(function (s) {
171
+ if (isObjectSchema(s) && s.items && s.items[schemaKey]) {
172
+ var keySchema = s.items[schemaKey];
173
+ if (isLiteralSchema(keySchema)) {
174
+ return keySchema.value === key;
175
+ } else {
176
+ console.warn("Expected literal schema at key in union, but found: ", keySchema, {
177
+ key: key,
178
+ schema: s
179
+ });
180
+ }
181
+ } else {
182
+ console.warn("Expected union containing object schema, but found: ", s);
183
+ }
184
+ return false;
185
+ });
186
+ return matchingSchema || null;
187
+ }
188
+
189
+ /**
190
+ * Resolves the matching sub-schema for a literal union (string-based).
191
+ * Returns the matching schema or null if no match is found.
192
+ */
193
+ function resolveLiteralUnionSchema(source, schema) {
194
+ var _ref;
195
+ if (typeof schema.key === "string") {
196
+ return null; // Not a literal union
197
+ }
198
+ var matchingSchema = (_ref = [schema.key]).concat.apply(_ref, _toConsumableArray(schema.items)).find(function (s) {
199
+ if (isLiteralSchema(s)) {
200
+ return s.value === source;
201
+ }
202
+ return false;
203
+ });
204
+ return matchingSchema || null;
205
+ }
206
+
207
+ /**
208
+ * Handles richtext schema traversal with callback support.
209
+ * Processes richtext structures (string, array, or object format).
210
+ */
211
+ function handleRichTextSchema(sourceOrSelector, recOpts, rec) {
212
+ if (typeof sourceOrSelector === "string") {
213
+ return rec(sourceOrSelector, {
214
+ path: recOpts.path,
215
+ schema: {
216
+ type: "string"
217
+ }
218
+ });
219
+ }
220
+ if (Array.isArray(sourceOrSelector)) {
221
+ var arraySelector = sourceOrSelector.map(function (el) {
222
+ return rec(el, {
223
+ path: recOpts.path,
224
+ schema: recOpts.schema
225
+ });
226
+ });
227
+ return arraySelector;
228
+ } else if (_typeof(sourceOrSelector) === "object") {
229
+ if (!sourceOrSelector) {
230
+ return null;
231
+ }
232
+ var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
233
+ var _ref3 = _slicedToArray(_ref2, 2),
234
+ key = _ref3[0],
235
+ value = _ref3[1];
236
+ return [key, key === "tag" || key === "styles" ? value : rec(value, {
237
+ path: recOpts.path,
238
+ schema: recOpts.schema
239
+ })];
240
+ }));
241
+ return richtextSelector;
242
+ }
243
+ return sourceOrSelector;
244
+ }
154
245
  function stegaEncode(input, opts) {
155
246
  function rec(sourceOrSelector, recOpts) {
156
247
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isKeyOfSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
@@ -163,81 +254,30 @@ function stegaEncode(input, opts) {
163
254
  return sourceOrSelector;
164
255
  }
165
256
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
166
- if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
167
- var _key = sourceOrSelector[recOpts.schema.key];
168
- if (_key) {
169
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
- var schema = recOpts.schema.items.find(function (s) {
171
- if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
172
- var keySchema = s.items[recOpts.schema.key];
173
- if (isLiteralSchema(keySchema)) {
174
- return keySchema.value === _key;
175
- } else {
176
- console.warn("Expected literal schema at key in , but found: ", keySchema, {
177
- key: _key,
178
- schema: s
179
- });
180
- }
181
- } else {
182
- console.warn("Expected union containing object schema, but found: ", s);
183
- }
184
- });
185
- if (schema) {
186
- return rec(sourceOrSelector, {
187
- path: recOpts.path,
188
- schema: schema
189
- });
190
- }
191
- }
192
- // illegal value, return as is
193
- return sourceOrSelector;
194
- }
195
- if (typeof sourceOrSelector === "string" && recOpts.schema.key && typeof recOpts.schema.key !== "string") {
196
- var _ref;
257
+ // Handle tagged union
258
+ var taggedSchema = resolveTaggedUnionSchema(sourceOrSelector, recOpts.schema);
259
+ if (taggedSchema) {
197
260
  return rec(sourceOrSelector, {
198
261
  path: recOpts.path,
199
- schema: (_ref = [recOpts.schema.key]).concat.apply(_ref, _toConsumableArray(recOpts.schema.items)).find(function (s) {
200
- if (isLiteralSchema(s)) {
201
- return s.value === sourceOrSelector;
202
- }
203
- })
262
+ schema: taggedSchema
204
263
  });
205
264
  }
206
- }
207
- if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
265
+ // Handle literal union
208
266
  if (typeof sourceOrSelector === "string") {
209
- return rec(sourceOrSelector, {
210
- path: recOpts.path,
211
- schema: {
212
- type: "string"
213
- }
214
- });
215
- }
216
- if (Array.isArray(sourceOrSelector)) {
217
- var arraySelector = sourceOrSelector.map(function (el) {
218
- return rec(el, {
267
+ var literalSchema = resolveLiteralUnionSchema(sourceOrSelector, recOpts.schema);
268
+ if (literalSchema) {
269
+ return rec(sourceOrSelector, {
219
270
  path: recOpts.path,
220
- schema: recOpts.schema
271
+ schema: literalSchema
221
272
  });
222
- });
223
- return arraySelector;
224
- } else if (_typeof(sourceOrSelector) === "object") {
225
- if (!sourceOrSelector) {
226
- return null;
227
273
  }
228
- var richtextSelector = Object.fromEntries(Object.entries(sourceOrSelector).map(function (_ref2) {
229
- var _ref3 = _slicedToArray(_ref2, 2),
230
- key = _ref3[0],
231
- value = _ref3[1];
232
- return [key, key === "tag" || key === "styles" ? value : rec(value, {
233
- path: recOpts.path,
234
- schema: recOpts.schema
235
- })];
236
- }));
237
- return richtextSelector;
238
274
  }
275
+ // No match found, return as is
239
276
  return sourceOrSelector;
240
277
  }
278
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isRichTextSchema(recOpts.schema)) {
279
+ return handleRichTextSchema(sourceOrSelector, recOpts, rec);
280
+ }
241
281
  if (_typeof(sourceOrSelector) === "object") {
242
282
  if (!sourceOrSelector) {
243
283
  return null;
@@ -280,11 +320,11 @@ function stegaEncode(input, opts) {
280
320
  var entries = Object.entries(sourceOrSelector);
281
321
  for (var _i = 0, _entries = entries; _i < _entries.length; _i++) {
282
322
  var _entries$_i = _slicedToArray(_entries[_i], 2),
283
- _key2 = _entries$_i[0],
323
+ _key = _entries$_i[0],
284
324
  value = _entries$_i[1];
285
- res[_key2] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
286
- path: Internal.createValPathOfItem(recOpts.path, _key2),
287
- schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key2] : unknownSchema(recOpts.schema)
325
+ res[_key] = rec(value, (recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema) && {
326
+ path: Internal.createValPathOfItem(recOpts.path, _key),
327
+ schema: isRecordSchema(recOpts.schema) ? recOpts.schema.item : isObjectSchema(recOpts.schema) ? recOpts.schema.items[_key] : unknownSchema(recOpts.schema)
288
328
  });
289
329
  }
290
330
  return res;
@@ -1,4 +1,4 @@
1
- import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-851b5dbe.browser.esm.js';
1
+ import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-d86c2721.browser.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import '../../dist/slicedToArray-9cce0d9f.browser.esm.js';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var raw = require('../../dist/raw-e1436cca.cjs.dev.js');
5
+ var raw = require('../../dist/raw-8632c70b.cjs.dev.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
  require('../../dist/slicedToArray-e9e8e991.cjs.dev.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var raw = require('../../dist/raw-95d2506f.cjs.prod.js');
5
+ var raw = require('../../dist/raw-30090bf4.cjs.prod.js');
6
6
  var React = require('react');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
  require('../../dist/slicedToArray-86004d59.cjs.prod.js');
@@ -1,4 +1,4 @@
1
- import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-d3f56a16.esm.js';
1
+ import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-4e13e7bb.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import '../../dist/slicedToArray-0c0a3b4a.esm.js';
@@ -1,4 +1,4 @@
1
- import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-74c5ecab.worker.esm.js';
1
+ import { d as _objectSpread2, r as raw, c as attrs, e as _toConsumableArray } from '../../dist/raw-e3c9e04a.worker.esm.js';
2
2
  import React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import '../../dist/slicedToArray-7d0170b6.worker.esm.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/react",
3
- "version": "0.91.3",
3
+ "version": "0.92.0",
4
4
  "private": false,
5
5
  "description": "Val - React internal helpers",
6
6
  "repository": {
@@ -8,23 +8,20 @@
8
8
  "url": "git+https://github.com/valbuild/val.git"
9
9
  },
10
10
  "sideEffects": false,
11
- "scripts": {
12
- "typecheck": "tsc --noEmit",
13
- "test": "jest"
14
- },
15
11
  "dependencies": {
16
- "@valbuild/core": "~0.91.3",
17
- "@valbuild/shared": "~0.91.3",
18
- "@valbuild/ui": "~0.91.3",
19
12
  "@vercel/stega": "^0.1.0",
20
- "base64-arraybuffer": "^1.0.2"
13
+ "base64-arraybuffer": "^1.0.2",
14
+ "@valbuild/core": "0.92.0",
15
+ "@valbuild/shared": "0.92.0",
16
+ "@valbuild/ui": "0.92.0"
21
17
  },
22
18
  "devDependencies": {
23
19
  "@testing-library/react": "^14.0.0",
24
20
  "@types/react": "^18.2.38",
25
21
  "jest-environment-jsdom": "^29.5.0",
26
22
  "react": "^18.2.0",
27
- "react-dom": "^18.2.0"
23
+ "react-dom": "^18.2.0",
24
+ "typescript": "^5.9.3"
28
25
  },
29
26
  "peerDependencies": {
30
27
  "react": ">=18.2.0 || ^19.0 || ^19.0.0-rc",
@@ -108,5 +105,9 @@
108
105
  "jsx-dev-runtime",
109
106
  "stega",
110
107
  "internal"
111
- ]
112
- }
108
+ ],
109
+ "scripts": {
110
+ "typecheck": "tsc --noEmit",
111
+ "test": "jest"
112
+ }
113
+ }
@@ -1,6 +1,6 @@
1
1
  import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-9cce0d9f.browser.esm.js';
2
- import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-851b5dbe.browser.esm.js';
3
- export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-851b5dbe.browser.esm.js';
2
+ import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-d86c2721.browser.esm.js';
3
+ export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-d86c2721.browser.esm.js';
4
4
  import ReactJSXRuntime__default from 'react/jsx-runtime';
5
5
  import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
6
6
  import React from 'react';
@@ -145,11 +145,17 @@ function autoTagJSX() {
145
145
  * include both, so one of them will be set with `undefined` values.
146
146
  */
147
147
  React.createElement = WrapJsx(React.createElement);
148
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
148
149
  JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
150
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
149
151
  JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
152
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
150
153
  JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
154
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
151
155
  JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
156
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
152
157
  JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
153
159
  JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
154
160
  }
155
161
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var slicedToArray = require('../../dist/slicedToArray-e9e8e991.cjs.dev.js');
6
- var raw = require('../../dist/raw-e1436cca.cjs.dev.js');
6
+ var raw = require('../../dist/raw-8632c70b.cjs.dev.js');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
  var jsxRuntimeDev = require('react/jsx-dev-runtime');
9
9
  var React = require('react');
@@ -154,11 +154,17 @@ function autoTagJSX() {
154
154
  * include both, so one of them will be set with `undefined` values.
155
155
  */
156
156
  React__default["default"].createElement = WrapJsx(React__default["default"].createElement);
157
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
157
158
  JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
159
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
158
160
  JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
161
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
159
162
  JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
163
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
160
164
  JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
165
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
161
166
  JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
167
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
162
168
  JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
163
169
  }
164
170
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var slicedToArray = require('../../dist/slicedToArray-86004d59.cjs.prod.js');
6
- var raw = require('../../dist/raw-95d2506f.cjs.prod.js');
6
+ var raw = require('../../dist/raw-30090bf4.cjs.prod.js');
7
7
  var ReactJSXRuntime = require('react/jsx-runtime');
8
8
  var jsxRuntimeDev = require('react/jsx-dev-runtime');
9
9
  var React = require('react');
@@ -154,11 +154,17 @@ function autoTagJSX() {
154
154
  * include both, so one of them will be set with `undefined` values.
155
155
  */
156
156
  React__default["default"].createElement = WrapJsx(React__default["default"].createElement);
157
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
157
158
  JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
159
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
158
160
  JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
161
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
159
162
  JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
163
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
160
164
  JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
165
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
161
166
  JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
167
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
162
168
  JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
163
169
  }
164
170
 
@@ -1,6 +1,6 @@
1
1
  import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-0c0a3b4a.esm.js';
2
- import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-d3f56a16.esm.js';
3
- export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-d3f56a16.esm.js';
2
+ import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-4e13e7bb.esm.js';
3
+ export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-4e13e7bb.esm.js';
4
4
  import ReactJSXRuntime__default from 'react/jsx-runtime';
5
5
  import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
6
6
  import React from 'react';
@@ -145,11 +145,17 @@ function autoTagJSX() {
145
145
  * include both, so one of them will be set with `undefined` values.
146
146
  */
147
147
  React.createElement = WrapJsx(React.createElement);
148
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
148
149
  JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
150
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
149
151
  JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
152
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
150
153
  JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
154
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
151
155
  JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
156
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
152
157
  JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
153
159
  JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
154
160
  }
155
161
 
@@ -1,6 +1,6 @@
1
1
  import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-7d0170b6.worker.esm.js';
2
- import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-74c5ecab.worker.esm.js';
3
- export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-74c5ecab.worker.esm.js';
2
+ import { s as stegaDecodeStrings, _ as _createForOfIteratorHelper } from '../../dist/raw-e3c9e04a.worker.esm.js';
3
+ export { c as attrs, g as getModuleIds, r as raw, b as stegaClean, s as stegaDecodeStrings, a as stegaEncode } from '../../dist/raw-e3c9e04a.worker.esm.js';
4
4
  import ReactJSXRuntime__default from 'react/jsx-runtime';
5
5
  import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
6
6
  import React from 'react';
@@ -145,11 +145,17 @@ function autoTagJSX() {
145
145
  * include both, so one of them will be set with `undefined` values.
146
146
  */
147
147
  React.createElement = WrapJsx(React.createElement);
148
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
148
149
  JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
150
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
149
151
  JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
152
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
150
153
  JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
154
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
151
155
  JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
156
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
152
157
  JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
158
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
153
159
  JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
154
160
  }
155
161