hadars 1.0.0 → 1.0.2
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/dist/{chunk-NYLXE7T7.js → chunk-LDVJ26Q3.js} +1 -1
- package/dist/{chunk-2TMQUXFL.js → chunk-QOTDCUE5.js} +58 -18
- package/dist/cli.js +387 -206
- package/dist/cloudflare.cjs +61 -34
- package/dist/cloudflare.js +2 -2
- package/dist/lambda.cjs +61 -34
- package/dist/lambda.js +2 -2
- package/dist/slim-react/index.cjs +87 -45
- package/dist/slim-react/index.d.cts +26 -2
- package/dist/slim-react/index.d.ts +26 -2
- package/dist/slim-react/index.js +5 -1
- package/dist/ssr-render-worker.js +65 -37
- package/package.json +3 -3
package/dist/cloudflare.cjs
CHANGED
|
@@ -157,24 +157,6 @@ var REACT19_ELEMENT = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
|
157
157
|
var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
158
158
|
var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
159
159
|
|
|
160
|
-
// src/slim-react/jsx.ts
|
|
161
|
-
function createElement(type, props, ...children) {
|
|
162
|
-
const normalizedProps = { ...props || {} };
|
|
163
|
-
if (children.length === 1) {
|
|
164
|
-
normalizedProps.children = children[0];
|
|
165
|
-
} else if (children.length > 1) {
|
|
166
|
-
normalizedProps.children = children;
|
|
167
|
-
}
|
|
168
|
-
const key = normalizedProps.key ?? null;
|
|
169
|
-
delete normalizedProps.key;
|
|
170
|
-
return {
|
|
171
|
-
$$typeof: SLIM_ELEMENT,
|
|
172
|
-
type,
|
|
173
|
-
props: normalizedProps,
|
|
174
|
-
key
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
160
|
// src/slim-react/renderContext.ts
|
|
179
161
|
var MAP_KEY = "__slimReactContextMap";
|
|
180
162
|
var _g = globalThis;
|
|
@@ -197,8 +179,7 @@ function restoreUnsuspend(u) {
|
|
|
197
179
|
function getContextValue(context) {
|
|
198
180
|
const map = _g[MAP_KEY];
|
|
199
181
|
if (map && map.has(context)) return map.get(context);
|
|
200
|
-
|
|
201
|
-
return "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
182
|
+
return context._currentValue;
|
|
202
183
|
}
|
|
203
184
|
function pushContextValue(context, value) {
|
|
204
185
|
let map = _g[MAP_KEY];
|
|
@@ -206,8 +187,7 @@ function pushContextValue(context, value) {
|
|
|
206
187
|
map = /* @__PURE__ */ new Map();
|
|
207
188
|
_g[MAP_KEY] = map;
|
|
208
189
|
}
|
|
209
|
-
const
|
|
210
|
-
const prev = map.has(context) ? map.get(context) : "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
190
|
+
const prev = map.has(context) ? map.get(context) : context._currentValue;
|
|
211
191
|
map.set(context, value);
|
|
212
192
|
return prev;
|
|
213
193
|
}
|
|
@@ -312,13 +292,35 @@ function getTreeId() {
|
|
|
312
292
|
const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
|
|
313
293
|
return stripped + overflow;
|
|
314
294
|
}
|
|
295
|
+
var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
|
|
296
|
+
var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
|
|
315
297
|
function makeId() {
|
|
316
298
|
const st = s();
|
|
317
299
|
const treeId = getTreeId();
|
|
318
300
|
const n = st.localIdCounter++;
|
|
319
|
-
|
|
320
|
-
if (
|
|
321
|
-
|
|
301
|
+
const suffix = n > 0 ? "H" + n.toString(32) : "";
|
|
302
|
+
if (REACT_MAJOR < 19) {
|
|
303
|
+
return ":" + st.idPrefix + "R" + treeId + suffix + ":";
|
|
304
|
+
}
|
|
305
|
+
return "_R_" + st.idPrefix + treeId + suffix + "_";
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// src/slim-react/jsx.ts
|
|
309
|
+
function createElement(type, props, ...children) {
|
|
310
|
+
const normalizedProps = { ...props || {} };
|
|
311
|
+
if (children.length === 1) {
|
|
312
|
+
normalizedProps.children = children[0];
|
|
313
|
+
} else if (children.length > 1) {
|
|
314
|
+
normalizedProps.children = children;
|
|
315
|
+
}
|
|
316
|
+
const key = normalizedProps.key ?? null;
|
|
317
|
+
delete normalizedProps.key;
|
|
318
|
+
return {
|
|
319
|
+
$$typeof: SLIM_ELEMENT,
|
|
320
|
+
type,
|
|
321
|
+
props: normalizedProps,
|
|
322
|
+
key
|
|
323
|
+
};
|
|
322
324
|
}
|
|
323
325
|
|
|
324
326
|
// src/slim-react/hooks.ts
|
|
@@ -379,8 +381,22 @@ function use(usable) {
|
|
|
379
381
|
|
|
380
382
|
// src/slim-react/dispatcher.ts
|
|
381
383
|
var ReactNS = __toESM(require("react"), 1);
|
|
382
|
-
var
|
|
383
|
-
var
|
|
384
|
+
var _r19;
|
|
385
|
+
var _r18;
|
|
386
|
+
var _detected = false;
|
|
387
|
+
var _k19 = "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE";
|
|
388
|
+
var _k18 = "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
|
|
389
|
+
function _detect() {
|
|
390
|
+
if (_detected) return;
|
|
391
|
+
_detected = true;
|
|
392
|
+
const r19 = ReactNS[_k19];
|
|
393
|
+
if (r19) {
|
|
394
|
+
_r19 = r19;
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const raw = ReactNS[_k18];
|
|
398
|
+
if (raw?.ReactCurrentDispatcher) _r18 = raw;
|
|
399
|
+
}
|
|
384
400
|
var slimDispatcher = {
|
|
385
401
|
useId: makeId,
|
|
386
402
|
readContext: (ctx) => getContextValue(ctx),
|
|
@@ -408,13 +424,23 @@ var slimDispatcher = {
|
|
|
408
424
|
useHostTransitionStatus: () => false
|
|
409
425
|
};
|
|
410
426
|
function installDispatcher() {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
427
|
+
_detect();
|
|
428
|
+
if (_r19) {
|
|
429
|
+
const prev = _r19.H;
|
|
430
|
+
_r19.H = slimDispatcher;
|
|
431
|
+
return prev;
|
|
432
|
+
}
|
|
433
|
+
if (_r18) {
|
|
434
|
+
const prev = _r18.ReactCurrentDispatcher.current;
|
|
435
|
+
_r18.ReactCurrentDispatcher.current = slimDispatcher;
|
|
436
|
+
return prev;
|
|
437
|
+
}
|
|
438
|
+
return null;
|
|
415
439
|
}
|
|
416
440
|
function restoreDispatcher(prev) {
|
|
417
|
-
|
|
441
|
+
_detect();
|
|
442
|
+
if (_r19) _r19.H = prev;
|
|
443
|
+
else if (_r18) _r18.ReactCurrentDispatcher.current = prev;
|
|
418
444
|
}
|
|
419
445
|
|
|
420
446
|
// src/slim-react/render.ts
|
|
@@ -671,7 +697,7 @@ function writeAttributes(writer, props, isSvg, skip) {
|
|
|
671
697
|
if (isSvg && key in SVG_ATTR_MAP) {
|
|
672
698
|
attrName = SVG_ATTR_MAP[key];
|
|
673
699
|
} else {
|
|
674
|
-
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key;
|
|
700
|
+
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key === "contentEditable" && REACT_MAJOR < 19 ? "contenteditable" : key;
|
|
675
701
|
}
|
|
676
702
|
if (value === false || value == null) {
|
|
677
703
|
if (value === false && (attrName.charCodeAt(0) === 97 && attrName.startsWith("aria-") || attrName.charCodeAt(0) === 100 && attrName.startsWith("data-"))) {
|
|
@@ -880,7 +906,8 @@ function renderComponent(type, props, writer, isSvg, _suspenseRetries = 0) {
|
|
|
880
906
|
const LazyComp = resolved?.default ?? resolved;
|
|
881
907
|
return renderComponent(LazyComp, props, writer, isSvg);
|
|
882
908
|
}
|
|
883
|
-
|
|
909
|
+
const isConsumer = typeOf === REACT_CONSUMER || typeOf === REACT_CONTEXT && "_context" in type && !("value" in props);
|
|
910
|
+
if (isConsumer) {
|
|
884
911
|
const ctx2 = type._context;
|
|
885
912
|
const value = ctx2 ? getContextValue(ctx2) : void 0;
|
|
886
913
|
const result2 = typeof props.children === "function" ? props.children(value) : null;
|
package/dist/cloudflare.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getReactResponse,
|
|
7
7
|
makePrecontentHtmlGetter,
|
|
8
8
|
parseRequest
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-LDVJ26Q3.js";
|
|
10
|
+
import "./chunk-QOTDCUE5.js";
|
|
11
11
|
import "./chunk-OZUZS2PD.js";
|
|
12
12
|
|
|
13
13
|
// src/cloudflare.ts
|
package/dist/lambda.cjs
CHANGED
|
@@ -197,24 +197,6 @@ var REACT19_ELEMENT = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
|
197
197
|
var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
198
198
|
var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
199
199
|
|
|
200
|
-
// src/slim-react/jsx.ts
|
|
201
|
-
function createElement(type, props, ...children) {
|
|
202
|
-
const normalizedProps = { ...props || {} };
|
|
203
|
-
if (children.length === 1) {
|
|
204
|
-
normalizedProps.children = children[0];
|
|
205
|
-
} else if (children.length > 1) {
|
|
206
|
-
normalizedProps.children = children;
|
|
207
|
-
}
|
|
208
|
-
const key = normalizedProps.key ?? null;
|
|
209
|
-
delete normalizedProps.key;
|
|
210
|
-
return {
|
|
211
|
-
$$typeof: SLIM_ELEMENT,
|
|
212
|
-
type,
|
|
213
|
-
props: normalizedProps,
|
|
214
|
-
key
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
200
|
// src/slim-react/renderContext.ts
|
|
219
201
|
var MAP_KEY = "__slimReactContextMap";
|
|
220
202
|
var _g = globalThis;
|
|
@@ -237,8 +219,7 @@ function restoreUnsuspend(u) {
|
|
|
237
219
|
function getContextValue(context) {
|
|
238
220
|
const map = _g[MAP_KEY];
|
|
239
221
|
if (map && map.has(context)) return map.get(context);
|
|
240
|
-
|
|
241
|
-
return "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
222
|
+
return context._currentValue;
|
|
242
223
|
}
|
|
243
224
|
function pushContextValue(context, value) {
|
|
244
225
|
let map = _g[MAP_KEY];
|
|
@@ -246,8 +227,7 @@ function pushContextValue(context, value) {
|
|
|
246
227
|
map = /* @__PURE__ */ new Map();
|
|
247
228
|
_g[MAP_KEY] = map;
|
|
248
229
|
}
|
|
249
|
-
const
|
|
250
|
-
const prev = map.has(context) ? map.get(context) : "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
230
|
+
const prev = map.has(context) ? map.get(context) : context._currentValue;
|
|
251
231
|
map.set(context, value);
|
|
252
232
|
return prev;
|
|
253
233
|
}
|
|
@@ -352,13 +332,35 @@ function getTreeId() {
|
|
|
352
332
|
const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
|
|
353
333
|
return stripped + overflow;
|
|
354
334
|
}
|
|
335
|
+
var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
|
|
336
|
+
var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
|
|
355
337
|
function makeId() {
|
|
356
338
|
const st = s();
|
|
357
339
|
const treeId = getTreeId();
|
|
358
340
|
const n = st.localIdCounter++;
|
|
359
|
-
|
|
360
|
-
if (
|
|
361
|
-
|
|
341
|
+
const suffix = n > 0 ? "H" + n.toString(32) : "";
|
|
342
|
+
if (REACT_MAJOR < 19) {
|
|
343
|
+
return ":" + st.idPrefix + "R" + treeId + suffix + ":";
|
|
344
|
+
}
|
|
345
|
+
return "_R_" + st.idPrefix + treeId + suffix + "_";
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/slim-react/jsx.ts
|
|
349
|
+
function createElement(type, props, ...children) {
|
|
350
|
+
const normalizedProps = { ...props || {} };
|
|
351
|
+
if (children.length === 1) {
|
|
352
|
+
normalizedProps.children = children[0];
|
|
353
|
+
} else if (children.length > 1) {
|
|
354
|
+
normalizedProps.children = children;
|
|
355
|
+
}
|
|
356
|
+
const key = normalizedProps.key ?? null;
|
|
357
|
+
delete normalizedProps.key;
|
|
358
|
+
return {
|
|
359
|
+
$$typeof: SLIM_ELEMENT,
|
|
360
|
+
type,
|
|
361
|
+
props: normalizedProps,
|
|
362
|
+
key
|
|
363
|
+
};
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
// src/slim-react/hooks.ts
|
|
@@ -419,8 +421,22 @@ function use(usable) {
|
|
|
419
421
|
|
|
420
422
|
// src/slim-react/dispatcher.ts
|
|
421
423
|
var ReactNS = __toESM(require("react"), 1);
|
|
422
|
-
var
|
|
423
|
-
var
|
|
424
|
+
var _r19;
|
|
425
|
+
var _r18;
|
|
426
|
+
var _detected = false;
|
|
427
|
+
var _k19 = "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE";
|
|
428
|
+
var _k18 = "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
|
|
429
|
+
function _detect() {
|
|
430
|
+
if (_detected) return;
|
|
431
|
+
_detected = true;
|
|
432
|
+
const r19 = ReactNS[_k19];
|
|
433
|
+
if (r19) {
|
|
434
|
+
_r19 = r19;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const raw = ReactNS[_k18];
|
|
438
|
+
if (raw?.ReactCurrentDispatcher) _r18 = raw;
|
|
439
|
+
}
|
|
424
440
|
var slimDispatcher = {
|
|
425
441
|
useId: makeId,
|
|
426
442
|
readContext: (ctx) => getContextValue(ctx),
|
|
@@ -448,13 +464,23 @@ var slimDispatcher = {
|
|
|
448
464
|
useHostTransitionStatus: () => false
|
|
449
465
|
};
|
|
450
466
|
function installDispatcher() {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
467
|
+
_detect();
|
|
468
|
+
if (_r19) {
|
|
469
|
+
const prev = _r19.H;
|
|
470
|
+
_r19.H = slimDispatcher;
|
|
471
|
+
return prev;
|
|
472
|
+
}
|
|
473
|
+
if (_r18) {
|
|
474
|
+
const prev = _r18.ReactCurrentDispatcher.current;
|
|
475
|
+
_r18.ReactCurrentDispatcher.current = slimDispatcher;
|
|
476
|
+
return prev;
|
|
477
|
+
}
|
|
478
|
+
return null;
|
|
455
479
|
}
|
|
456
480
|
function restoreDispatcher(prev) {
|
|
457
|
-
|
|
481
|
+
_detect();
|
|
482
|
+
if (_r19) _r19.H = prev;
|
|
483
|
+
else if (_r18) _r18.ReactCurrentDispatcher.current = prev;
|
|
458
484
|
}
|
|
459
485
|
|
|
460
486
|
// src/slim-react/render.ts
|
|
@@ -711,7 +737,7 @@ function writeAttributes(writer, props, isSvg, skip) {
|
|
|
711
737
|
if (isSvg && key in SVG_ATTR_MAP) {
|
|
712
738
|
attrName = SVG_ATTR_MAP[key];
|
|
713
739
|
} else {
|
|
714
|
-
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key;
|
|
740
|
+
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key === "contentEditable" && REACT_MAJOR < 19 ? "contenteditable" : key;
|
|
715
741
|
}
|
|
716
742
|
if (value === false || value == null) {
|
|
717
743
|
if (value === false && (attrName.charCodeAt(0) === 97 && attrName.startsWith("aria-") || attrName.charCodeAt(0) === 100 && attrName.startsWith("data-"))) {
|
|
@@ -920,7 +946,8 @@ function renderComponent(type, props, writer, isSvg, _suspenseRetries = 0) {
|
|
|
920
946
|
const LazyComp = resolved?.default ?? resolved;
|
|
921
947
|
return renderComponent(LazyComp, props, writer, isSvg);
|
|
922
948
|
}
|
|
923
|
-
|
|
949
|
+
const isConsumer = typeOf === REACT_CONSUMER || typeOf === REACT_CONTEXT && "_context" in type && !("value" in props);
|
|
950
|
+
if (isConsumer) {
|
|
924
951
|
const ctx2 = type._context;
|
|
925
952
|
const value = ctx2 ? getContextValue(ctx2) : void 0;
|
|
926
953
|
const result2 = typeof props.children === "function" ? props.children(value) : null;
|
package/dist/lambda.js
CHANGED
|
@@ -38,6 +38,7 @@ __export(slim_react_exports, {
|
|
|
38
38
|
SLIM_ELEMENT: () => SLIM_ELEMENT,
|
|
39
39
|
SUSPENSE_TYPE: () => SUSPENSE_TYPE,
|
|
40
40
|
Suspense: () => Suspense,
|
|
41
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: () => __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
41
42
|
cloneElement: () => cloneElement,
|
|
42
43
|
createContext: () => createContext,
|
|
43
44
|
createElement: () => createElement,
|
|
@@ -53,6 +54,7 @@ __export(slim_react_exports, {
|
|
|
53
54
|
renderToReadableStream: () => renderToStream,
|
|
54
55
|
renderToStream: () => renderToStream,
|
|
55
56
|
renderToString: () => renderToString,
|
|
57
|
+
setReactVersion: () => setReactVersion,
|
|
56
58
|
startTransition: () => startTransition,
|
|
57
59
|
use: () => use,
|
|
58
60
|
useActionState: () => useActionState,
|
|
@@ -83,33 +85,6 @@ var REACT19_ELEMENT = /* @__PURE__ */ Symbol.for("react.transitional.element");
|
|
|
83
85
|
var FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
84
86
|
var SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense");
|
|
85
87
|
|
|
86
|
-
// src/slim-react/jsx.ts
|
|
87
|
-
var Fragment = FRAGMENT_TYPE;
|
|
88
|
-
function jsx(type, props, key) {
|
|
89
|
-
return {
|
|
90
|
-
$$typeof: SLIM_ELEMENT,
|
|
91
|
-
type,
|
|
92
|
-
props: props || {},
|
|
93
|
-
key: key ?? (props?.key ?? null)
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function createElement(type, props, ...children) {
|
|
97
|
-
const normalizedProps = { ...props || {} };
|
|
98
|
-
if (children.length === 1) {
|
|
99
|
-
normalizedProps.children = children[0];
|
|
100
|
-
} else if (children.length > 1) {
|
|
101
|
-
normalizedProps.children = children;
|
|
102
|
-
}
|
|
103
|
-
const key = normalizedProps.key ?? null;
|
|
104
|
-
delete normalizedProps.key;
|
|
105
|
-
return {
|
|
106
|
-
$$typeof: SLIM_ELEMENT,
|
|
107
|
-
type,
|
|
108
|
-
props: normalizedProps,
|
|
109
|
-
key
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
88
|
// src/slim-react/renderContext.ts
|
|
114
89
|
var MAP_KEY = "__slimReactContextMap";
|
|
115
90
|
var _g = globalThis;
|
|
@@ -132,8 +107,7 @@ function restoreUnsuspend(u) {
|
|
|
132
107
|
function getContextValue(context) {
|
|
133
108
|
const map = _g[MAP_KEY];
|
|
134
109
|
if (map && map.has(context)) return map.get(context);
|
|
135
|
-
|
|
136
|
-
return "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
110
|
+
return context._currentValue;
|
|
137
111
|
}
|
|
138
112
|
function pushContextValue(context, value) {
|
|
139
113
|
let map = _g[MAP_KEY];
|
|
@@ -141,8 +115,7 @@ function pushContextValue(context, value) {
|
|
|
141
115
|
map = /* @__PURE__ */ new Map();
|
|
142
116
|
_g[MAP_KEY] = map;
|
|
143
117
|
}
|
|
144
|
-
const
|
|
145
|
-
const prev = map.has(context) ? map.get(context) : "_defaultValue" in c ? c._defaultValue : c._currentValue;
|
|
118
|
+
const prev = map.has(context) ? map.get(context) : context._currentValue;
|
|
146
119
|
map.set(context, value);
|
|
147
120
|
return prev;
|
|
148
121
|
}
|
|
@@ -247,13 +220,48 @@ function getTreeId() {
|
|
|
247
220
|
const stripped = (id & ~(1 << 31 - Math.clz32(id))).toString(32);
|
|
248
221
|
return stripped + overflow;
|
|
249
222
|
}
|
|
223
|
+
var REACT_MAJOR = typeof __HADARS_REACT_MAJOR__ !== "undefined" ? parseInt(String(__HADARS_REACT_MAJOR__), 10) : 19;
|
|
224
|
+
var REACT_VERSION = REACT_MAJOR < 19 ? "18.3.1" : "19.1.1";
|
|
225
|
+
function setReactVersion(major, version2) {
|
|
226
|
+
REACT_MAJOR = major;
|
|
227
|
+
REACT_VERSION = version2 ?? (major < 19 ? "18.3.1" : "19.1.1");
|
|
228
|
+
}
|
|
250
229
|
function makeId() {
|
|
251
230
|
const st = s();
|
|
252
231
|
const treeId = getTreeId();
|
|
253
232
|
const n = st.localIdCounter++;
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
233
|
+
const suffix = n > 0 ? "H" + n.toString(32) : "";
|
|
234
|
+
if (REACT_MAJOR < 19) {
|
|
235
|
+
return ":" + st.idPrefix + "R" + treeId + suffix + ":";
|
|
236
|
+
}
|
|
237
|
+
return "_R_" + st.idPrefix + treeId + suffix + "_";
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/slim-react/jsx.ts
|
|
241
|
+
var Fragment = FRAGMENT_TYPE;
|
|
242
|
+
function jsx(type, props, key) {
|
|
243
|
+
return {
|
|
244
|
+
$$typeof: SLIM_ELEMENT,
|
|
245
|
+
type,
|
|
246
|
+
props: props || {},
|
|
247
|
+
key: key ?? (props?.key ?? null)
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function createElement(type, props, ...children) {
|
|
251
|
+
const normalizedProps = { ...props || {} };
|
|
252
|
+
if (children.length === 1) {
|
|
253
|
+
normalizedProps.children = children[0];
|
|
254
|
+
} else if (children.length > 1) {
|
|
255
|
+
normalizedProps.children = children;
|
|
256
|
+
}
|
|
257
|
+
const key = normalizedProps.key ?? null;
|
|
258
|
+
delete normalizedProps.key;
|
|
259
|
+
return {
|
|
260
|
+
$$typeof: SLIM_ELEMENT,
|
|
261
|
+
type,
|
|
262
|
+
props: normalizedProps,
|
|
263
|
+
key
|
|
264
|
+
};
|
|
257
265
|
}
|
|
258
266
|
|
|
259
267
|
// src/slim-react/hooks.ts
|
|
@@ -346,8 +354,22 @@ function createContext(defaultValue) {
|
|
|
346
354
|
|
|
347
355
|
// src/slim-react/dispatcher.ts
|
|
348
356
|
var ReactNS = __toESM(require("react"), 1);
|
|
349
|
-
var
|
|
350
|
-
var
|
|
357
|
+
var _r19;
|
|
358
|
+
var _r18;
|
|
359
|
+
var _detected = false;
|
|
360
|
+
var _k19 = "__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE";
|
|
361
|
+
var _k18 = "__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED";
|
|
362
|
+
function _detect() {
|
|
363
|
+
if (_detected) return;
|
|
364
|
+
_detected = true;
|
|
365
|
+
const r19 = ReactNS[_k19];
|
|
366
|
+
if (r19) {
|
|
367
|
+
_r19 = r19;
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const raw = ReactNS[_k18];
|
|
371
|
+
if (raw?.ReactCurrentDispatcher) _r18 = raw;
|
|
372
|
+
}
|
|
351
373
|
var slimDispatcher = {
|
|
352
374
|
useId: makeId,
|
|
353
375
|
readContext: (ctx) => getContextValue(ctx),
|
|
@@ -375,13 +397,23 @@ var slimDispatcher = {
|
|
|
375
397
|
useHostTransitionStatus: () => false
|
|
376
398
|
};
|
|
377
399
|
function installDispatcher() {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
400
|
+
_detect();
|
|
401
|
+
if (_r19) {
|
|
402
|
+
const prev = _r19.H;
|
|
403
|
+
_r19.H = slimDispatcher;
|
|
404
|
+
return prev;
|
|
405
|
+
}
|
|
406
|
+
if (_r18) {
|
|
407
|
+
const prev = _r18.ReactCurrentDispatcher.current;
|
|
408
|
+
_r18.ReactCurrentDispatcher.current = slimDispatcher;
|
|
409
|
+
return prev;
|
|
410
|
+
}
|
|
411
|
+
return null;
|
|
382
412
|
}
|
|
383
413
|
function restoreDispatcher(prev) {
|
|
384
|
-
|
|
414
|
+
_detect();
|
|
415
|
+
if (_r19) _r19.H = prev;
|
|
416
|
+
else if (_r18) _r18.ReactCurrentDispatcher.current = prev;
|
|
385
417
|
}
|
|
386
418
|
|
|
387
419
|
// src/slim-react/render.ts
|
|
@@ -638,7 +670,7 @@ function writeAttributes(writer, props, isSvg, skip) {
|
|
|
638
670
|
if (isSvg && key in SVG_ATTR_MAP) {
|
|
639
671
|
attrName = SVG_ATTR_MAP[key];
|
|
640
672
|
} else {
|
|
641
|
-
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key;
|
|
673
|
+
attrName = key === "className" ? "class" : key === "htmlFor" ? "for" : key === "tabIndex" ? "tabindex" : key === "defaultValue" ? "value" : key === "defaultChecked" ? "checked" : key === "contentEditable" && REACT_MAJOR < 19 ? "contenteditable" : key;
|
|
642
674
|
}
|
|
643
675
|
if (value === false || value == null) {
|
|
644
676
|
if (value === false && (attrName.charCodeAt(0) === 97 && attrName.startsWith("aria-") || attrName.charCodeAt(0) === 100 && attrName.startsWith("data-"))) {
|
|
@@ -847,7 +879,8 @@ function renderComponent(type, props, writer, isSvg, _suspenseRetries = 0) {
|
|
|
847
879
|
const LazyComp = resolved?.default ?? resolved;
|
|
848
880
|
return renderComponent(LazyComp, props, writer, isSvg);
|
|
849
881
|
}
|
|
850
|
-
|
|
882
|
+
const isConsumer = typeOf === REACT_CONSUMER || typeOf === REACT_CONTEXT && "_context" in type && !("value" in props);
|
|
883
|
+
if (isConsumer) {
|
|
851
884
|
const ctx2 = type._context;
|
|
852
885
|
const value = ctx2 ? getContextValue(ctx2) : void 0;
|
|
853
886
|
const result2 = typeof props.children === "function" ? props.children(value) : null;
|
|
@@ -1233,7 +1266,12 @@ var Component = class {
|
|
|
1233
1266
|
};
|
|
1234
1267
|
var PureComponent = class extends Component {
|
|
1235
1268
|
};
|
|
1236
|
-
var version =
|
|
1269
|
+
var version = REACT_VERSION;
|
|
1270
|
+
var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
|
|
1271
|
+
ReactCurrentDispatcher: { current: null },
|
|
1272
|
+
ReactCurrentBatchConfig: { transition: null },
|
|
1273
|
+
ReactCurrentOwner: { current: null }
|
|
1274
|
+
};
|
|
1237
1275
|
var React = {
|
|
1238
1276
|
// Hooks
|
|
1239
1277
|
useState,
|
|
@@ -1277,7 +1315,9 @@ var React = {
|
|
|
1277
1315
|
renderToReadableStream: renderToStream,
|
|
1278
1316
|
renderPreflight,
|
|
1279
1317
|
// Version
|
|
1280
|
-
version
|
|
1318
|
+
version,
|
|
1319
|
+
// React 18 internals
|
|
1320
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
|
1281
1321
|
};
|
|
1282
1322
|
var slim_react_default = React;
|
|
1283
1323
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1290,6 +1330,7 @@ var slim_react_default = React;
|
|
|
1290
1330
|
SLIM_ELEMENT,
|
|
1291
1331
|
SUSPENSE_TYPE,
|
|
1292
1332
|
Suspense,
|
|
1333
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
|
1293
1334
|
cloneElement,
|
|
1294
1335
|
createContext,
|
|
1295
1336
|
createElement,
|
|
@@ -1304,6 +1345,7 @@ var slim_react_default = React;
|
|
|
1304
1345
|
renderToReadableStream,
|
|
1305
1346
|
renderToStream,
|
|
1306
1347
|
renderToString,
|
|
1348
|
+
setReactVersion,
|
|
1307
1349
|
startTransition,
|
|
1308
1350
|
use,
|
|
1309
1351
|
useActionState,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { S as SlimNode, a as SlimElement, c as createElement } from '../jsx-runtime-BOYrELJb.cjs';
|
|
2
2
|
export { C as ComponentFunction, F as FRAGMENT_TYPE, b as Fragment, d as SLIM_ELEMENT, e as SUSPENSE_TYPE, j as jsx, j as jsxDEV, j as jsxs } from '../jsx-runtime-BOYrELJb.cjs';
|
|
3
3
|
|
|
4
|
+
declare function setReactVersion(major: number, version?: string): void;
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* SSR hook implementations.
|
|
6
8
|
*
|
|
@@ -156,7 +158,18 @@ declare class Component<P = {}, S = {}> {
|
|
|
156
158
|
}
|
|
157
159
|
declare class PureComponent<P = {}, S = {}> extends Component<P, S> {
|
|
158
160
|
}
|
|
159
|
-
declare const version
|
|
161
|
+
declare const version: string;
|
|
162
|
+
declare const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
163
|
+
ReactCurrentDispatcher: {
|
|
164
|
+
current: unknown;
|
|
165
|
+
};
|
|
166
|
+
ReactCurrentBatchConfig: {
|
|
167
|
+
transition: unknown;
|
|
168
|
+
};
|
|
169
|
+
ReactCurrentOwner: {
|
|
170
|
+
current: unknown;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
160
173
|
declare const React: {
|
|
161
174
|
useState: typeof useState;
|
|
162
175
|
useReducer: typeof useReducer;
|
|
@@ -201,6 +214,17 @@ declare const React: {
|
|
|
201
214
|
renderToReadableStream: typeof renderToStream;
|
|
202
215
|
renderPreflight: typeof renderPreflight;
|
|
203
216
|
version: string;
|
|
217
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
218
|
+
ReactCurrentDispatcher: {
|
|
219
|
+
current: unknown;
|
|
220
|
+
};
|
|
221
|
+
ReactCurrentBatchConfig: {
|
|
222
|
+
transition: unknown;
|
|
223
|
+
};
|
|
224
|
+
ReactCurrentOwner: {
|
|
225
|
+
current: unknown;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
204
228
|
};
|
|
205
229
|
|
|
206
|
-
export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
|
|
230
|
+
export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, setReactVersion, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { S as SlimNode, a as SlimElement, c as createElement } from '../jsx-runtime-BOYrELJb.js';
|
|
2
2
|
export { C as ComponentFunction, F as FRAGMENT_TYPE, b as Fragment, d as SLIM_ELEMENT, e as SUSPENSE_TYPE, j as jsx, j as jsxDEV, j as jsxs } from '../jsx-runtime-BOYrELJb.js';
|
|
3
3
|
|
|
4
|
+
declare function setReactVersion(major: number, version?: string): void;
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* SSR hook implementations.
|
|
6
8
|
*
|
|
@@ -156,7 +158,18 @@ declare class Component<P = {}, S = {}> {
|
|
|
156
158
|
}
|
|
157
159
|
declare class PureComponent<P = {}, S = {}> extends Component<P, S> {
|
|
158
160
|
}
|
|
159
|
-
declare const version
|
|
161
|
+
declare const version: string;
|
|
162
|
+
declare const __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
163
|
+
ReactCurrentDispatcher: {
|
|
164
|
+
current: unknown;
|
|
165
|
+
};
|
|
166
|
+
ReactCurrentBatchConfig: {
|
|
167
|
+
transition: unknown;
|
|
168
|
+
};
|
|
169
|
+
ReactCurrentOwner: {
|
|
170
|
+
current: unknown;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
160
173
|
declare const React: {
|
|
161
174
|
useState: typeof useState;
|
|
162
175
|
useReducer: typeof useReducer;
|
|
@@ -201,6 +214,17 @@ declare const React: {
|
|
|
201
214
|
renderToReadableStream: typeof renderToStream;
|
|
202
215
|
renderPreflight: typeof renderPreflight;
|
|
203
216
|
version: string;
|
|
217
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
218
|
+
ReactCurrentDispatcher: {
|
|
219
|
+
current: unknown;
|
|
220
|
+
};
|
|
221
|
+
ReactCurrentBatchConfig: {
|
|
222
|
+
transition: unknown;
|
|
223
|
+
};
|
|
224
|
+
ReactCurrentOwner: {
|
|
225
|
+
current: unknown;
|
|
226
|
+
};
|
|
227
|
+
};
|
|
204
228
|
};
|
|
205
229
|
|
|
206
|
-
export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
|
|
230
|
+
export { Children, Component, type Context, PureComponent, type RenderOptions, SlimElement, SlimNode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, React as default, forwardRef, isValidElement, lazy, memo, renderPreflight, renderToStream as renderToReadableStream, renderToStream, renderToString, setReactVersion, startTransition, use, useActionState, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useFormStatus, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useOptimistic, useReducer, useRef, useState, useSyncExternalStore, useTransition, version };
|