@fictjs/runtime 0.0.4 → 0.0.5
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/index.cjs +728 -678
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +555 -530
- package/dist/index.d.ts +555 -530
- package/dist/index.dev.js +729 -679
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +726 -679
- package/dist/index.js.map +1 -1
- package/dist/slim.cjs +87 -8
- package/dist/slim.cjs.map +1 -1
- package/dist/slim.d.cts +31 -4
- package/dist/slim.d.ts +31 -4
- package/dist/slim.js +85 -9
- package/dist/slim.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/scope.ts +55 -0
- package/src/slim.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -790,6 +790,21 @@ function effect(fn) {
|
|
|
790
790
|
function effectOper() {
|
|
791
791
|
disposeNode(this);
|
|
792
792
|
}
|
|
793
|
+
function effectScope(fn) {
|
|
794
|
+
const e = { deps: void 0, depsTail: void 0, subs: void 0, subsTail: void 0, flags: 0 };
|
|
795
|
+
const prevSub = activeSub;
|
|
796
|
+
if (prevSub !== void 0) link(e, prevSub, 0);
|
|
797
|
+
activeSub = e;
|
|
798
|
+
try {
|
|
799
|
+
fn();
|
|
800
|
+
} finally {
|
|
801
|
+
activeSub = prevSub;
|
|
802
|
+
}
|
|
803
|
+
return effectScopeOper.bind(e);
|
|
804
|
+
}
|
|
805
|
+
function effectScopeOper() {
|
|
806
|
+
disposeNode(this);
|
|
807
|
+
}
|
|
793
808
|
function batch(fn) {
|
|
794
809
|
++batchDepth;
|
|
795
810
|
try {
|
|
@@ -1038,471 +1053,190 @@ function createRenderEffect(fn) {
|
|
|
1038
1053
|
return teardown;
|
|
1039
1054
|
}
|
|
1040
1055
|
|
|
1041
|
-
// src/
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1056
|
+
// src/constants.ts
|
|
1057
|
+
var booleans = [
|
|
1058
|
+
"allowfullscreen",
|
|
1059
|
+
"async",
|
|
1060
|
+
"alpha",
|
|
1061
|
+
// HTMLInputElement
|
|
1062
|
+
"autofocus",
|
|
1063
|
+
// HTMLElement prop
|
|
1064
|
+
"autoplay",
|
|
1065
|
+
"checked",
|
|
1066
|
+
"controls",
|
|
1067
|
+
"default",
|
|
1068
|
+
"disabled",
|
|
1069
|
+
"formnovalidate",
|
|
1070
|
+
"hidden",
|
|
1071
|
+
// HTMLElement prop
|
|
1072
|
+
"indeterminate",
|
|
1073
|
+
"inert",
|
|
1074
|
+
// HTMLElement prop
|
|
1075
|
+
"ismap",
|
|
1076
|
+
"loop",
|
|
1077
|
+
"multiple",
|
|
1078
|
+
"muted",
|
|
1079
|
+
"nomodule",
|
|
1080
|
+
"novalidate",
|
|
1081
|
+
"open",
|
|
1082
|
+
"playsinline",
|
|
1083
|
+
"readonly",
|
|
1084
|
+
"required",
|
|
1085
|
+
"reversed",
|
|
1086
|
+
"seamless",
|
|
1087
|
+
// HTMLIframeElement - non-standard
|
|
1088
|
+
"selected",
|
|
1089
|
+
// Experimental attributes
|
|
1090
|
+
"adauctionheaders",
|
|
1091
|
+
"browsingtopics",
|
|
1092
|
+
"credentialless",
|
|
1093
|
+
"defaultchecked",
|
|
1094
|
+
"defaultmuted",
|
|
1095
|
+
"defaultselected",
|
|
1096
|
+
"defer",
|
|
1097
|
+
"disablepictureinpicture",
|
|
1098
|
+
"disableremoteplayback",
|
|
1099
|
+
"preservespitch",
|
|
1100
|
+
"shadowrootclonable",
|
|
1101
|
+
"shadowrootcustomelementregistry",
|
|
1102
|
+
"shadowrootdelegatesfocus",
|
|
1103
|
+
"shadowrootserializable",
|
|
1104
|
+
"sharedstoragewritable"
|
|
1105
|
+
];
|
|
1106
|
+
var BooleanAttributes = new Set(booleans);
|
|
1107
|
+
var Properties = /* @__PURE__ */ new Set([
|
|
1108
|
+
// Core properties
|
|
1109
|
+
"className",
|
|
1110
|
+
"value",
|
|
1111
|
+
// CamelCase booleans
|
|
1112
|
+
"readOnly",
|
|
1113
|
+
"noValidate",
|
|
1114
|
+
"formNoValidate",
|
|
1115
|
+
"isMap",
|
|
1116
|
+
"noModule",
|
|
1117
|
+
"playsInline",
|
|
1118
|
+
// Experimental (camelCase)
|
|
1119
|
+
"adAuctionHeaders",
|
|
1120
|
+
"allowFullscreen",
|
|
1121
|
+
"browsingTopics",
|
|
1122
|
+
"defaultChecked",
|
|
1123
|
+
"defaultMuted",
|
|
1124
|
+
"defaultSelected",
|
|
1125
|
+
"disablePictureInPicture",
|
|
1126
|
+
"disableRemotePlayback",
|
|
1127
|
+
"preservesPitch",
|
|
1128
|
+
"shadowRootClonable",
|
|
1129
|
+
"shadowRootCustomElementRegistry",
|
|
1130
|
+
"shadowRootDelegatesFocus",
|
|
1131
|
+
"shadowRootSerializable",
|
|
1132
|
+
"sharedStorageWritable",
|
|
1133
|
+
// All lowercase booleans
|
|
1134
|
+
...booleans
|
|
1135
|
+
]);
|
|
1136
|
+
var ChildProperties = /* @__PURE__ */ new Set([
|
|
1137
|
+
"innerHTML",
|
|
1138
|
+
"textContent",
|
|
1139
|
+
"innerText",
|
|
1140
|
+
"children"
|
|
1141
|
+
]);
|
|
1142
|
+
var Aliases = {
|
|
1143
|
+
className: "class",
|
|
1144
|
+
htmlFor: "for"
|
|
1145
|
+
};
|
|
1146
|
+
var PropAliases = {
|
|
1147
|
+
// Direct mapping
|
|
1148
|
+
class: "className",
|
|
1149
|
+
// Element-specific mappings
|
|
1150
|
+
novalidate: {
|
|
1151
|
+
$: "noValidate",
|
|
1152
|
+
FORM: 1
|
|
1153
|
+
},
|
|
1154
|
+
formnovalidate: {
|
|
1155
|
+
$: "formNoValidate",
|
|
1156
|
+
BUTTON: 1,
|
|
1157
|
+
INPUT: 1
|
|
1158
|
+
},
|
|
1159
|
+
ismap: {
|
|
1160
|
+
$: "isMap",
|
|
1161
|
+
IMG: 1
|
|
1162
|
+
},
|
|
1163
|
+
nomodule: {
|
|
1164
|
+
$: "noModule",
|
|
1165
|
+
SCRIPT: 1
|
|
1166
|
+
},
|
|
1167
|
+
playsinline: {
|
|
1168
|
+
$: "playsInline",
|
|
1169
|
+
VIDEO: 1
|
|
1170
|
+
},
|
|
1171
|
+
readonly: {
|
|
1172
|
+
$: "readOnly",
|
|
1173
|
+
INPUT: 1,
|
|
1174
|
+
TEXTAREA: 1
|
|
1175
|
+
},
|
|
1176
|
+
// Experimental element-specific
|
|
1177
|
+
adauctionheaders: {
|
|
1178
|
+
$: "adAuctionHeaders",
|
|
1179
|
+
IFRAME: 1
|
|
1180
|
+
},
|
|
1181
|
+
allowfullscreen: {
|
|
1182
|
+
$: "allowFullscreen",
|
|
1183
|
+
IFRAME: 1
|
|
1184
|
+
},
|
|
1185
|
+
browsingtopics: {
|
|
1186
|
+
$: "browsingTopics",
|
|
1187
|
+
IMG: 1
|
|
1188
|
+
},
|
|
1189
|
+
defaultchecked: {
|
|
1190
|
+
$: "defaultChecked",
|
|
1191
|
+
INPUT: 1
|
|
1192
|
+
},
|
|
1193
|
+
defaultmuted: {
|
|
1194
|
+
$: "defaultMuted",
|
|
1195
|
+
AUDIO: 1,
|
|
1196
|
+
VIDEO: 1
|
|
1197
|
+
},
|
|
1198
|
+
defaultselected: {
|
|
1199
|
+
$: "defaultSelected",
|
|
1200
|
+
OPTION: 1
|
|
1201
|
+
},
|
|
1202
|
+
disablepictureinpicture: {
|
|
1203
|
+
$: "disablePictureInPicture",
|
|
1204
|
+
VIDEO: 1
|
|
1205
|
+
},
|
|
1206
|
+
disableremoteplayback: {
|
|
1207
|
+
$: "disableRemotePlayback",
|
|
1208
|
+
AUDIO: 1,
|
|
1209
|
+
VIDEO: 1
|
|
1210
|
+
},
|
|
1211
|
+
preservespitch: {
|
|
1212
|
+
$: "preservesPitch",
|
|
1213
|
+
AUDIO: 1,
|
|
1214
|
+
VIDEO: 1
|
|
1215
|
+
},
|
|
1216
|
+
shadowrootclonable: {
|
|
1217
|
+
$: "shadowRootClonable",
|
|
1218
|
+
TEMPLATE: 1
|
|
1219
|
+
},
|
|
1220
|
+
shadowrootdelegatesfocus: {
|
|
1221
|
+
$: "shadowRootDelegatesFocus",
|
|
1222
|
+
TEMPLATE: 1
|
|
1223
|
+
},
|
|
1224
|
+
shadowrootserializable: {
|
|
1225
|
+
$: "shadowRootSerializable",
|
|
1226
|
+
TEMPLATE: 1
|
|
1227
|
+
},
|
|
1228
|
+
sharedstoragewritable: {
|
|
1229
|
+
$: "sharedStorageWritable",
|
|
1230
|
+
IFRAME: 1,
|
|
1231
|
+
IMG: 1
|
|
1082
1232
|
}
|
|
1083
|
-
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
return fn();
|
|
1089
|
-
} finally {
|
|
1090
|
-
ctxStack.pop();
|
|
1233
|
+
};
|
|
1234
|
+
function getPropAlias(prop, tagName) {
|
|
1235
|
+
const a = PropAliases[prop];
|
|
1236
|
+
if (typeof a === "object") {
|
|
1237
|
+
return a[tagName] ? a["$"] : void 0;
|
|
1091
1238
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
// src/versioned-signal.ts
|
|
1095
|
-
function createVersionedSignal(initialValue, options2) {
|
|
1096
|
-
const equals = options2?.equals ?? Object.is;
|
|
1097
|
-
const value = signal(initialValue);
|
|
1098
|
-
const version = signal(0);
|
|
1099
|
-
const bumpVersion = () => {
|
|
1100
|
-
const next = version() + 1;
|
|
1101
|
-
version(next);
|
|
1102
|
-
};
|
|
1103
|
-
return {
|
|
1104
|
-
read: () => {
|
|
1105
|
-
version();
|
|
1106
|
-
return value();
|
|
1107
|
-
},
|
|
1108
|
-
write: (next) => {
|
|
1109
|
-
const prev = value();
|
|
1110
|
-
if (!equals(prev, next)) {
|
|
1111
|
-
value(next);
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
bumpVersion();
|
|
1115
|
-
},
|
|
1116
|
-
force: () => {
|
|
1117
|
-
bumpVersion();
|
|
1118
|
-
},
|
|
1119
|
-
peekVersion: () => version(),
|
|
1120
|
-
peekValue: () => value()
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
// src/props.ts
|
|
1125
|
-
var propGetters = /* @__PURE__ */ new WeakSet();
|
|
1126
|
-
var rawToProxy = /* @__PURE__ */ new WeakMap();
|
|
1127
|
-
var proxyToRaw = /* @__PURE__ */ new WeakMap();
|
|
1128
|
-
function __fictProp(getter) {
|
|
1129
|
-
if (typeof getter === "function" && getter.length === 0) {
|
|
1130
|
-
propGetters.add(getter);
|
|
1131
|
-
}
|
|
1132
|
-
return getter;
|
|
1133
|
-
}
|
|
1134
|
-
function isPropGetter(value) {
|
|
1135
|
-
return typeof value === "function" && propGetters.has(value);
|
|
1136
|
-
}
|
|
1137
|
-
function createPropsProxy(props) {
|
|
1138
|
-
if (!props || typeof props !== "object") {
|
|
1139
|
-
return props;
|
|
1140
|
-
}
|
|
1141
|
-
if (proxyToRaw.has(props)) {
|
|
1142
|
-
return props;
|
|
1143
|
-
}
|
|
1144
|
-
const cached = rawToProxy.get(props);
|
|
1145
|
-
if (cached) {
|
|
1146
|
-
return cached;
|
|
1147
|
-
}
|
|
1148
|
-
const proxy = new Proxy(props, {
|
|
1149
|
-
get(target, prop, receiver) {
|
|
1150
|
-
const value = Reflect.get(target, prop, receiver);
|
|
1151
|
-
if (isPropGetter(value)) {
|
|
1152
|
-
return value();
|
|
1153
|
-
}
|
|
1154
|
-
return value;
|
|
1155
|
-
},
|
|
1156
|
-
set(target, prop, value, receiver) {
|
|
1157
|
-
return Reflect.set(target, prop, value, receiver);
|
|
1158
|
-
},
|
|
1159
|
-
has(target, prop) {
|
|
1160
|
-
return prop in target;
|
|
1161
|
-
},
|
|
1162
|
-
ownKeys(target) {
|
|
1163
|
-
return Reflect.ownKeys(target);
|
|
1164
|
-
},
|
|
1165
|
-
getOwnPropertyDescriptor(target, prop) {
|
|
1166
|
-
return Object.getOwnPropertyDescriptor(target, prop);
|
|
1167
|
-
}
|
|
1168
|
-
});
|
|
1169
|
-
rawToProxy.set(props, proxy);
|
|
1170
|
-
proxyToRaw.set(proxy, props);
|
|
1171
|
-
return proxy;
|
|
1172
|
-
}
|
|
1173
|
-
function unwrapProps(props) {
|
|
1174
|
-
if (!props || typeof props !== "object") {
|
|
1175
|
-
return props;
|
|
1176
|
-
}
|
|
1177
|
-
return proxyToRaw.get(props) ?? props;
|
|
1178
|
-
}
|
|
1179
|
-
function __fictPropsRest(props, exclude) {
|
|
1180
|
-
const raw = unwrapProps(props);
|
|
1181
|
-
const out = {};
|
|
1182
|
-
const excludeSet = new Set(exclude);
|
|
1183
|
-
for (const key of Reflect.ownKeys(raw)) {
|
|
1184
|
-
if (excludeSet.has(key)) continue;
|
|
1185
|
-
out[key] = raw[key];
|
|
1186
|
-
}
|
|
1187
|
-
return createPropsProxy(out);
|
|
1188
|
-
}
|
|
1189
|
-
function mergeProps(...sources) {
|
|
1190
|
-
const validSources = sources.filter(
|
|
1191
|
-
(s) => s != null && (typeof s === "object" || typeof s === "function")
|
|
1192
|
-
);
|
|
1193
|
-
if (validSources.length === 0) {
|
|
1194
|
-
return {};
|
|
1195
|
-
}
|
|
1196
|
-
if (validSources.length === 1 && typeof validSources[0] === "object") {
|
|
1197
|
-
return validSources[0];
|
|
1198
|
-
}
|
|
1199
|
-
const resolveSource = (src) => {
|
|
1200
|
-
const value = typeof src === "function" ? src() : src;
|
|
1201
|
-
if (!value || typeof value !== "object") return void 0;
|
|
1202
|
-
return unwrapProps(value);
|
|
1203
|
-
};
|
|
1204
|
-
return new Proxy({}, {
|
|
1205
|
-
get(_, prop) {
|
|
1206
|
-
if (typeof prop === "symbol") {
|
|
1207
|
-
return void 0;
|
|
1208
|
-
}
|
|
1209
|
-
for (let i = validSources.length - 1; i >= 0; i--) {
|
|
1210
|
-
const src = validSources[i];
|
|
1211
|
-
const raw = resolveSource(src);
|
|
1212
|
-
if (!raw || !(prop in raw)) continue;
|
|
1213
|
-
const value = raw[prop];
|
|
1214
|
-
if (typeof src === "function" && !isPropGetter(value)) {
|
|
1215
|
-
return __fictProp(() => {
|
|
1216
|
-
const latest = resolveSource(src);
|
|
1217
|
-
if (!latest || !(prop in latest)) return void 0;
|
|
1218
|
-
return latest[prop];
|
|
1219
|
-
});
|
|
1220
|
-
}
|
|
1221
|
-
return value;
|
|
1222
|
-
}
|
|
1223
|
-
return void 0;
|
|
1224
|
-
},
|
|
1225
|
-
has(_, prop) {
|
|
1226
|
-
for (const src of validSources) {
|
|
1227
|
-
const raw = resolveSource(src);
|
|
1228
|
-
if (raw && prop in raw) {
|
|
1229
|
-
return true;
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
return false;
|
|
1233
|
-
},
|
|
1234
|
-
ownKeys() {
|
|
1235
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1236
|
-
for (const src of validSources) {
|
|
1237
|
-
const raw = resolveSource(src);
|
|
1238
|
-
if (raw) {
|
|
1239
|
-
for (const key of Reflect.ownKeys(raw)) {
|
|
1240
|
-
keys.add(key);
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
return Array.from(keys);
|
|
1245
|
-
},
|
|
1246
|
-
getOwnPropertyDescriptor(_, prop) {
|
|
1247
|
-
for (let i = validSources.length - 1; i >= 0; i--) {
|
|
1248
|
-
const raw = resolveSource(validSources[i]);
|
|
1249
|
-
if (raw && prop in raw) {
|
|
1250
|
-
return {
|
|
1251
|
-
enumerable: true,
|
|
1252
|
-
configurable: true,
|
|
1253
|
-
get: () => {
|
|
1254
|
-
const value = raw[prop];
|
|
1255
|
-
return value;
|
|
1256
|
-
}
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
return void 0;
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
function useProp(getter) {
|
|
1265
|
-
return __fictProp(createMemo(getter));
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
// src/ref.ts
|
|
1269
|
-
function createRef() {
|
|
1270
|
-
return { current: null };
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
// src/transition.ts
|
|
1274
|
-
function startTransition(fn) {
|
|
1275
|
-
const prev = setTransitionContext(true);
|
|
1276
|
-
try {
|
|
1277
|
-
fn();
|
|
1278
|
-
} finally {
|
|
1279
|
-
setTransitionContext(prev);
|
|
1280
|
-
scheduleFlush();
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
function useTransition() {
|
|
1284
|
-
const pending = signal(false);
|
|
1285
|
-
const start = (fn) => {
|
|
1286
|
-
pending(true);
|
|
1287
|
-
startTransition(() => {
|
|
1288
|
-
try {
|
|
1289
|
-
fn();
|
|
1290
|
-
} finally {
|
|
1291
|
-
pending(false);
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
};
|
|
1295
|
-
return [() => pending(), start];
|
|
1296
|
-
}
|
|
1297
|
-
function useDeferredValue(getValue) {
|
|
1298
|
-
const deferredValue = signal(getValue());
|
|
1299
|
-
createEffect(() => {
|
|
1300
|
-
const newValue = getValue();
|
|
1301
|
-
const currentDeferred = untrack(() => deferredValue());
|
|
1302
|
-
if (currentDeferred !== newValue) {
|
|
1303
|
-
startTransition(() => {
|
|
1304
|
-
deferredValue(newValue);
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
});
|
|
1308
|
-
return () => deferredValue();
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
// src/scheduler.ts
|
|
1312
|
-
function batch2(fn) {
|
|
1313
|
-
return batch(fn);
|
|
1314
|
-
}
|
|
1315
|
-
function untrack2(fn) {
|
|
1316
|
-
return untrack(fn);
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
// src/jsx.ts
|
|
1320
|
-
var Fragment = Symbol("Fragment");
|
|
1321
|
-
|
|
1322
|
-
// src/constants.ts
|
|
1323
|
-
var booleans = [
|
|
1324
|
-
"allowfullscreen",
|
|
1325
|
-
"async",
|
|
1326
|
-
"alpha",
|
|
1327
|
-
// HTMLInputElement
|
|
1328
|
-
"autofocus",
|
|
1329
|
-
// HTMLElement prop
|
|
1330
|
-
"autoplay",
|
|
1331
|
-
"checked",
|
|
1332
|
-
"controls",
|
|
1333
|
-
"default",
|
|
1334
|
-
"disabled",
|
|
1335
|
-
"formnovalidate",
|
|
1336
|
-
"hidden",
|
|
1337
|
-
// HTMLElement prop
|
|
1338
|
-
"indeterminate",
|
|
1339
|
-
"inert",
|
|
1340
|
-
// HTMLElement prop
|
|
1341
|
-
"ismap",
|
|
1342
|
-
"loop",
|
|
1343
|
-
"multiple",
|
|
1344
|
-
"muted",
|
|
1345
|
-
"nomodule",
|
|
1346
|
-
"novalidate",
|
|
1347
|
-
"open",
|
|
1348
|
-
"playsinline",
|
|
1349
|
-
"readonly",
|
|
1350
|
-
"required",
|
|
1351
|
-
"reversed",
|
|
1352
|
-
"seamless",
|
|
1353
|
-
// HTMLIframeElement - non-standard
|
|
1354
|
-
"selected",
|
|
1355
|
-
// Experimental attributes
|
|
1356
|
-
"adauctionheaders",
|
|
1357
|
-
"browsingtopics",
|
|
1358
|
-
"credentialless",
|
|
1359
|
-
"defaultchecked",
|
|
1360
|
-
"defaultmuted",
|
|
1361
|
-
"defaultselected",
|
|
1362
|
-
"defer",
|
|
1363
|
-
"disablepictureinpicture",
|
|
1364
|
-
"disableremoteplayback",
|
|
1365
|
-
"preservespitch",
|
|
1366
|
-
"shadowrootclonable",
|
|
1367
|
-
"shadowrootcustomelementregistry",
|
|
1368
|
-
"shadowrootdelegatesfocus",
|
|
1369
|
-
"shadowrootserializable",
|
|
1370
|
-
"sharedstoragewritable"
|
|
1371
|
-
];
|
|
1372
|
-
var BooleanAttributes = new Set(booleans);
|
|
1373
|
-
var Properties = /* @__PURE__ */ new Set([
|
|
1374
|
-
// Core properties
|
|
1375
|
-
"className",
|
|
1376
|
-
"value",
|
|
1377
|
-
// CamelCase booleans
|
|
1378
|
-
"readOnly",
|
|
1379
|
-
"noValidate",
|
|
1380
|
-
"formNoValidate",
|
|
1381
|
-
"isMap",
|
|
1382
|
-
"noModule",
|
|
1383
|
-
"playsInline",
|
|
1384
|
-
// Experimental (camelCase)
|
|
1385
|
-
"adAuctionHeaders",
|
|
1386
|
-
"allowFullscreen",
|
|
1387
|
-
"browsingTopics",
|
|
1388
|
-
"defaultChecked",
|
|
1389
|
-
"defaultMuted",
|
|
1390
|
-
"defaultSelected",
|
|
1391
|
-
"disablePictureInPicture",
|
|
1392
|
-
"disableRemotePlayback",
|
|
1393
|
-
"preservesPitch",
|
|
1394
|
-
"shadowRootClonable",
|
|
1395
|
-
"shadowRootCustomElementRegistry",
|
|
1396
|
-
"shadowRootDelegatesFocus",
|
|
1397
|
-
"shadowRootSerializable",
|
|
1398
|
-
"sharedStorageWritable",
|
|
1399
|
-
// All lowercase booleans
|
|
1400
|
-
...booleans
|
|
1401
|
-
]);
|
|
1402
|
-
var ChildProperties = /* @__PURE__ */ new Set([
|
|
1403
|
-
"innerHTML",
|
|
1404
|
-
"textContent",
|
|
1405
|
-
"innerText",
|
|
1406
|
-
"children"
|
|
1407
|
-
]);
|
|
1408
|
-
var Aliases = {
|
|
1409
|
-
className: "class",
|
|
1410
|
-
htmlFor: "for"
|
|
1411
|
-
};
|
|
1412
|
-
var PropAliases = {
|
|
1413
|
-
// Direct mapping
|
|
1414
|
-
class: "className",
|
|
1415
|
-
// Element-specific mappings
|
|
1416
|
-
novalidate: {
|
|
1417
|
-
$: "noValidate",
|
|
1418
|
-
FORM: 1
|
|
1419
|
-
},
|
|
1420
|
-
formnovalidate: {
|
|
1421
|
-
$: "formNoValidate",
|
|
1422
|
-
BUTTON: 1,
|
|
1423
|
-
INPUT: 1
|
|
1424
|
-
},
|
|
1425
|
-
ismap: {
|
|
1426
|
-
$: "isMap",
|
|
1427
|
-
IMG: 1
|
|
1428
|
-
},
|
|
1429
|
-
nomodule: {
|
|
1430
|
-
$: "noModule",
|
|
1431
|
-
SCRIPT: 1
|
|
1432
|
-
},
|
|
1433
|
-
playsinline: {
|
|
1434
|
-
$: "playsInline",
|
|
1435
|
-
VIDEO: 1
|
|
1436
|
-
},
|
|
1437
|
-
readonly: {
|
|
1438
|
-
$: "readOnly",
|
|
1439
|
-
INPUT: 1,
|
|
1440
|
-
TEXTAREA: 1
|
|
1441
|
-
},
|
|
1442
|
-
// Experimental element-specific
|
|
1443
|
-
adauctionheaders: {
|
|
1444
|
-
$: "adAuctionHeaders",
|
|
1445
|
-
IFRAME: 1
|
|
1446
|
-
},
|
|
1447
|
-
allowfullscreen: {
|
|
1448
|
-
$: "allowFullscreen",
|
|
1449
|
-
IFRAME: 1
|
|
1450
|
-
},
|
|
1451
|
-
browsingtopics: {
|
|
1452
|
-
$: "browsingTopics",
|
|
1453
|
-
IMG: 1
|
|
1454
|
-
},
|
|
1455
|
-
defaultchecked: {
|
|
1456
|
-
$: "defaultChecked",
|
|
1457
|
-
INPUT: 1
|
|
1458
|
-
},
|
|
1459
|
-
defaultmuted: {
|
|
1460
|
-
$: "defaultMuted",
|
|
1461
|
-
AUDIO: 1,
|
|
1462
|
-
VIDEO: 1
|
|
1463
|
-
},
|
|
1464
|
-
defaultselected: {
|
|
1465
|
-
$: "defaultSelected",
|
|
1466
|
-
OPTION: 1
|
|
1467
|
-
},
|
|
1468
|
-
disablepictureinpicture: {
|
|
1469
|
-
$: "disablePictureInPicture",
|
|
1470
|
-
VIDEO: 1
|
|
1471
|
-
},
|
|
1472
|
-
disableremoteplayback: {
|
|
1473
|
-
$: "disableRemotePlayback",
|
|
1474
|
-
AUDIO: 1,
|
|
1475
|
-
VIDEO: 1
|
|
1476
|
-
},
|
|
1477
|
-
preservespitch: {
|
|
1478
|
-
$: "preservesPitch",
|
|
1479
|
-
AUDIO: 1,
|
|
1480
|
-
VIDEO: 1
|
|
1481
|
-
},
|
|
1482
|
-
shadowrootclonable: {
|
|
1483
|
-
$: "shadowRootClonable",
|
|
1484
|
-
TEMPLATE: 1
|
|
1485
|
-
},
|
|
1486
|
-
shadowrootdelegatesfocus: {
|
|
1487
|
-
$: "shadowRootDelegatesFocus",
|
|
1488
|
-
TEMPLATE: 1
|
|
1489
|
-
},
|
|
1490
|
-
shadowrootserializable: {
|
|
1491
|
-
$: "shadowRootSerializable",
|
|
1492
|
-
TEMPLATE: 1
|
|
1493
|
-
},
|
|
1494
|
-
sharedstoragewritable: {
|
|
1495
|
-
$: "sharedStorageWritable",
|
|
1496
|
-
IFRAME: 1,
|
|
1497
|
-
IMG: 1
|
|
1498
|
-
}
|
|
1499
|
-
};
|
|
1500
|
-
function getPropAlias(prop, tagName) {
|
|
1501
|
-
const a = PropAliases[prop];
|
|
1502
|
-
if (typeof a === "object") {
|
|
1503
|
-
return a[tagName] ? a["$"] : void 0;
|
|
1504
|
-
}
|
|
1505
|
-
return a;
|
|
1239
|
+
return a;
|
|
1506
1240
|
}
|
|
1507
1241
|
var $$EVENTS = "_$FICT_DELEGATE";
|
|
1508
1242
|
var DelegatedEvents = /* @__PURE__ */ new Set([
|
|
@@ -1690,6 +1424,9 @@ var UnitlessStyles = /* @__PURE__ */ new Set([
|
|
|
1690
1424
|
"stroke-width"
|
|
1691
1425
|
]);
|
|
1692
1426
|
|
|
1427
|
+
// src/jsx.ts
|
|
1428
|
+
var Fragment = Symbol("Fragment");
|
|
1429
|
+
|
|
1693
1430
|
// src/node-ops.ts
|
|
1694
1431
|
function toNodeArray(node) {
|
|
1695
1432
|
try {
|
|
@@ -2869,256 +2606,566 @@ function createPortal(container, render2, createElementFn) {
|
|
|
2869
2606
|
currentRoot2 = null;
|
|
2870
2607
|
}
|
|
2871
2608
|
}
|
|
2872
|
-
});
|
|
2873
|
-
const portalDispose = () => {
|
|
2874
|
-
dispose();
|
|
2875
|
-
if (currentRoot2) {
|
|
2876
|
-
destroyRoot(currentRoot2);
|
|
2609
|
+
});
|
|
2610
|
+
const portalDispose = () => {
|
|
2611
|
+
dispose();
|
|
2612
|
+
if (currentRoot2) {
|
|
2613
|
+
destroyRoot(currentRoot2);
|
|
2614
|
+
}
|
|
2615
|
+
if (currentNodes.length > 0) {
|
|
2616
|
+
removeNodes(currentNodes);
|
|
2617
|
+
}
|
|
2618
|
+
marker.parentNode?.removeChild(marker);
|
|
2619
|
+
};
|
|
2620
|
+
if (parentRoot) {
|
|
2621
|
+
parentRoot.destroyCallbacks.push(portalDispose);
|
|
2622
|
+
}
|
|
2623
|
+
return {
|
|
2624
|
+
marker,
|
|
2625
|
+
dispose: portalDispose
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
function mountBlock(initialValue, initialIndex, renderItem, parent, anchor, createElementFn) {
|
|
2629
|
+
const start = document.createComment("fict:block:start");
|
|
2630
|
+
const end = document.createComment("fict:block:end");
|
|
2631
|
+
const valueSig = signal(initialValue);
|
|
2632
|
+
const indexSig = signal(initialIndex);
|
|
2633
|
+
const versionSig = signal(0);
|
|
2634
|
+
const valueProxy = createValueProxy(() => {
|
|
2635
|
+
versionSig();
|
|
2636
|
+
return valueSig();
|
|
2637
|
+
});
|
|
2638
|
+
const renderCurrent = () => renderItem(valueProxy, indexSig());
|
|
2639
|
+
const root = createRootContext();
|
|
2640
|
+
const prev = pushRoot(root);
|
|
2641
|
+
const nodes = [start];
|
|
2642
|
+
let handledError = false;
|
|
2643
|
+
try {
|
|
2644
|
+
const output = renderCurrent();
|
|
2645
|
+
if (output != null && output !== false) {
|
|
2646
|
+
const el = createElementFn(output);
|
|
2647
|
+
const rendered = toNodeArray(el);
|
|
2648
|
+
nodes.push(...rendered);
|
|
2649
|
+
}
|
|
2650
|
+
nodes.push(end);
|
|
2651
|
+
insertNodesBefore(parent, nodes, anchor);
|
|
2652
|
+
} catch (err) {
|
|
2653
|
+
if (handleSuspend(err, root)) {
|
|
2654
|
+
handledError = true;
|
|
2655
|
+
nodes.push(end);
|
|
2656
|
+
insertNodesBefore(parent, nodes, anchor);
|
|
2657
|
+
} else if (handleError(err, { source: "renderChild" }, root)) {
|
|
2658
|
+
handledError = true;
|
|
2659
|
+
nodes.push(end);
|
|
2660
|
+
insertNodesBefore(parent, nodes, anchor);
|
|
2661
|
+
} else {
|
|
2662
|
+
throw err;
|
|
2663
|
+
}
|
|
2664
|
+
} finally {
|
|
2665
|
+
popRoot(prev);
|
|
2666
|
+
if (!handledError) {
|
|
2667
|
+
flushOnMount(root);
|
|
2668
|
+
} else {
|
|
2669
|
+
destroyRoot(root);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
return {
|
|
2673
|
+
nodes,
|
|
2674
|
+
root,
|
|
2675
|
+
value: valueSig,
|
|
2676
|
+
index: indexSig,
|
|
2677
|
+
version: versionSig,
|
|
2678
|
+
start,
|
|
2679
|
+
end,
|
|
2680
|
+
valueProxy,
|
|
2681
|
+
renderCurrent
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
function rerenderBlock(block, createElementFn) {
|
|
2685
|
+
const currentContent = block.nodes.slice(1, Math.max(1, block.nodes.length - 1));
|
|
2686
|
+
const currentNode = currentContent.length === 1 ? currentContent[0] : null;
|
|
2687
|
+
clearRoot(block.root);
|
|
2688
|
+
const prev = pushRoot(block.root);
|
|
2689
|
+
let nextOutput;
|
|
2690
|
+
let handledError = false;
|
|
2691
|
+
try {
|
|
2692
|
+
nextOutput = block.renderCurrent();
|
|
2693
|
+
} catch (err) {
|
|
2694
|
+
if (handleSuspend(err, block.root)) {
|
|
2695
|
+
handledError = true;
|
|
2696
|
+
popRoot(prev);
|
|
2697
|
+
destroyRoot(block.root);
|
|
2698
|
+
block.nodes = [block.start, block.end];
|
|
2699
|
+
return block;
|
|
2700
|
+
}
|
|
2701
|
+
if (handleError(err, { source: "renderChild" }, block.root)) {
|
|
2702
|
+
handledError = true;
|
|
2703
|
+
popRoot(prev);
|
|
2704
|
+
destroyRoot(block.root);
|
|
2705
|
+
block.nodes = [block.start, block.end];
|
|
2706
|
+
return block;
|
|
2707
|
+
}
|
|
2708
|
+
throw err;
|
|
2709
|
+
} finally {
|
|
2710
|
+
if (!handledError) {
|
|
2711
|
+
popRoot(prev);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
if (isFragmentVNode(nextOutput) && currentContent.length > 0) {
|
|
2715
|
+
const patched = patchFragmentChildren(currentContent, nextOutput.props?.children);
|
|
2716
|
+
if (patched) {
|
|
2717
|
+
block.nodes = [block.start, ...currentContent, block.end];
|
|
2718
|
+
return block;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
if (currentNode && patchNode(currentNode, nextOutput)) {
|
|
2722
|
+
block.nodes = [block.start, currentNode, block.end];
|
|
2723
|
+
return block;
|
|
2724
|
+
}
|
|
2725
|
+
clearContent(block);
|
|
2726
|
+
if (nextOutput != null && nextOutput !== false) {
|
|
2727
|
+
const newNodes = toNodeArray(
|
|
2728
|
+
nextOutput instanceof Node ? nextOutput : createElementFn(nextOutput)
|
|
2729
|
+
);
|
|
2730
|
+
insertNodesBefore(block.start.parentNode, newNodes, block.end);
|
|
2731
|
+
block.nodes = [block.start, ...newNodes, block.end];
|
|
2732
|
+
} else {
|
|
2733
|
+
block.nodes = [block.start, block.end];
|
|
2734
|
+
}
|
|
2735
|
+
return block;
|
|
2736
|
+
}
|
|
2737
|
+
function patchElement(el, output) {
|
|
2738
|
+
if (output === null || output === void 0 || output === false || typeof output === "string" || typeof output === "number") {
|
|
2739
|
+
el.textContent = output === null || output === void 0 || output === false ? "" : String(output);
|
|
2740
|
+
return true;
|
|
2741
|
+
}
|
|
2742
|
+
if (output instanceof Text) {
|
|
2743
|
+
el.textContent = output.data;
|
|
2744
|
+
return true;
|
|
2745
|
+
}
|
|
2746
|
+
if (output && typeof output === "object" && !(output instanceof Node)) {
|
|
2747
|
+
const vnode = output;
|
|
2748
|
+
if (typeof vnode.type === "string" && vnode.type.toLowerCase() === el.tagName.toLowerCase()) {
|
|
2749
|
+
const children = vnode.props?.children;
|
|
2750
|
+
const props = vnode.props ?? {};
|
|
2751
|
+
for (const [key, value] of Object.entries(props)) {
|
|
2752
|
+
if (key === "children" || key === "key") continue;
|
|
2753
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null || value === void 0) {
|
|
2754
|
+
if (key === "class" || key === "className") {
|
|
2755
|
+
el.setAttribute("class", value === false || value === null ? "" : String(value));
|
|
2756
|
+
} else if (key === "style" && typeof value === "string") {
|
|
2757
|
+
el.style.cssText = value;
|
|
2758
|
+
} else if (value === false || value === null || value === void 0) {
|
|
2759
|
+
el.removeAttribute(key);
|
|
2760
|
+
} else if (value === true) {
|
|
2761
|
+
el.setAttribute(key, "");
|
|
2762
|
+
} else {
|
|
2763
|
+
el.setAttribute(key, String(value));
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
if (typeof children === "string" || typeof children === "number" || children === null || children === void 0 || children === false) {
|
|
2768
|
+
el.textContent = children === null || children === void 0 || children === false ? "" : String(children);
|
|
2769
|
+
return true;
|
|
2770
|
+
}
|
|
2771
|
+
if (children && typeof children === "object" && !Array.isArray(children) && !(children instanceof Node)) {
|
|
2772
|
+
const childVNode = children;
|
|
2773
|
+
if (typeof childVNode.type === "string") {
|
|
2774
|
+
const childEl = el.querySelector(childVNode.type);
|
|
2775
|
+
if (childEl && patchElement(childEl, children)) {
|
|
2776
|
+
return true;
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
}
|
|
2780
|
+
return false;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
if (output instanceof Node) {
|
|
2784
|
+
if (output.nodeType === Node.ELEMENT_NODE) {
|
|
2785
|
+
const nextEl = output;
|
|
2786
|
+
if (nextEl.tagName.toLowerCase() === el.tagName.toLowerCase()) {
|
|
2787
|
+
el.textContent = nextEl.textContent;
|
|
2788
|
+
return true;
|
|
2789
|
+
}
|
|
2790
|
+
} else if (output.nodeType === Node.TEXT_NODE) {
|
|
2791
|
+
el.textContent = output.data;
|
|
2792
|
+
return true;
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
return false;
|
|
2796
|
+
}
|
|
2797
|
+
function patchNode(currentNode, nextOutput) {
|
|
2798
|
+
if (!currentNode) return false;
|
|
2799
|
+
if (currentNode instanceof Text && (nextOutput === null || nextOutput === void 0 || nextOutput === false || typeof nextOutput === "string" || typeof nextOutput === "number" || nextOutput instanceof Text)) {
|
|
2800
|
+
const nextText = nextOutput instanceof Text ? nextOutput.data : nextOutput === null || nextOutput === void 0 || nextOutput === false ? "" : String(nextOutput);
|
|
2801
|
+
currentNode.data = nextText;
|
|
2802
|
+
return true;
|
|
2803
|
+
}
|
|
2804
|
+
if (currentNode instanceof Element && patchElement(currentNode, nextOutput)) {
|
|
2805
|
+
return true;
|
|
2806
|
+
}
|
|
2807
|
+
if (nextOutput instanceof Node && currentNode === nextOutput) {
|
|
2808
|
+
return true;
|
|
2809
|
+
}
|
|
2810
|
+
return false;
|
|
2811
|
+
}
|
|
2812
|
+
function isFragmentVNode(value) {
|
|
2813
|
+
return value != null && typeof value === "object" && !(value instanceof Node) && value.type === Fragment;
|
|
2814
|
+
}
|
|
2815
|
+
function normalizeChildren(children, result = []) {
|
|
2816
|
+
if (children === void 0) {
|
|
2817
|
+
return result;
|
|
2818
|
+
}
|
|
2819
|
+
if (Array.isArray(children)) {
|
|
2820
|
+
for (const child of children) {
|
|
2821
|
+
normalizeChildren(child, result);
|
|
2822
|
+
}
|
|
2823
|
+
return result;
|
|
2824
|
+
}
|
|
2825
|
+
if (children === null || children === false) {
|
|
2826
|
+
return result;
|
|
2827
|
+
}
|
|
2828
|
+
result.push(children);
|
|
2829
|
+
return result;
|
|
2830
|
+
}
|
|
2831
|
+
function patchFragmentChildren(nodes, children) {
|
|
2832
|
+
const normalized = normalizeChildren(children);
|
|
2833
|
+
if (normalized.length !== nodes.length) {
|
|
2834
|
+
return false;
|
|
2835
|
+
}
|
|
2836
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
2837
|
+
if (!patchNode(nodes[i], normalized[i])) {
|
|
2838
|
+
return false;
|
|
2877
2839
|
}
|
|
2878
|
-
|
|
2879
|
-
|
|
2840
|
+
}
|
|
2841
|
+
return true;
|
|
2842
|
+
}
|
|
2843
|
+
function clearContent(block) {
|
|
2844
|
+
const nodes = block.nodes.slice(1, Math.max(1, block.nodes.length - 1));
|
|
2845
|
+
removeNodes(nodes);
|
|
2846
|
+
}
|
|
2847
|
+
function removeBlockNodes(block) {
|
|
2848
|
+
let cursor = block.start;
|
|
2849
|
+
const end = block.end;
|
|
2850
|
+
while (cursor) {
|
|
2851
|
+
const next = cursor.nextSibling;
|
|
2852
|
+
cursor.parentNode?.removeChild(cursor);
|
|
2853
|
+
if (cursor === end) break;
|
|
2854
|
+
cursor = next;
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
function bumpBlockVersion(block) {
|
|
2858
|
+
block.version(block.version() + 1);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
// src/scope.ts
|
|
2862
|
+
function createScope() {
|
|
2863
|
+
let dispose = null;
|
|
2864
|
+
const stop = () => {
|
|
2865
|
+
if (dispose) {
|
|
2866
|
+
dispose();
|
|
2867
|
+
dispose = null;
|
|
2880
2868
|
}
|
|
2881
|
-
marker.parentNode?.removeChild(marker);
|
|
2882
2869
|
};
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
dispose: portalDispose
|
|
2870
|
+
const run = (fn) => {
|
|
2871
|
+
stop();
|
|
2872
|
+
const { dispose: rootDispose, value } = createRoot(fn);
|
|
2873
|
+
dispose = rootDispose;
|
|
2874
|
+
return value;
|
|
2889
2875
|
};
|
|
2876
|
+
registerRootCleanup(stop);
|
|
2877
|
+
return { run, stop };
|
|
2890
2878
|
}
|
|
2891
|
-
function
|
|
2892
|
-
const
|
|
2893
|
-
const
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
versionSig();
|
|
2899
|
-
return valueSig();
|
|
2900
|
-
});
|
|
2901
|
-
const renderCurrent = () => renderItem(valueProxy, indexSig());
|
|
2902
|
-
const root = createRootContext();
|
|
2903
|
-
const prev = pushRoot(root);
|
|
2904
|
-
const nodes = [start];
|
|
2905
|
-
let handledError = false;
|
|
2906
|
-
try {
|
|
2907
|
-
const output = renderCurrent();
|
|
2908
|
-
if (output != null && output !== false) {
|
|
2909
|
-
const el = createElementFn(output);
|
|
2910
|
-
const rendered = toNodeArray(el);
|
|
2911
|
-
nodes.push(...rendered);
|
|
2912
|
-
}
|
|
2913
|
-
nodes.push(end);
|
|
2914
|
-
insertNodesBefore(parent, nodes, anchor);
|
|
2915
|
-
} catch (err) {
|
|
2916
|
-
if (handleSuspend(err, root)) {
|
|
2917
|
-
handledError = true;
|
|
2918
|
-
nodes.push(end);
|
|
2919
|
-
insertNodesBefore(parent, nodes, anchor);
|
|
2920
|
-
} else if (handleError(err, { source: "renderChild" }, root)) {
|
|
2921
|
-
handledError = true;
|
|
2922
|
-
nodes.push(end);
|
|
2923
|
-
insertNodesBefore(parent, nodes, anchor);
|
|
2879
|
+
function runInScope(flag, fn) {
|
|
2880
|
+
const scope = createScope();
|
|
2881
|
+
const evaluate = () => isReactive(flag) ? flag() : !!flag;
|
|
2882
|
+
createEffect(() => {
|
|
2883
|
+
const enabled = evaluate();
|
|
2884
|
+
if (enabled) {
|
|
2885
|
+
scope.run(fn);
|
|
2924
2886
|
} else {
|
|
2925
|
-
|
|
2887
|
+
scope.stop();
|
|
2926
2888
|
}
|
|
2889
|
+
});
|
|
2890
|
+
onCleanup(scope.stop);
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2893
|
+
// src/hooks.ts
|
|
2894
|
+
var ctxStack = [];
|
|
2895
|
+
function __fictUseContext() {
|
|
2896
|
+
if (ctxStack.length === 0) {
|
|
2897
|
+
const ctx2 = { slots: [], cursor: 0 };
|
|
2898
|
+
ctxStack.push(ctx2);
|
|
2899
|
+
return ctx2;
|
|
2900
|
+
}
|
|
2901
|
+
const ctx = ctxStack[ctxStack.length - 1];
|
|
2902
|
+
ctx.cursor = 0;
|
|
2903
|
+
return ctx;
|
|
2904
|
+
}
|
|
2905
|
+
function __fictPushContext() {
|
|
2906
|
+
const ctx = { slots: [], cursor: 0 };
|
|
2907
|
+
ctxStack.push(ctx);
|
|
2908
|
+
return ctx;
|
|
2909
|
+
}
|
|
2910
|
+
function __fictPopContext() {
|
|
2911
|
+
ctxStack.pop();
|
|
2912
|
+
}
|
|
2913
|
+
function __fictResetContext() {
|
|
2914
|
+
ctxStack.length = 0;
|
|
2915
|
+
}
|
|
2916
|
+
function __fictUseSignal(ctx, initial, slot) {
|
|
2917
|
+
const index = slot ?? ctx.cursor++;
|
|
2918
|
+
if (!ctx.slots[index]) {
|
|
2919
|
+
ctx.slots[index] = signal(initial);
|
|
2920
|
+
}
|
|
2921
|
+
return ctx.slots[index];
|
|
2922
|
+
}
|
|
2923
|
+
function __fictUseMemo(ctx, fn, slot) {
|
|
2924
|
+
const index = slot ?? ctx.cursor++;
|
|
2925
|
+
if (!ctx.slots[index]) {
|
|
2926
|
+
ctx.slots[index] = createMemo(fn);
|
|
2927
|
+
}
|
|
2928
|
+
return ctx.slots[index];
|
|
2929
|
+
}
|
|
2930
|
+
function __fictUseEffect(ctx, fn, slot) {
|
|
2931
|
+
const index = slot ?? ctx.cursor++;
|
|
2932
|
+
if (!ctx.slots[index]) {
|
|
2933
|
+
ctx.slots[index] = createEffect(fn);
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
function __fictRender(ctx, fn) {
|
|
2937
|
+
ctxStack.push(ctx);
|
|
2938
|
+
ctx.cursor = 0;
|
|
2939
|
+
try {
|
|
2940
|
+
return fn();
|
|
2927
2941
|
} finally {
|
|
2928
|
-
|
|
2929
|
-
if (!handledError) {
|
|
2930
|
-
flushOnMount(root);
|
|
2931
|
-
} else {
|
|
2932
|
-
destroyRoot(root);
|
|
2933
|
-
}
|
|
2942
|
+
ctxStack.pop();
|
|
2934
2943
|
}
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2946
|
+
// src/versioned-signal.ts
|
|
2947
|
+
function createVersionedSignal(initialValue, options2) {
|
|
2948
|
+
const equals = options2?.equals ?? Object.is;
|
|
2949
|
+
const value = signal(initialValue);
|
|
2950
|
+
const version = signal(0);
|
|
2951
|
+
const bumpVersion = () => {
|
|
2952
|
+
const next = version() + 1;
|
|
2953
|
+
version(next);
|
|
2954
|
+
};
|
|
2935
2955
|
return {
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2956
|
+
read: () => {
|
|
2957
|
+
version();
|
|
2958
|
+
return value();
|
|
2959
|
+
},
|
|
2960
|
+
write: (next) => {
|
|
2961
|
+
const prev = value();
|
|
2962
|
+
if (!equals(prev, next)) {
|
|
2963
|
+
value(next);
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
bumpVersion();
|
|
2967
|
+
},
|
|
2968
|
+
force: () => {
|
|
2969
|
+
bumpVersion();
|
|
2970
|
+
},
|
|
2971
|
+
peekVersion: () => version(),
|
|
2972
|
+
peekValue: () => value()
|
|
2945
2973
|
};
|
|
2946
2974
|
}
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
nextOutput = block.renderCurrent();
|
|
2956
|
-
} catch (err) {
|
|
2957
|
-
if (handleSuspend(err, block.root)) {
|
|
2958
|
-
handledError = true;
|
|
2959
|
-
popRoot(prev);
|
|
2960
|
-
destroyRoot(block.root);
|
|
2961
|
-
block.nodes = [block.start, block.end];
|
|
2962
|
-
return block;
|
|
2963
|
-
}
|
|
2964
|
-
if (handleError(err, { source: "renderChild" }, block.root)) {
|
|
2965
|
-
handledError = true;
|
|
2966
|
-
popRoot(prev);
|
|
2967
|
-
destroyRoot(block.root);
|
|
2968
|
-
block.nodes = [block.start, block.end];
|
|
2969
|
-
return block;
|
|
2970
|
-
}
|
|
2971
|
-
throw err;
|
|
2972
|
-
} finally {
|
|
2973
|
-
if (!handledError) {
|
|
2974
|
-
popRoot(prev);
|
|
2975
|
-
}
|
|
2975
|
+
|
|
2976
|
+
// src/props.ts
|
|
2977
|
+
var propGetters = /* @__PURE__ */ new WeakSet();
|
|
2978
|
+
var rawToProxy = /* @__PURE__ */ new WeakMap();
|
|
2979
|
+
var proxyToRaw = /* @__PURE__ */ new WeakMap();
|
|
2980
|
+
function __fictProp(getter) {
|
|
2981
|
+
if (typeof getter === "function" && getter.length === 0) {
|
|
2982
|
+
propGetters.add(getter);
|
|
2976
2983
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2984
|
+
return getter;
|
|
2985
|
+
}
|
|
2986
|
+
function isPropGetter(value) {
|
|
2987
|
+
return typeof value === "function" && propGetters.has(value);
|
|
2988
|
+
}
|
|
2989
|
+
function createPropsProxy(props) {
|
|
2990
|
+
if (!props || typeof props !== "object") {
|
|
2991
|
+
return props;
|
|
2992
|
+
}
|
|
2993
|
+
if (proxyToRaw.has(props)) {
|
|
2994
|
+
return props;
|
|
2995
|
+
}
|
|
2996
|
+
const cached = rawToProxy.get(props);
|
|
2997
|
+
if (cached) {
|
|
2998
|
+
return cached;
|
|
2999
|
+
}
|
|
3000
|
+
const proxy = new Proxy(props, {
|
|
3001
|
+
get(target, prop, receiver) {
|
|
3002
|
+
const value = Reflect.get(target, prop, receiver);
|
|
3003
|
+
if (isPropGetter(value)) {
|
|
3004
|
+
return value();
|
|
3005
|
+
}
|
|
3006
|
+
return value;
|
|
3007
|
+
},
|
|
3008
|
+
set(target, prop, value, receiver) {
|
|
3009
|
+
return Reflect.set(target, prop, value, receiver);
|
|
3010
|
+
},
|
|
3011
|
+
has(target, prop) {
|
|
3012
|
+
return prop in target;
|
|
3013
|
+
},
|
|
3014
|
+
ownKeys(target) {
|
|
3015
|
+
return Reflect.ownKeys(target);
|
|
3016
|
+
},
|
|
3017
|
+
getOwnPropertyDescriptor(target, prop) {
|
|
3018
|
+
return Object.getOwnPropertyDescriptor(target, prop);
|
|
2982
3019
|
}
|
|
3020
|
+
});
|
|
3021
|
+
rawToProxy.set(props, proxy);
|
|
3022
|
+
proxyToRaw.set(proxy, props);
|
|
3023
|
+
return proxy;
|
|
3024
|
+
}
|
|
3025
|
+
function unwrapProps(props) {
|
|
3026
|
+
if (!props || typeof props !== "object") {
|
|
3027
|
+
return props;
|
|
2983
3028
|
}
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
insertNodesBefore(block.start.parentNode, newNodes, block.end);
|
|
2994
|
-
block.nodes = [block.start, ...newNodes, block.end];
|
|
2995
|
-
} else {
|
|
2996
|
-
block.nodes = [block.start, block.end];
|
|
3029
|
+
return proxyToRaw.get(props) ?? props;
|
|
3030
|
+
}
|
|
3031
|
+
function __fictPropsRest(props, exclude) {
|
|
3032
|
+
const raw = unwrapProps(props);
|
|
3033
|
+
const out = {};
|
|
3034
|
+
const excludeSet = new Set(exclude);
|
|
3035
|
+
for (const key of Reflect.ownKeys(raw)) {
|
|
3036
|
+
if (excludeSet.has(key)) continue;
|
|
3037
|
+
out[key] = raw[key];
|
|
2997
3038
|
}
|
|
2998
|
-
return
|
|
3039
|
+
return createPropsProxy(out);
|
|
2999
3040
|
}
|
|
3000
|
-
function
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3041
|
+
function mergeProps(...sources) {
|
|
3042
|
+
const validSources = sources.filter(
|
|
3043
|
+
(s) => s != null && (typeof s === "object" || typeof s === "function")
|
|
3044
|
+
);
|
|
3045
|
+
if (validSources.length === 0) {
|
|
3046
|
+
return {};
|
|
3004
3047
|
}
|
|
3005
|
-
if (
|
|
3006
|
-
|
|
3007
|
-
return true;
|
|
3048
|
+
if (validSources.length === 1 && typeof validSources[0] === "object") {
|
|
3049
|
+
return validSources[0];
|
|
3008
3050
|
}
|
|
3009
|
-
|
|
3010
|
-
const
|
|
3011
|
-
if (typeof
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3051
|
+
const resolveSource = (src) => {
|
|
3052
|
+
const value = typeof src === "function" ? src() : src;
|
|
3053
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3054
|
+
return unwrapProps(value);
|
|
3055
|
+
};
|
|
3056
|
+
return new Proxy({}, {
|
|
3057
|
+
get(_, prop) {
|
|
3058
|
+
if (typeof prop === "symbol") {
|
|
3059
|
+
return void 0;
|
|
3060
|
+
}
|
|
3061
|
+
for (let i = validSources.length - 1; i >= 0; i--) {
|
|
3062
|
+
const src = validSources[i];
|
|
3063
|
+
const raw = resolveSource(src);
|
|
3064
|
+
if (!raw || !(prop in raw)) continue;
|
|
3065
|
+
const value = raw[prop];
|
|
3066
|
+
if (typeof src === "function" && !isPropGetter(value)) {
|
|
3067
|
+
return __fictProp(() => {
|
|
3068
|
+
const latest = resolveSource(src);
|
|
3069
|
+
if (!latest || !(prop in latest)) return void 0;
|
|
3070
|
+
return latest[prop];
|
|
3071
|
+
});
|
|
3028
3072
|
}
|
|
3073
|
+
return value;
|
|
3029
3074
|
}
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3075
|
+
return void 0;
|
|
3076
|
+
},
|
|
3077
|
+
has(_, prop) {
|
|
3078
|
+
for (const src of validSources) {
|
|
3079
|
+
const raw = resolveSource(src);
|
|
3080
|
+
if (raw && prop in raw) {
|
|
3081
|
+
return true;
|
|
3082
|
+
}
|
|
3033
3083
|
}
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3084
|
+
return false;
|
|
3085
|
+
},
|
|
3086
|
+
ownKeys() {
|
|
3087
|
+
const keys = /* @__PURE__ */ new Set();
|
|
3088
|
+
for (const src of validSources) {
|
|
3089
|
+
const raw = resolveSource(src);
|
|
3090
|
+
if (raw) {
|
|
3091
|
+
for (const key of Reflect.ownKeys(raw)) {
|
|
3092
|
+
keys.add(key);
|
|
3040
3093
|
}
|
|
3041
3094
|
}
|
|
3042
3095
|
}
|
|
3043
|
-
return
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3096
|
+
return Array.from(keys);
|
|
3097
|
+
},
|
|
3098
|
+
getOwnPropertyDescriptor(_, prop) {
|
|
3099
|
+
for (let i = validSources.length - 1; i >= 0; i--) {
|
|
3100
|
+
const raw = resolveSource(validSources[i]);
|
|
3101
|
+
if (raw && prop in raw) {
|
|
3102
|
+
return {
|
|
3103
|
+
enumerable: true,
|
|
3104
|
+
configurable: true,
|
|
3105
|
+
get: () => {
|
|
3106
|
+
const value = raw[prop];
|
|
3107
|
+
return value;
|
|
3108
|
+
}
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3052
3111
|
}
|
|
3053
|
-
|
|
3054
|
-
el.textContent = output.data;
|
|
3055
|
-
return true;
|
|
3112
|
+
return void 0;
|
|
3056
3113
|
}
|
|
3057
|
-
}
|
|
3058
|
-
return false;
|
|
3114
|
+
});
|
|
3059
3115
|
}
|
|
3060
|
-
function
|
|
3061
|
-
|
|
3062
|
-
if (currentNode instanceof Text && (nextOutput === null || nextOutput === void 0 || nextOutput === false || typeof nextOutput === "string" || typeof nextOutput === "number" || nextOutput instanceof Text)) {
|
|
3063
|
-
const nextText = nextOutput instanceof Text ? nextOutput.data : nextOutput === null || nextOutput === void 0 || nextOutput === false ? "" : String(nextOutput);
|
|
3064
|
-
currentNode.data = nextText;
|
|
3065
|
-
return true;
|
|
3066
|
-
}
|
|
3067
|
-
if (currentNode instanceof Element && patchElement(currentNode, nextOutput)) {
|
|
3068
|
-
return true;
|
|
3069
|
-
}
|
|
3070
|
-
if (nextOutput instanceof Node && currentNode === nextOutput) {
|
|
3071
|
-
return true;
|
|
3072
|
-
}
|
|
3073
|
-
return false;
|
|
3116
|
+
function useProp(getter) {
|
|
3117
|
+
return __fictProp(createMemo(getter));
|
|
3074
3118
|
}
|
|
3075
|
-
|
|
3076
|
-
|
|
3119
|
+
|
|
3120
|
+
// src/ref.ts
|
|
3121
|
+
function createRef() {
|
|
3122
|
+
return { current: null };
|
|
3077
3123
|
}
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
}
|
|
3088
|
-
if (children === null || children === false) {
|
|
3089
|
-
return result;
|
|
3124
|
+
|
|
3125
|
+
// src/transition.ts
|
|
3126
|
+
function startTransition(fn) {
|
|
3127
|
+
const prev = setTransitionContext(true);
|
|
3128
|
+
try {
|
|
3129
|
+
fn();
|
|
3130
|
+
} finally {
|
|
3131
|
+
setTransitionContext(prev);
|
|
3132
|
+
scheduleFlush();
|
|
3090
3133
|
}
|
|
3091
|
-
result.push(children);
|
|
3092
|
-
return result;
|
|
3093
3134
|
}
|
|
3094
|
-
function
|
|
3095
|
-
const
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3135
|
+
function useTransition() {
|
|
3136
|
+
const pending = signal(false);
|
|
3137
|
+
const start = (fn) => {
|
|
3138
|
+
pending(true);
|
|
3139
|
+
startTransition(() => {
|
|
3140
|
+
try {
|
|
3141
|
+
fn();
|
|
3142
|
+
} finally {
|
|
3143
|
+
pending(false);
|
|
3144
|
+
}
|
|
3145
|
+
});
|
|
3146
|
+
};
|
|
3147
|
+
return [() => pending(), start];
|
|
3105
3148
|
}
|
|
3106
|
-
function
|
|
3107
|
-
const
|
|
3108
|
-
|
|
3149
|
+
function useDeferredValue(getValue) {
|
|
3150
|
+
const deferredValue = signal(getValue());
|
|
3151
|
+
createEffect(() => {
|
|
3152
|
+
const newValue = getValue();
|
|
3153
|
+
const currentDeferred = untrack(() => deferredValue());
|
|
3154
|
+
if (currentDeferred !== newValue) {
|
|
3155
|
+
startTransition(() => {
|
|
3156
|
+
deferredValue(newValue);
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
});
|
|
3160
|
+
return () => deferredValue();
|
|
3109
3161
|
}
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
const next = cursor.nextSibling;
|
|
3115
|
-
cursor.parentNode?.removeChild(cursor);
|
|
3116
|
-
if (cursor === end) break;
|
|
3117
|
-
cursor = next;
|
|
3118
|
-
}
|
|
3162
|
+
|
|
3163
|
+
// src/scheduler.ts
|
|
3164
|
+
function batch2(fn) {
|
|
3165
|
+
return batch(fn);
|
|
3119
3166
|
}
|
|
3120
|
-
function
|
|
3121
|
-
|
|
3167
|
+
function untrack2(fn) {
|
|
3168
|
+
return untrack(fn);
|
|
3122
3169
|
}
|
|
3123
3170
|
|
|
3124
3171
|
// src/dom.ts
|
|
@@ -4186,6 +4233,7 @@ exports.createPropsProxy = createPropsProxy;
|
|
|
4186
4233
|
exports.createRef = createRef;
|
|
4187
4234
|
exports.createRenderEffect = createRenderEffect;
|
|
4188
4235
|
exports.createRoot = createRoot;
|
|
4236
|
+
exports.createScope = createScope;
|
|
4189
4237
|
exports.createSelector = createSelector;
|
|
4190
4238
|
exports.createShow = createShow;
|
|
4191
4239
|
exports.createSignal = signal;
|
|
@@ -4196,6 +4244,7 @@ exports.createTextBinding = createTextBinding;
|
|
|
4196
4244
|
exports.createVersionedSignal = createVersionedSignal;
|
|
4197
4245
|
exports.delegateEvents = delegateEvents;
|
|
4198
4246
|
exports.destroyMarkerBlock = destroyMarkerBlock;
|
|
4247
|
+
exports.effectScope = effectScope;
|
|
4199
4248
|
exports.getDevtoolsHook = getDevtoolsHook;
|
|
4200
4249
|
exports.getFirstNodeAfter = getFirstNodeAfter;
|
|
4201
4250
|
exports.getPropAlias = getPropAlias;
|
|
@@ -4213,6 +4262,7 @@ exports.prop = __fictProp;
|
|
|
4213
4262
|
exports.reconcileArrays = reconcileArrays;
|
|
4214
4263
|
exports.removeNodes = removeNodes;
|
|
4215
4264
|
exports.render = render;
|
|
4265
|
+
exports.runInScope = runInScope;
|
|
4216
4266
|
exports.setCycleProtectionOptions = setCycleProtectionOptions;
|
|
4217
4267
|
exports.spread = spread;
|
|
4218
4268
|
exports.startTransition = startTransition;
|