@caisual/kit 0.14.0 → 0.15.0

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/overlay.js CHANGED
@@ -1117,11 +1117,11 @@ function createBoardController(input) {
1117
1117
  loading = false;
1118
1118
  if (matches() && saving !== "saved" && saving !== "bestAlready") {
1119
1119
  reads++;
1120
- if (reads < 4) {
1120
+ if (reads < 2) {
1121
1121
  saving = "saving";
1122
1122
  timer = later(() => {
1123
1123
  void refresh();
1124
- }, [800, 1600, 3200][reads - 1]);
1124
+ }, 1600);
1125
1125
  } else saving = "refreshHint";
1126
1126
  }
1127
1127
  notify();
@@ -1553,6 +1553,7 @@ function mountOverlay(input) {
1553
1553
  host.style.setProperty("--boot-accent", luminance > 0.179 ? accent : `color-mix(in srgb, ${accent}, #ffffff 70%)`);
1554
1554
  input.container.append(host);
1555
1555
  let model = initialUi(manifest), disposed = false, operation = 0, lastView = "", geometryFrame = 0;
1556
+ let inviteAfterCreate;
1556
1557
  let lastPhase = "", wasModal = false, copyFallback = null;
1557
1558
  let boot = null, bootTimer = 0, bootFadeTimer = 0;
1558
1559
  let voiceError = null, voicePending = null, voiceOperation = 0;
@@ -1972,11 +1973,12 @@ function mountOverlay(input) {
1972
1973
  if (model.session?.kind === "local") void perform("local.start", { mode: model.session.mode ?? model.mode });
1973
1974
  else if (model.session?.room?.status === "finished") void perform("room.restart", {});
1974
1975
  else if (solo()) void perform("room.create", { mode: model.session?.room?.mode ?? null });
1975
- else void perform("room.create", { mode: model.session?.room?.mode ?? null }, async () => {
1976
- setPanel("invite");
1977
- dispatch({ type: "notice", notice: t("newRoom") });
1978
- await copyInvite();
1979
- });
1976
+ else {
1977
+ inviteAfterCreate = roomCode();
1978
+ void perform("room.create", { mode: model.session?.room?.mode ?? null }).then(() => {
1979
+ if (model.error) inviteAfterCreate = void 0;
1980
+ });
1981
+ }
1980
1982
  break;
1981
1983
  }
1982
1984
  case "disconnect-exit":
@@ -2129,6 +2131,13 @@ function mountOverlay(input) {
2129
2131
  model = reduceUi(model, { type: "session", session });
2130
2132
  updateVoice();
2131
2133
  } else dispatch({ type: "session", session });
2134
+ const created = roomCode();
2135
+ if (inviteAfterCreate !== void 0 && created && created !== inviteAfterCreate) {
2136
+ inviteAfterCreate = void 0;
2137
+ setPanel("invite");
2138
+ dispatch({ type: "notice", notice: t("newRoom") });
2139
+ void copyInvite();
2140
+ }
2132
2141
  }));
2133
2142
  stops.push(input.bridge.onOpen((panel) => setPanel(panel)), input.bridge.onShortcut(toggle), input.bridge.onError(({ error }) => {
2134
2143
  if (!visiblePanel(model)) setPanel("room");