@kosdev-code/kos-ui-sdk 0.1.0-next.948 → 0.1.0-next.958
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/.kos.json +2 -1
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts +2 -0
- package/core/core/decorators/kos-container-aware-reconcile.test-d.d.ts.map +1 -0
- package/core/core/decorators/kos-container-aware.d.ts +150 -88
- package/core/core/decorators/kos-container-aware.d.ts.map +1 -1
- package/core/core/decorators/kos-reload-aware.d.ts +10 -8
- package/core/core/decorators/kos-reload-aware.d.ts.map +1 -1
- package/core/core/decorators/kosModel.d.ts.map +1 -1
- package/core/core/kosCore.d.ts +4 -1
- package/core/core/kosCore.d.ts.map +1 -1
- package/core/core/kosModel.d.ts +16 -8
- package/core/core/kosModel.d.ts.map +1 -1
- package/core/core/lifecycle/constants.d.ts +6 -2
- package/core/core/lifecycle/constants.d.ts.map +1 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts +11 -1
- package/core/core/lifecycle/kosCoreLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/kosModelLifecycle.d.ts +6 -0
- package/core/core/lifecycle/kosModelLifecycle.d.ts.map +1 -1
- package/core/core/lifecycle/model-machine.d.ts +6 -0
- package/core/core/lifecycle/model-machine.d.ts.map +1 -1
- package/core/core/model/kos-fsm-manager.d.ts +6 -0
- package/core/core/model/kos-fsm-manager.d.ts.map +1 -1
- package/core/core/reconnect/reconnect-fixture.d.ts +17 -0
- package/core/core/reconnect/reconnect-fixture.d.ts.map +1 -0
- package/core/core/transport/transport.d.ts +1 -1
- package/core/core/transport/transport.d.ts.map +1 -1
- package/core/core/transport/webSocketTransport.d.ts +10 -0
- package/core/core/transport/webSocketTransport.d.ts.map +1 -1
- package/index.cjs +134 -90
- package/index.cjs.map +1 -1
- package/index.js +163 -119
- package/index.js.map +1 -1
- package/models/models/config-bean/config-bean-model.d.ts +9 -0
- package/models/models/config-bean/config-bean-model.d.ts.map +1 -1
- package/models/models/gpio-chip/gpio-chip-builders.d.ts +14 -0
- package/models/models/gpio-chip/gpio-chip-builders.d.ts.map +1 -0
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts +2 -1
- package/models/models/gpio-chip/gpio-chip-container-model.d.ts.map +1 -1
- package/models/models/trouble-container/trouble-builders.d.ts +11 -0
- package/models/models/trouble-container/trouble-builders.d.ts.map +1 -0
- package/models/models/trouble-container/trouble-container-model.d.ts +2 -1
- package/models/models/trouble-container/trouble-container-model.d.ts.map +1 -1
- package/package.json +3 -3
- package/{software-info-registration-CuuEsH8v.js → software-info-registration-C8kf-pBB.js} +467 -163
- package/software-info-registration-C8kf-pBB.js.map +1 -0
- package/{software-info-registration-CY_E6Rw7.cjs → software-info-registration-Y1iADHWT.cjs} +438 -134
- package/software-info-registration-Y1iADHWT.cjs.map +1 -0
- package/testing.cjs +1 -1
- package/testing.js +1 -1
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts +9 -0
- package/ui/components/connection-dev-button/connection-dev-button-styles.d.ts.map +1 -0
- package/ui/components/connection-dev-button/index.d.ts +36 -0
- package/ui/components/connection-dev-button/index.d.ts.map +1 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts +29 -0
- package/ui/components/connection-dev-button/use-connection-dev-state.d.ts.map +1 -0
- package/ui/components/index.d.ts +1 -0
- package/ui/components/index.d.ts.map +1 -1
- package/software-info-registration-CY_E6Rw7.cjs.map +0 -1
- package/software-info-registration-CuuEsH8v.js.map +0 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as subscribe, p as publish, k as kosParentAware, C as CompanionParentModel, K as KosContextManager, M as MultipleFutureContainerSetup, L as LogConfig, R as ReferenceConfig, T as TroubleAwareSetup, D as DependencyModels, E as ExtensionManager, S as SubscriptionHandlers, a as KosViewModelSymbol, V as ViewModelConfig, b as StateMachineSetup, c as DependencyLifecycle, i as injectStateMachineSupport, d as initializeStateMachine, e as ModelEffects, f as KosModelVisitor, g as KosCore, h as sendKosMessageResponse, j as KosLog, u as uuid, I as INDEX_RECORD_SYMBOL, l as INDEX_COLLECTION_KEY, m as KosContainerIndexEvents, n as isIndexableItem, o as Kos, q as isKosModel, r as ConfigBean, t as configBeanModelId, v as getRegionInfo, w as getRegions, x as Registration, y as getStateBeanData, z as StateBean, A as getStateProps, B as StateProp, F as deleteKeyValue, G as deleteKeyValueNamespace, H as getKeyValue, J as updateKeyValue, N as getLogOverrides, O as getTimezone, P as setDate, Q as setTime, U as setTimezone, W as createOverride, X as getLogStreamBlock, Y as getLogStreamBlocks, Z as getLogStreams, _ as subscribeToLogStream, $ as unsubscribeFromLogStream, a0 as bulkResolveTroubles, a1 as getTroubles, a2 as resolveTrouble, a3 as sendCanvasData, a4 as getDeviceDetails, a5 as getSerialNumber, a6 as getNetworkInterfaces, a7 as getStorageDevices, a8 as getAvailableUpdates, a9 as installUpdate, aa as TranslationContainer, ab as whenReady, ac as KosCoreModelPropertyMapper, ad as CanvasDispatcher, ae as KeyValue, af as destroyKosModel, ag as createClient, ah as kosServiceRequest$8, ai as getSoftwareInfos, aj as getSoftwareInfosWithCancel, ak as BASE_URL, al as kosFetch, am as kosModel, an as kosLoggerAware, ao as kosContainerAware, ap as kosChild, aq as api$8, ar as ObservableData, as as WebSocketTransport, at as kosComputed, au as KosModelRegistrationFactory, av as getKosModelSync, aw as kosAutoEffect, ax as WebSocketEvents, ay as modelHookCache, az as isUpdateable, aA as KosModelState, aB as KosModelEvents, aC as clearModelHookCacheEntry, aD as KosTime, aE as SoftwareInfo, aF as getQueryParams, aG as getKosLocalizationDescriptor, aH as Device, aI as NetworkInterfaceContainer, aJ as Ota, aK as StorageDeviceContainer, aL as TimerManager, aM as TIMER_END, aN as TIMER_EVENT, aO as TOPIC_TIMER_TICK_EVENT, aP as getKosModel, aQ as Trouble, aR as TroubleContainer, aS as UsbUpdateContainer, aT as Registration$1 } from "./software-info-registration-
|
|
2
|
-
import { aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM, cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ, c_, c$, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm, dn, dp, dq, dr, ds, dt, du, dv, dw, dx, dy, dz, dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM, dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ, d_, d$, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ea, eb, ec, ed, ee, ef, eg, eh, ei, ej, ek, el, em, en, eo, ep, eq, er, es, et, eu, ev, ew, ex, ey, ez, eA, eB, eC, eD, eE, eF, eG, eH, eI, eJ, eK, eL, eM, eN, eO } from "./software-info-registration-
|
|
1
|
+
import { s as subscribe, p as publish, k as kosParentAware, C as CompanionParentModel, K as KosContextManager, M as MultipleFutureContainerSetup, L as LogConfig, R as ReferenceConfig, T as TroubleAwareSetup, D as DependencyModels, E as ExtensionManager, S as SubscriptionHandlers, a as KosViewModelSymbol, V as ViewModelConfig, b as StateMachineSetup, c as DependencyLifecycle, i as injectStateMachineSupport, d as initializeStateMachine, e as ModelEffects, f as KosModelVisitor, g as KosCore, h as sendKosMessageResponse, j as KosLog, u as uuid, I as INDEX_RECORD_SYMBOL, l as INDEX_COLLECTION_KEY, m as KosContainerIndexEvents, n as isIndexableItem, o as Kos, q as isKosModel, r as ConfigBean, t as configBeanModelId, v as getRegionInfo, w as getRegions, x as Registration, y as getStateBeanData, z as StateBean, A as getStateProps, B as StateProp, F as deleteKeyValue, G as deleteKeyValueNamespace, H as getKeyValue, J as updateKeyValue, N as getLogOverrides, O as getTimezone, P as setDate, Q as setTime, U as setTimezone, W as createOverride, X as getLogStreamBlock, Y as getLogStreamBlocks, Z as getLogStreams, _ as subscribeToLogStream, $ as unsubscribeFromLogStream, a0 as bulkResolveTroubles, a1 as getTroubles, a2 as resolveTrouble, a3 as sendCanvasData, a4 as getDeviceDetails, a5 as getSerialNumber, a6 as getNetworkInterfaces, a7 as getStorageDevices, a8 as getAvailableUpdates, a9 as installUpdate, aa as TranslationContainer, ab as whenReady, ac as KosCoreModelPropertyMapper, ad as CanvasDispatcher, ae as KeyValue, af as destroyKosModel, ag as createClient, ah as kosServiceRequest$8, ai as getSoftwareInfos, aj as getSoftwareInfosWithCancel, ak as BASE_URL, al as kosFetch, am as kosModel, an as kosLoggerAware, ao as kosContainerAware, ap as kosChild, aq as api$8, ar as ObservableData, as as WebSocketTransport, at as kosComputed, au as KosModelRegistrationFactory, av as getKosModelSync, aw as kosAutoEffect, ax as WebSocketEvents, ay as modelHookCache, az as isUpdateable, aA as KosModelState, aB as KosModelEvents, aC as clearModelHookCacheEntry, aD as KosTime, aE as SoftwareInfo, aF as getQueryParams, aG as getKosLocalizationDescriptor, aH as Device, aI as NetworkInterfaceContainer, aJ as Ota, aK as StorageDeviceContainer, aL as TimerManager, aM as TIMER_END, aN as TIMER_EVENT, aO as TOPIC_TIMER_TICK_EVENT, aP as getKosModel, aQ as Trouble, aR as TroubleContainer, aS as UsbUpdateContainer, aT as Registration$1 } from "./software-info-registration-C8kf-pBB.js";
|
|
2
|
+
import { aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA, cB, cC, cD, cE, cF, cG, cH, cI, cJ, cK, cL, cM, cN, cO, cP, cQ, cR, cS, cT, cU, cV, cW, cX, cY, cZ, c_, c$, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, da, db, dc, dd, de, df, dg, dh, di, dj, dk, dl, dm, dn, dp, dq, dr, ds, dt, du, dv, dw, dx, dy, dz, dA, dB, dC, dD, dE, dF, dG, dH, dI, dJ, dK, dL, dM, dN, dO, dP, dQ, dR, dS, dT, dU, dV, dW, dX, dY, dZ, d_, d$, e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ea, eb, ec, ed, ee, ef, eg, eh, ei, ej, ek, el, em, en, eo, ep, eq, er, es, et, eu, ev, ew, ex, ey, ez, eA, eB, eC, eD, eE, eF, eG, eH, eI, eJ, eK, eL, eM, eN, eO, eP, eQ, eR, eS } from "./software-info-registration-C8kf-pBB.js";
|
|
3
3
|
import { action, reaction, autorun, makeAutoObservable, runInAction } from "mobx";
|
|
4
4
|
import { makeAutoObservable as makeAutoObservable2, makeObservable } from "mobx";
|
|
5
5
|
import log$6 from "loglevel";
|
|
@@ -725,66 +725,6 @@ function arraysEqual(_a, _b) {
|
|
|
725
725
|
if (a.length !== b.length) return false;
|
|
726
726
|
return a.every((val, index2) => val === b[index2]);
|
|
727
727
|
}
|
|
728
|
-
const deltas = (projectedModels, currentModels) => {
|
|
729
|
-
const newIds = projectedModels.map((entity) => entity.id);
|
|
730
|
-
const currentIds = currentModels.map((entity) => entity.id);
|
|
731
|
-
const toRemove = currentIds.filter((modelId) => !newIds.includes(modelId));
|
|
732
|
-
return toRemove;
|
|
733
|
-
};
|
|
734
|
-
const DEFAULT_REMOVE_MAPPER = (id) => id;
|
|
735
|
-
const DEFAULT_ID_MAPPER = (entity) => entity;
|
|
736
|
-
const resolveContainerDeltas = ({
|
|
737
|
-
container,
|
|
738
|
-
onAddItem,
|
|
739
|
-
onUpdateItem,
|
|
740
|
-
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
741
|
-
idMapper = DEFAULT_ID_MAPPER
|
|
742
|
-
}) => (entities) => {
|
|
743
|
-
const mappedEntities = entities.map(idMapper);
|
|
744
|
-
const toRemove = deltas(mappedEntities, container.data);
|
|
745
|
-
const removedIds = toRemove.map(onRemoveItem).filter(Boolean);
|
|
746
|
-
container.removeAll(removedIds);
|
|
747
|
-
const toAdd = mappedEntities.map((entity) => {
|
|
748
|
-
const existing = container.getModel(entity.id);
|
|
749
|
-
if (!existing) {
|
|
750
|
-
return onAddItem(entity);
|
|
751
|
-
} else if (onUpdateItem) {
|
|
752
|
-
return onUpdateItem(entity, existing);
|
|
753
|
-
} else {
|
|
754
|
-
return onAddItem(entity);
|
|
755
|
-
}
|
|
756
|
-
}).filter(Boolean);
|
|
757
|
-
container.addAll(toAdd);
|
|
758
|
-
};
|
|
759
|
-
const resolveListDeltas = ({
|
|
760
|
-
container,
|
|
761
|
-
onAddItem,
|
|
762
|
-
onRemoveItem = DEFAULT_REMOVE_MAPPER,
|
|
763
|
-
idMapper = DEFAULT_ID_MAPPER
|
|
764
|
-
}) => (entities) => {
|
|
765
|
-
const mappedLayers = entities.map(idMapper);
|
|
766
|
-
const toRemove = deltas(mappedLayers, container.models);
|
|
767
|
-
toRemove.forEach(onRemoveItem);
|
|
768
|
-
mappedLayers.forEach(onAddItem);
|
|
769
|
-
};
|
|
770
|
-
const resolveItemListDeltas = ({
|
|
771
|
-
items,
|
|
772
|
-
onAddItem,
|
|
773
|
-
onRemoveItem,
|
|
774
|
-
idMapper = DEFAULT_ID_MAPPER
|
|
775
|
-
}) => (entities) => {
|
|
776
|
-
const mappedLayers = entities.map(idMapper);
|
|
777
|
-
const toRemove = deltas(mappedLayers, items);
|
|
778
|
-
toRemove.forEach(onRemoveItem);
|
|
779
|
-
mappedLayers.forEach(onAddItem);
|
|
780
|
-
};
|
|
781
|
-
const processId = (id, prefix = "parent-") => {
|
|
782
|
-
let _id = id;
|
|
783
|
-
if (_id.startsWith(prefix)) {
|
|
784
|
-
_id = _id.replace(prefix, "");
|
|
785
|
-
}
|
|
786
|
-
return _id;
|
|
787
|
-
};
|
|
788
728
|
const formatter = new Intl.RelativeTimeFormat(void 0, {
|
|
789
729
|
numeric: "auto"
|
|
790
730
|
});
|
|
@@ -1811,7 +1751,7 @@ const updateRegion = async (region) => {
|
|
|
1811
1751
|
regionInfo.updateProperty(region);
|
|
1812
1752
|
};
|
|
1813
1753
|
async function getKosServiceApi() {
|
|
1814
|
-
const { default: API } = await import("./software-info-registration-
|
|
1754
|
+
const { default: API } = await import("./software-info-registration-C8kf-pBB.js").then((n) => n.eT);
|
|
1815
1755
|
return API;
|
|
1816
1756
|
}
|
|
1817
1757
|
function kosServiceRequest$7(params) {
|
|
@@ -2198,6 +2138,38 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
2198
2138
|
gpioApi,
|
|
2199
2139
|
gpioServiceRequest
|
|
2200
2140
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2141
|
+
function mapGpioChipToOptions(dto) {
|
|
2142
|
+
return dto;
|
|
2143
|
+
}
|
|
2144
|
+
function createGpioChipModel(dto) {
|
|
2145
|
+
return GpioChip.instance(dto.id).options(mapGpioChipToOptions(dto)).build();
|
|
2146
|
+
}
|
|
2147
|
+
function updateGpioChipModel(dto, model) {
|
|
2148
|
+
model.updateModel(mapGpioChipToOptions(dto));
|
|
2149
|
+
}
|
|
2150
|
+
function filterGpioChipDto(chip) {
|
|
2151
|
+
return !!chip.num || chip.num === 0;
|
|
2152
|
+
}
|
|
2153
|
+
function mapGpioChipId(chip) {
|
|
2154
|
+
return {
|
|
2155
|
+
id: `${GpioChip.type}-${chip.num}`,
|
|
2156
|
+
num: chip.num ?? 0,
|
|
2157
|
+
devName: chip.devName ?? "",
|
|
2158
|
+
name: chip.name ?? "",
|
|
2159
|
+
pinCount: chip.pinCount ?? 0,
|
|
2160
|
+
pinNames: chip.pinNames ?? []
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
function afterGpioChipCreated(model, dto) {
|
|
2164
|
+
dto.pinNames.forEach((pinName, index2) => {
|
|
2165
|
+
const pinModel = GpioPin.instance(`${model.name}-${pinName}`).options({
|
|
2166
|
+
name: pinName,
|
|
2167
|
+
pinNum: index2,
|
|
2168
|
+
chipNum: dto.num
|
|
2169
|
+
}).build();
|
|
2170
|
+
model.pinManager.addModel(pinModel);
|
|
2171
|
+
});
|
|
2172
|
+
}
|
|
2201
2173
|
var __defProp = Object.defineProperty;
|
|
2202
2174
|
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
2203
2175
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -2232,30 +2204,7 @@ let GpioChipContainerModelImpl = class {
|
|
|
2232
2204
|
this.logger.error("Failed to fetch GPIO pins", error);
|
|
2233
2205
|
return;
|
|
2234
2206
|
}
|
|
2235
|
-
Object.
|
|
2236
|
-
value.forEach((chip) => {
|
|
2237
|
-
if (!chip.num && chip.num !== 0) {
|
|
2238
|
-
this.logger.warn("Skipping GPIO chip with missing number", chip);
|
|
2239
|
-
return;
|
|
2240
|
-
}
|
|
2241
|
-
const chipModel = GpioChip.instance(`${GpioChip.type}-${chip.num}}`).options({
|
|
2242
|
-
num: chip.num,
|
|
2243
|
-
devName: chip.devName ?? "",
|
|
2244
|
-
name: chip.name ?? "",
|
|
2245
|
-
pinCount: chip.pinCount ?? 0,
|
|
2246
|
-
pinNames: chip.pinNames ?? []
|
|
2247
|
-
}).build();
|
|
2248
|
-
chip.pinNames?.forEach((pinName, index2) => {
|
|
2249
|
-
const pinModel = GpioPin.instance(`${chipModel.name}-${pinName}`).options({
|
|
2250
|
-
name: pinName,
|
|
2251
|
-
pinNum: index2,
|
|
2252
|
-
chipNum: chip.num
|
|
2253
|
-
}).build();
|
|
2254
|
-
chipModel.pinManager.addModel(pinModel);
|
|
2255
|
-
});
|
|
2256
|
-
this.addModel(chipModel);
|
|
2257
|
-
});
|
|
2258
|
-
});
|
|
2207
|
+
this.reconcile(Object.values(response).flat());
|
|
2259
2208
|
const statuses = ["bound", "pending", "invalid", "free"];
|
|
2260
2209
|
for (const status of statuses) {
|
|
2261
2210
|
Object.entries(pinData).forEach(
|
|
@@ -2322,6 +2271,13 @@ GpioChipContainerModelImpl = __decorateClass$1([
|
|
|
2322
2271
|
kosContainerAware({
|
|
2323
2272
|
containerOptions: {
|
|
2324
2273
|
sortKey: "num"
|
|
2274
|
+
},
|
|
2275
|
+
reconcile: {
|
|
2276
|
+
create: createGpioChipModel,
|
|
2277
|
+
update: updateGpioChipModel,
|
|
2278
|
+
filter: filterGpioChipDto,
|
|
2279
|
+
idMapper: mapGpioChipId,
|
|
2280
|
+
afterCreate: afterGpioChipCreated
|
|
2325
2281
|
}
|
|
2326
2282
|
}),
|
|
2327
2283
|
kosLoggerAware()
|
|
@@ -2895,6 +2851,92 @@ const ReconnectingOverlay = ({
|
|
|
2895
2851
|
}
|
|
2896
2852
|
);
|
|
2897
2853
|
};
|
|
2854
|
+
const readStatus = (core) => {
|
|
2855
|
+
if (core.reloading) return "reconnecting";
|
|
2856
|
+
return core.isOnline ? "online" : "offline";
|
|
2857
|
+
};
|
|
2858
|
+
const useConnectionDevState = () => {
|
|
2859
|
+
const [status, setStatus] = useState(
|
|
2860
|
+
() => readStatus(KosCore.getInstance())
|
|
2861
|
+
);
|
|
2862
|
+
useEffect(() => {
|
|
2863
|
+
const core = KosCore.getInstance();
|
|
2864
|
+
const disposer = kosAutoEffect(() => {
|
|
2865
|
+
setStatus(readStatus(core));
|
|
2866
|
+
});
|
|
2867
|
+
return () => {
|
|
2868
|
+
disposer();
|
|
2869
|
+
};
|
|
2870
|
+
}, []);
|
|
2871
|
+
return { status };
|
|
2872
|
+
};
|
|
2873
|
+
const OFFSET = "16px";
|
|
2874
|
+
const buttonRoot = css`
|
|
2875
|
+
position: fixed;
|
|
2876
|
+
display: inline-flex;
|
|
2877
|
+
align-items: center;
|
|
2878
|
+
gap: 8px;
|
|
2879
|
+
padding: 6px 12px;
|
|
2880
|
+
border: 1px solid rgba(255, 255, 255, 0.25);
|
|
2881
|
+
border-radius: 6px;
|
|
2882
|
+
background: rgba(0, 0, 0, 0.72);
|
|
2883
|
+
color: #ffffff;
|
|
2884
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
2885
|
+
font-size: 12px;
|
|
2886
|
+
line-height: 1.4;
|
|
2887
|
+
cursor: pointer;
|
|
2888
|
+
z-index: 2147483646;
|
|
2889
|
+
|
|
2890
|
+
&:disabled {
|
|
2891
|
+
cursor: default;
|
|
2892
|
+
opacity: 0.6;
|
|
2893
|
+
}
|
|
2894
|
+
`;
|
|
2895
|
+
const positions = {
|
|
2896
|
+
"bottom-left": css`
|
|
2897
|
+
bottom: ${OFFSET};
|
|
2898
|
+
left: ${OFFSET};
|
|
2899
|
+
`,
|
|
2900
|
+
"bottom-right": css`
|
|
2901
|
+
bottom: ${OFFSET};
|
|
2902
|
+
right: ${OFFSET};
|
|
2903
|
+
`,
|
|
2904
|
+
"top-left": css`
|
|
2905
|
+
top: ${OFFSET};
|
|
2906
|
+
left: ${OFFSET};
|
|
2907
|
+
`,
|
|
2908
|
+
"top-right": css`
|
|
2909
|
+
top: ${OFFSET};
|
|
2910
|
+
right: ${OFFSET};
|
|
2911
|
+
`
|
|
2912
|
+
};
|
|
2913
|
+
const statusText = css`
|
|
2914
|
+
font-weight: 600;
|
|
2915
|
+
text-transform: uppercase;
|
|
2916
|
+
letter-spacing: 0.04em;
|
|
2917
|
+
`;
|
|
2918
|
+
const ConnectionDevButton = ({
|
|
2919
|
+
position = "bottom-right",
|
|
2920
|
+
label = "Drop connection",
|
|
2921
|
+
className,
|
|
2922
|
+
renderContent
|
|
2923
|
+
}) => {
|
|
2924
|
+
const state = useConnectionDevState();
|
|
2925
|
+
return /* @__PURE__ */ jsx(
|
|
2926
|
+
"button",
|
|
2927
|
+
{
|
|
2928
|
+
type: "button",
|
|
2929
|
+
css: [buttonRoot, positions[position]],
|
|
2930
|
+
className,
|
|
2931
|
+
disabled: state.status !== "online",
|
|
2932
|
+
onClick: () => KosCore.getInstance().transport.dropConnection(),
|
|
2933
|
+
children: renderContent ? renderContent(state) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2934
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
2935
|
+
/* @__PURE__ */ jsx("span", { css: statusText, children: state.status })
|
|
2936
|
+
] })
|
|
2937
|
+
}
|
|
2938
|
+
);
|
|
2939
|
+
};
|
|
2898
2940
|
const DEFAULT_TRANSLATIONS = {
|
|
2899
2941
|
header: {
|
|
2900
2942
|
title: "Model",
|
|
@@ -5063,6 +5105,7 @@ export {
|
|
|
5063
5105
|
aZ as ChildModels,
|
|
5064
5106
|
CompanionParentModel,
|
|
5065
5107
|
ConfigBean,
|
|
5108
|
+
ConnectionDevButton,
|
|
5066
5109
|
a_ as ContainerAwareSetup,
|
|
5067
5110
|
CoreExtensionManager,
|
|
5068
5111
|
a$ as CoreModels,
|
|
@@ -5477,39 +5520,39 @@ export {
|
|
|
5477
5520
|
ek as pipe,
|
|
5478
5521
|
el as post,
|
|
5479
5522
|
em as preloadKosModel,
|
|
5480
|
-
processId,
|
|
5523
|
+
en as processId,
|
|
5481
5524
|
processMiddleware,
|
|
5482
|
-
|
|
5525
|
+
eo as put,
|
|
5483
5526
|
readModelHookEntry,
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5527
|
+
ep as registerCompanionModel,
|
|
5528
|
+
eq as registerCoreModels,
|
|
5529
|
+
er as registerExtensionPoint,
|
|
5530
|
+
es as registerHttpRoutes,
|
|
5531
|
+
et as registerKosModel,
|
|
5532
|
+
eu as registerLegacyModel,
|
|
5533
|
+
ev as resetKosModel,
|
|
5491
5534
|
resetPassword,
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
resolveContainerDeltas,
|
|
5495
|
-
resolveItemListDeltas,
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
resolveListDeltas,
|
|
5500
|
-
|
|
5501
|
-
|
|
5535
|
+
ew as resolveBaseUrl,
|
|
5536
|
+
ex as resolveChild,
|
|
5537
|
+
ey as resolveContainerDeltas,
|
|
5538
|
+
ez as resolveItemListDeltas,
|
|
5539
|
+
eA as resolveKosCompanion,
|
|
5540
|
+
eB as resolveKosContext,
|
|
5541
|
+
eC as resolveKosProfiles,
|
|
5542
|
+
eD as resolveListDeltas,
|
|
5543
|
+
eE as resolveServiceRequestParameters,
|
|
5544
|
+
eF as resolveServiceUrl,
|
|
5502
5545
|
resolveVariable,
|
|
5503
5546
|
retryWithExponentialBackoff,
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5547
|
+
eG as sendAsyncIntent,
|
|
5548
|
+
eH as sendBroadcastMessage,
|
|
5549
|
+
eI as sendIntent,
|
|
5550
|
+
eJ as sendKosHttpMessageResponse,
|
|
5551
|
+
eK as sendKosMessage,
|
|
5509
5552
|
sendKosMessageResponse,
|
|
5510
5553
|
sendRequest,
|
|
5511
|
-
|
|
5512
|
-
|
|
5554
|
+
eL as sendStudioMessage,
|
|
5555
|
+
eM as sendStudioMessageRequest,
|
|
5513
5556
|
startPasswordReset,
|
|
5514
5557
|
stringComponentInsert,
|
|
5515
5558
|
studioAcceptOrgInvitation,
|
|
@@ -5518,9 +5561,9 @@ export {
|
|
|
5518
5561
|
studioStartPasswordReset,
|
|
5519
5562
|
subscribeStore,
|
|
5520
5563
|
syncPublish,
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5564
|
+
eN as troubleByTypeReducer,
|
|
5565
|
+
eO as troubleDataFactory,
|
|
5566
|
+
eP as unloadKosModel,
|
|
5524
5567
|
updateCompanionModelRegistration,
|
|
5525
5568
|
updateModelRegistration,
|
|
5526
5569
|
updateRegion,
|
|
@@ -5529,6 +5572,7 @@ export {
|
|
|
5529
5572
|
useCalendarDayArray,
|
|
5530
5573
|
useConfigBean,
|
|
5531
5574
|
useConfigProperty,
|
|
5575
|
+
useConnectionDevState,
|
|
5532
5576
|
useConnectionState,
|
|
5533
5577
|
useContextModel,
|
|
5534
5578
|
useContextModelHierarchy,
|
|
@@ -5585,8 +5629,8 @@ export {
|
|
|
5585
5629
|
useYearsOptions,
|
|
5586
5630
|
uuid,
|
|
5587
5631
|
variableToHex,
|
|
5588
|
-
|
|
5589
|
-
|
|
5632
|
+
eQ as waitForAppToStart,
|
|
5633
|
+
eR as waitForAppsToStart,
|
|
5590
5634
|
waitForRequest,
|
|
5591
5635
|
whenReady,
|
|
5592
5636
|
withCancellation,
|
|
@@ -5601,6 +5645,6 @@ export {
|
|
|
5601
5645
|
withTroubleContainer,
|
|
5602
5646
|
withUsbUpdateContainer,
|
|
5603
5647
|
wrapPromise,
|
|
5604
|
-
|
|
5648
|
+
eS as wrapWithFutureLifecycle
|
|
5605
5649
|
};
|
|
5606
5650
|
//# sourceMappingURL=index.js.map
|