@sigx/terminal 0.1.8 → 0.1.9
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.js +83 -154
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function untrack(fn) {
|
|
|
62
62
|
activeEffect = prev;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function effectScope(
|
|
65
|
+
function effectScope(_detached) {
|
|
66
66
|
const effects = [];
|
|
67
67
|
let active = true;
|
|
68
68
|
return {
|
|
@@ -544,24 +544,11 @@ function computed(getterOrOptions) {
|
|
|
544
544
|
function isComputed(value) {
|
|
545
545
|
return value !== null && typeof value === "object" && ComputedSymbol in value;
|
|
546
546
|
}
|
|
547
|
-
var platformModelProcessor = null;
|
|
548
|
-
function setPlatformModelProcessor(fn) {
|
|
549
|
-
platformModelProcessor = fn;
|
|
550
|
-
}
|
|
551
|
-
function getPlatformModelProcessor() {
|
|
552
|
-
return platformModelProcessor;
|
|
553
|
-
}
|
|
554
547
|
var plugins = [];
|
|
555
|
-
function registerComponentPlugin(plugin) {
|
|
556
|
-
plugins.push(plugin);
|
|
557
|
-
}
|
|
558
548
|
function getComponentPlugins() {
|
|
559
549
|
return plugins;
|
|
560
550
|
}
|
|
561
551
|
var contextExtensions = [];
|
|
562
|
-
function registerContextExtension(extension) {
|
|
563
|
-
contextExtensions.push(extension);
|
|
564
|
-
}
|
|
565
552
|
function applyContextExtensions(ctx) {
|
|
566
553
|
for (const extension of contextExtensions) extension(ctx);
|
|
567
554
|
}
|
|
@@ -604,16 +591,6 @@ function setCurrentSuspenseBoundarySafe(boundary) {
|
|
|
604
591
|
reqCtx.currentSuspenseBoundary = boundary;
|
|
605
592
|
return prev;
|
|
606
593
|
}
|
|
607
|
-
function runInRequestScope(fn) {
|
|
608
|
-
if (asyncLocalStorage) return asyncLocalStorage.run({
|
|
609
|
-
currentComponentContext: null,
|
|
610
|
-
currentSuspenseBoundary: null
|
|
611
|
-
}, fn);
|
|
612
|
-
return fn();
|
|
613
|
-
}
|
|
614
|
-
function hasRequestIsolation() {
|
|
615
|
-
return asyncLocalStorage !== null;
|
|
616
|
-
}
|
|
617
594
|
var currentComponentContext = null;
|
|
618
595
|
function getCurrentInstance() {
|
|
619
596
|
return getCurrentInstanceSafe() ?? currentComponentContext;
|
|
@@ -644,12 +621,6 @@ var componentRegistry = /* @__PURE__ */ new Map();
|
|
|
644
621
|
function getComponentMeta(factory) {
|
|
645
622
|
return componentRegistry.get(factory);
|
|
646
623
|
}
|
|
647
|
-
function createPropsProxy(target, onAccess) {
|
|
648
|
-
return new Proxy(target, { get(obj, prop) {
|
|
649
|
-
if (typeof prop === "string" && onAccess) onAccess(prop);
|
|
650
|
-
return obj[prop];
|
|
651
|
-
} });
|
|
652
|
-
}
|
|
653
624
|
function component(setup, options) {
|
|
654
625
|
const factory = function(props) {
|
|
655
626
|
return {
|
|
@@ -734,9 +705,6 @@ var defaultMountFn = null;
|
|
|
734
705
|
function setDefaultMount(mountFn) {
|
|
735
706
|
defaultMountFn = mountFn;
|
|
736
707
|
}
|
|
737
|
-
function getDefaultMount() {
|
|
738
|
-
return defaultMountFn;
|
|
739
|
-
}
|
|
740
708
|
function defineApp(rootComponent) {
|
|
741
709
|
const installedPlugins = /* @__PURE__ */ new Set();
|
|
742
710
|
const context = {
|
|
@@ -905,8 +873,9 @@ function createModelFromBinding(binding) {
|
|
|
905
873
|
function isModel(value) {
|
|
906
874
|
return value !== null && typeof value === "object" && MODEL_SYMBOL in value && value[MODEL_SYMBOL] === true;
|
|
907
875
|
}
|
|
908
|
-
|
|
909
|
-
|
|
876
|
+
var platformModelProcessor = null;
|
|
877
|
+
function getPlatformModelProcessor() {
|
|
878
|
+
return platformModelProcessor;
|
|
910
879
|
}
|
|
911
880
|
function isComponent(type) {
|
|
912
881
|
return typeof type === "function" && "__setup" in type;
|
|
@@ -929,7 +898,7 @@ function normalizeChildren(children) {
|
|
|
929
898
|
return [];
|
|
930
899
|
}
|
|
931
900
|
function jsx(type, props, key) {
|
|
932
|
-
const processedProps = { ...props
|
|
901
|
+
const processedProps = { ...props };
|
|
933
902
|
const models = {};
|
|
934
903
|
const isComponentType = isComponent(type);
|
|
935
904
|
if (props) {
|
|
@@ -1191,6 +1160,80 @@ function guid$1() {
|
|
|
1191
1160
|
return (c == "x" ? r : r & 3 | 8).toString(16);
|
|
1192
1161
|
});
|
|
1193
1162
|
}
|
|
1163
|
+
const guid = guid$1;
|
|
1164
|
+
let InstanceLifetimes = /* @__PURE__ */ function(InstanceLifetimes) {
|
|
1165
|
+
InstanceLifetimes[InstanceLifetimes["Transient"] = 0] = "Transient";
|
|
1166
|
+
InstanceLifetimes[InstanceLifetimes["Scoped"] = 1] = "Scoped";
|
|
1167
|
+
InstanceLifetimes[InstanceLifetimes["Singleton"] = 2] = "Singleton";
|
|
1168
|
+
return InstanceLifetimes;
|
|
1169
|
+
}({});
|
|
1170
|
+
function createTopic(_options) {
|
|
1171
|
+
let subscribers = [];
|
|
1172
|
+
const publish = (data) => {
|
|
1173
|
+
subscribers.forEach((s) => s(data));
|
|
1174
|
+
};
|
|
1175
|
+
const subscribe = (handler) => {
|
|
1176
|
+
subscribers.push(handler);
|
|
1177
|
+
const unsubscribe = () => {
|
|
1178
|
+
const idx = subscribers.indexOf(handler);
|
|
1179
|
+
if (idx > -1) subscribers.splice(idx, 1);
|
|
1180
|
+
};
|
|
1181
|
+
try {
|
|
1182
|
+
onUnmounted(unsubscribe);
|
|
1183
|
+
} catch {}
|
|
1184
|
+
return { unsubscribe };
|
|
1185
|
+
};
|
|
1186
|
+
const destroy = () => {
|
|
1187
|
+
subscribers = [];
|
|
1188
|
+
};
|
|
1189
|
+
return {
|
|
1190
|
+
publish,
|
|
1191
|
+
subscribe,
|
|
1192
|
+
destroy
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
function toSubscriber(topic) {
|
|
1196
|
+
return { subscribe: (handler) => topic.subscribe(handler) };
|
|
1197
|
+
}
|
|
1198
|
+
var SubscriptionHandler = class {
|
|
1199
|
+
constructor() {
|
|
1200
|
+
this.unsubs = [];
|
|
1201
|
+
}
|
|
1202
|
+
add(unsub) {
|
|
1203
|
+
this.unsubs.push(unsub);
|
|
1204
|
+
}
|
|
1205
|
+
unsubscribe() {
|
|
1206
|
+
this.unsubs.forEach((u) => u());
|
|
1207
|
+
this.unsubs = [];
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
function defineFactory(setup, _lifetime, _typeIdentifier) {
|
|
1211
|
+
const factoryCreator = (...args) => {
|
|
1212
|
+
const subscriptions = new SubscriptionHandler();
|
|
1213
|
+
const deactivations = /* @__PURE__ */ new Set();
|
|
1214
|
+
let customDispose = null;
|
|
1215
|
+
const result = setup({
|
|
1216
|
+
onDeactivated: (fn) => deactivations.add(fn),
|
|
1217
|
+
subscriptions,
|
|
1218
|
+
overrideDispose: (fn) => customDispose = fn
|
|
1219
|
+
}, ...args);
|
|
1220
|
+
const dispose = () => {
|
|
1221
|
+
deactivations.forEach((d) => d());
|
|
1222
|
+
subscriptions.unsubscribe();
|
|
1223
|
+
result.dispose?.();
|
|
1224
|
+
};
|
|
1225
|
+
if (customDispose) customDispose(dispose);
|
|
1226
|
+
else try {
|
|
1227
|
+
onUnmounted(() => dispose());
|
|
1228
|
+
} catch {}
|
|
1229
|
+
return {
|
|
1230
|
+
...result,
|
|
1231
|
+
dispose
|
|
1232
|
+
};
|
|
1233
|
+
};
|
|
1234
|
+
if (setup.length <= 1) return defineInjectable(() => factoryCreator());
|
|
1235
|
+
return factoryCreator;
|
|
1236
|
+
}
|
|
1194
1237
|
function createPropsAccessor(reactiveProps) {
|
|
1195
1238
|
return new Proxy(reactiveProps, {
|
|
1196
1239
|
get(target, key) {
|
|
@@ -1287,83 +1330,6 @@ function normalizeSubTree(result) {
|
|
|
1287
1330
|
};
|
|
1288
1331
|
return result;
|
|
1289
1332
|
}
|
|
1290
|
-
const guid = guid$1;
|
|
1291
|
-
let InstanceLifetimes = /* @__PURE__ */ function(InstanceLifetimes) {
|
|
1292
|
-
InstanceLifetimes[InstanceLifetimes["Transient"] = 0] = "Transient";
|
|
1293
|
-
InstanceLifetimes[InstanceLifetimes["Scoped"] = 1] = "Scoped";
|
|
1294
|
-
InstanceLifetimes[InstanceLifetimes["Singleton"] = 2] = "Singleton";
|
|
1295
|
-
return InstanceLifetimes;
|
|
1296
|
-
}({});
|
|
1297
|
-
function valueOf(obj) {
|
|
1298
|
-
return obj;
|
|
1299
|
-
}
|
|
1300
|
-
function createTopic(options) {
|
|
1301
|
-
let subscribers = [];
|
|
1302
|
-
const publish = (data) => {
|
|
1303
|
-
subscribers.forEach((s) => s(data));
|
|
1304
|
-
};
|
|
1305
|
-
const subscribe = (handler) => {
|
|
1306
|
-
subscribers.push(handler);
|
|
1307
|
-
const unsubscribe = () => {
|
|
1308
|
-
const idx = subscribers.indexOf(handler);
|
|
1309
|
-
if (idx > -1) subscribers.splice(idx, 1);
|
|
1310
|
-
};
|
|
1311
|
-
try {
|
|
1312
|
-
onUnmounted(unsubscribe);
|
|
1313
|
-
} catch (e) {}
|
|
1314
|
-
return { unsubscribe };
|
|
1315
|
-
};
|
|
1316
|
-
const destroy = () => {
|
|
1317
|
-
subscribers = [];
|
|
1318
|
-
};
|
|
1319
|
-
return {
|
|
1320
|
-
publish,
|
|
1321
|
-
subscribe,
|
|
1322
|
-
destroy
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
function toSubscriber(topic) {
|
|
1326
|
-
return { subscribe: (handler) => topic.subscribe(handler) };
|
|
1327
|
-
}
|
|
1328
|
-
var SubscriptionHandler = class {
|
|
1329
|
-
constructor() {
|
|
1330
|
-
this.unsubs = [];
|
|
1331
|
-
}
|
|
1332
|
-
add(unsub) {
|
|
1333
|
-
this.unsubs.push(unsub);
|
|
1334
|
-
}
|
|
1335
|
-
unsubscribe() {
|
|
1336
|
-
this.unsubs.forEach((u) => u());
|
|
1337
|
-
this.unsubs = [];
|
|
1338
|
-
}
|
|
1339
|
-
};
|
|
1340
|
-
function defineFactory(setup, lifetime, typeIdentifier) {
|
|
1341
|
-
const factoryCreator = (...args) => {
|
|
1342
|
-
const subscriptions = new SubscriptionHandler();
|
|
1343
|
-
const deactivations = /* @__PURE__ */ new Set();
|
|
1344
|
-
let customDispose = null;
|
|
1345
|
-
const result = setup({
|
|
1346
|
-
onDeactivated: (fn) => deactivations.add(fn),
|
|
1347
|
-
subscriptions,
|
|
1348
|
-
overrideDispose: (fn) => customDispose = fn
|
|
1349
|
-
}, ...args);
|
|
1350
|
-
const dispose = () => {
|
|
1351
|
-
deactivations.forEach((d) => d());
|
|
1352
|
-
subscriptions.unsubscribe();
|
|
1353
|
-
result.dispose?.();
|
|
1354
|
-
};
|
|
1355
|
-
if (customDispose) customDispose(dispose);
|
|
1356
|
-
else try {
|
|
1357
|
-
onUnmounted(() => dispose());
|
|
1358
|
-
} catch (e) {}
|
|
1359
|
-
return {
|
|
1360
|
-
...result,
|
|
1361
|
-
dispose
|
|
1362
|
-
};
|
|
1363
|
-
};
|
|
1364
|
-
if (setup.length <= 1) return defineInjectable(() => factoryCreator());
|
|
1365
|
-
return factoryCreator;
|
|
1366
|
-
}
|
|
1367
1333
|
const CLIENT_DIRECTIVE_PREFIX = "client:";
|
|
1368
1334
|
const CLIENT_DIRECTIVES = [
|
|
1369
1335
|
"client:load",
|
|
@@ -1372,45 +1338,6 @@ const CLIENT_DIRECTIVES = [
|
|
|
1372
1338
|
"client:media",
|
|
1373
1339
|
"client:only"
|
|
1374
1340
|
];
|
|
1375
|
-
function filterClientDirectives(props) {
|
|
1376
|
-
const filtered = {};
|
|
1377
|
-
for (const key in props) if (!key.startsWith("client:")) filtered[key] = props[key];
|
|
1378
|
-
return filtered;
|
|
1379
|
-
}
|
|
1380
|
-
function getHydrationDirective(props) {
|
|
1381
|
-
if (props["client:load"] !== void 0) return { strategy: "load" };
|
|
1382
|
-
if (props["client:idle"] !== void 0) return { strategy: "idle" };
|
|
1383
|
-
if (props["client:visible"] !== void 0) return { strategy: "visible" };
|
|
1384
|
-
if (props["client:only"] !== void 0) return { strategy: "only" };
|
|
1385
|
-
if (props["client:media"] !== void 0) return {
|
|
1386
|
-
strategy: "media",
|
|
1387
|
-
media: props["client:media"]
|
|
1388
|
-
};
|
|
1389
|
-
return null;
|
|
1390
|
-
}
|
|
1391
|
-
function hasClientDirective(props) {
|
|
1392
|
-
for (const key in props) if (key.startsWith("client:")) return true;
|
|
1393
|
-
return false;
|
|
1394
|
-
}
|
|
1395
|
-
function serializeProps(props) {
|
|
1396
|
-
const filtered = filterClientDirectives(props);
|
|
1397
|
-
const result = {};
|
|
1398
|
-
let hasProps = false;
|
|
1399
|
-
for (const key in filtered) {
|
|
1400
|
-
const value = filtered[key];
|
|
1401
|
-
if (key === "children" || key === "key" || key === "ref" || key === "slots") continue;
|
|
1402
|
-
if (typeof value === "function") continue;
|
|
1403
|
-
if (typeof value === "symbol") continue;
|
|
1404
|
-
if (value === void 0) continue;
|
|
1405
|
-
if (key.startsWith("on") && key.length > 2 && key[2] === key[2].toUpperCase()) continue;
|
|
1406
|
-
try {
|
|
1407
|
-
JSON.stringify(value);
|
|
1408
|
-
result[key] = value;
|
|
1409
|
-
hasProps = true;
|
|
1410
|
-
} catch {}
|
|
1411
|
-
}
|
|
1412
|
-
return hasProps ? result : void 0;
|
|
1413
|
-
}
|
|
1414
1341
|
function createEmit(reactiveProps) {
|
|
1415
1342
|
return (event, ...args) => {
|
|
1416
1343
|
const eventName = `on${event[0].toUpperCase() + event.slice(1)}`;
|
|
@@ -1419,7 +1346,7 @@ function createEmit(reactiveProps) {
|
|
|
1419
1346
|
};
|
|
1420
1347
|
}
|
|
1421
1348
|
function createRenderer(options) {
|
|
1422
|
-
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText:
|
|
1349
|
+
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: _hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, cloneNode: _hostCloneNode, insertStaticContent: _hostInsertStaticContent, patchDirective: hostPatchDirective, onElementMounted: hostOnElementMounted, onElementUnmounted: hostOnElementUnmounted, getActiveElement: hostGetActiveElement, restoreFocus: hostRestoreFocus } = options;
|
|
1423
1350
|
let currentAppContext = null;
|
|
1424
1351
|
function render(element, container, appContext) {
|
|
1425
1352
|
if (appContext) currentAppContext = appContext;
|
|
@@ -1860,7 +1787,9 @@ function createRenderer(options) {
|
|
|
1860
1787
|
const subTree = normalizeSubTree(subTreeResult);
|
|
1861
1788
|
const prevSubTree = internalVNode._subTree;
|
|
1862
1789
|
if (prevSubTree) {
|
|
1790
|
+
const prevFocus = hostGetActiveElement ? hostGetActiveElement() : null;
|
|
1863
1791
|
patch(prevSubTree, subTree, container);
|
|
1792
|
+
if (prevFocus && hostRestoreFocus && hostGetActiveElement() !== prevFocus) hostRestoreFocus(prevFocus);
|
|
1864
1793
|
notifyComponentUpdated(currentAppContext, componentInstance);
|
|
1865
1794
|
updatedHooks.forEach((hook) => hook());
|
|
1866
1795
|
} else mount(subTree, container, anchor);
|
|
@@ -2449,6 +2378,6 @@ const terminalMount = (component, options, appContext) => {
|
|
|
2449
2378
|
};
|
|
2450
2379
|
};
|
|
2451
2380
|
setDefaultMount(terminalMount);
|
|
2452
|
-
export { Button, CLIENT_DIRECTIVES, CLIENT_DIRECTIVE_PREFIX, Checkbox, ComputedSymbol, ErrorBoundary, Fragment, Input, InstanceLifetimes, ProgressBar, Select, SubscriptionHandler, Suspense, Text, Utils,
|
|
2381
|
+
export { Button, CLIENT_DIRECTIVES, CLIENT_DIRECTIVE_PREFIX, Checkbox, ComputedSymbol, ErrorBoundary, Fragment, Input, InstanceLifetimes, ProgressBar, Select, SubscriptionHandler, Suspense, Text, Utils, batch, component, compound, computed, createModel, createModelFromBinding, createTopic, defineApp, defineDirective, defineFactory, defineInjectable, defineProvide, detectAccess, effect, effectScope, exitTerminal, focus, focusNext, focusPrev, focusState, getComponentMeta, getCurrentInstance, guid, isComponent, isComputed, isDirective, isLazyComponent, isModel, isReactive, jsx, jsxDEV, jsxs, lazy, mountTerminal, onCreated, onKey, onMounted, onUnmounted, onUpdated, registerFocusable, render, renderNodeToLines, renderTerminal, signal, terminalMount, toRaw, toSubscriber, unregisterFocusable, untrack, useAppContext, watch };
|
|
2453
2382
|
|
|
2454
2383
|
//# sourceMappingURL=index.js.map
|