diff --git a/static/bun.lockb b/static/bun.lockb index a53018e..843f346 100755 Binary files a/static/bun.lockb and b/static/bun.lockb differ diff --git a/static/dist/index.js b/static/dist/index.js index cebbe92..0f16080 100644 --- a/static/dist/index.js +++ b/static/dist/index.js @@ -1,57 +1,5 @@ (() => { - // node_modules/uuid/dist/esm-browser/stringify.js - var byteToHex = []; - for (i = 0; i < 256; ++i) { - byteToHex.push((i + 256).toString(16).slice(1)); - } - var i; - function unsafeStringify(arr, offset = 0) { - return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); - } - - // node_modules/uuid/dist/esm-browser/rng.js - var getRandomValues; - var rnds8 = new Uint8Array(16); - function rng() { - if (!getRandomValues) { - getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); - if (!getRandomValues) { - throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); - } - } - return getRandomValues(rnds8); - } - - // node_modules/uuid/dist/esm-browser/native.js - var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); - var native_default = { - randomUUID - }; - - // node_modules/uuid/dist/esm-browser/v4.js - function v4(options, buf, offset) { - if (native_default.randomUUID && !buf && !options) { - return native_default.randomUUID(); - } - options = options || {}; - var rnds = options.random || (options.rng || rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - offset = offset || 0; - for (var i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - return buf; - } - return unsafeStringify(rnds); - } - var v4_default = v4; - // node_modules/bloatless-react/index.ts - function UUID() { - return v4_default(); - } var State = class { _value; _bindings = /* @__PURE__ */ new Set(); @@ -99,10 +47,9 @@ remove(...items) { items.forEach((item) => { this.value.delete(item); - const id = item.id; - if (!this.removalHandlers.has(id)) return; - this.removalHandlers.get(id)(item); - this.removalHandlers.delete(id); + if (!this.removalHandlers.has(item)) return; + this.removalHandlers.get(item)(item); + this.removalHandlers.delete(item); }); this.callSubscriptions(); } @@ -115,7 +62,7 @@ [...this.value.values()].forEach(handler); } handleRemoval(item, handler) { - this.removalHandlers.set(item.id, handler); + this.removalHandlers.set(item, handler); } // stringification toString() { @@ -425,7 +372,6 @@ this.channel = channel; this.body = body; } - id = UUID(); }; var isDisconnected = new State(true); var mailboxId = restoreState("mailbox-id", ""); diff --git a/static/node_modules/bloatless-react/index.ts b/static/node_modules/bloatless-react/index.ts index 4a4085a..d80f107 100755 --- a/static/node_modules/bloatless-react/index.ts +++ b/static/node_modules/bloatless-react/index.ts @@ -58,9 +58,9 @@ export class State { } } -export class ListState extends State> { +export class ListState extends State> { private additionHandlers = new Set>(); - private removalHandlers = new Map>(); + private removalHandlers = new Map>(); // init constructor(initialItems?: T[]) { @@ -79,11 +79,10 @@ export class ListState extends State> { remove(...items: T[]): void { items.forEach((item) => { this.value.delete(item); - const id = item.id; - if (!this.removalHandlers.has(id)) return; - this.removalHandlers.get(id)!(item); - this.removalHandlers.delete(id); + if (!this.removalHandlers.has(item)) return; + this.removalHandlers.get(item)!(item); + this.removalHandlers.delete(item); }); this.callSubscriptions(); } @@ -99,7 +98,7 @@ export class ListState extends State> { } handleRemoval(item: T, handler: RemovalSubscription): void { - this.removalHandlers.set(item.id, handler); + this.removalHandlers.set(item, handler); } // stringification @@ -144,7 +143,7 @@ export function restoreState( return state; } -export function restoreListState( +export function restoreListState( localStorageKey: string ): ListState { const storedString = localStorage.getItem(localStorageKey) ?? ""; @@ -163,7 +162,7 @@ export function restoreListState( return state; } -export type ListItemConverter = ( +export type ListItemConverter = ( item: T ) => HTMLElement; diff --git a/static/node_modules/bloatless-react/package.json b/static/node_modules/bloatless-react/package.json index 1e84a58..5b86dd5 100644 --- a/static/node_modules/bloatless-react/package.json +++ b/static/node_modules/bloatless-react/package.json @@ -1,6 +1,6 @@ { "name": "bloatless-react", - "version": "1.2.5-beta1", + "version": "1.2.6", "description": "very minimal and flexible react alternative", "repository": { "type": "git", diff --git a/static/package.json b/static/package.json index 459557d..eb23422 100644 --- a/static/package.json +++ b/static/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "bloatless-react": "1.2.5-beta1", + "bloatless-react": "^1.2.6", "esbuild": "latest", "udn-frontend": "^1.0.6" }, diff --git a/static/src/model.tsx b/static/src/model.tsx index c653ba5..b6340e6 100644 --- a/static/src/model.tsx +++ b/static/src/model.tsx @@ -3,9 +3,7 @@ import * as React from "bloatless-react"; import UDNFrontend from "udn-frontend"; import { translations } from "./translations"; -export class Message implements React.Identifiable { - id = React.UUID(); - +export class Message { constructor(public channel: string, public body: string) {} }