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