feat: Phase 1 — extract the client (web SPA + desktop) to dtoro/oikos-web
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled

Problem: the hexagonal refactor churns the backend tree for nine more
phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper,
compose/web image) must move to its own repo first so doc/layout
rewrites land once on a backend-only tree.

Change:
- New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/
  (updateURL repointed to oikos-web releases), compose/, own CI (web +
  desktop jobs), own deploy script (CI-green gate, TOCTOU guard,
  version-tagged images, prune-to-3), own webhook receiver on :9798 +
  launchd unit, own compose project publishing the same 8091:80.
- Cutover executed on mac-mini in order: oikos stack's web service
  stopped+removed, oikos-web project brought up on 8091; outer Caddy
  untouched (targets the published port) — serving + Authentik flow +
  /wails 404 quirk verified post-cutover.
- Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI
  workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install
  targets, the compose web service, oikos-web from deploy.sh's fallback
  prune list; wails + go-keyring dropped from go.mod, vendor synced.
- README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now
  point at the new repo; mbse + mascot design docs carry a path note.

Risk: production SPA serving depends on the new pipeline now; rollback
is versioned-image re-up of the old web service from a pre-split
checkout (port 8091). Desktop builds installed before the split still
check dtoro/oikos releases — one manual reinstall, noted in the
oikos-web release notes.

Verification: go vet, make test (race), make generate-check, golangci
(no new findings; baseline down 400→365); post-cutover curls —
localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
This commit is contained in:
2026-08-15 22:27:52 +02:00
parent e074f04bdf
commit d4d99a7473
18854 changed files with 2615729 additions and 173735 deletions

View File

@@ -0,0 +1,2 @@
export declare function sumPartial<T>(arr: ReadonlyArray<T>, start: number, end: number, valueFunction: (element: T, index: number) => number): number;
export declare function forEachPartial<T>(arr: ReadonlyArray<T>, start: number, end: number, callback: (element: T, index: number) => void): void;

View File

@@ -0,0 +1,12 @@
export function sumPartial(arr, start, end, valueFunction) {
let sum = 0;
for (let i = start; i < end; i++) {
sum += valueFunction(arr[i], i);
}
return sum;
}
export function forEachPartial(arr, start, end, callback) {
for (let i = start; i < end; i++) {
callback(arr[i], i);
}
}

View File

@@ -0,0 +1,6 @@
/**
* This is an source of callbacks that are safe to be called even if the object of `callbackObjectGetter()` is nullish on that moment.
*
* In the case of the object is nullish, invoking the callbacks will do nothing.
*/
export declare const carefullCallbackSource: <CallbacksObject extends object>(callbackObjectGetter: () => CallbacksObject | undefined) => (<Callback extends keyof CallbacksObject>(callbackName: Callback) => CallbacksObject[Callback]);

View File

@@ -0,0 +1,19 @@
/**
* Generate a callback that is safe to be called even if `callbackObjectGetter()` is nullish on that moment.
*
* In the case of the object is nullish, invoking the callback will do nothing.
*/
const carefullCallbackGenerator = (callbackObjectGetter, callbackName) => (value) => {
const callbackObject = callbackObjectGetter();
if (callbackObject !== null) {
callbackObject[callbackName](value);
}
};
/**
* This is an source of callbacks that are safe to be called even if the object of `callbackObjectGetter()` is nullish on that moment.
*
* In the case of the object is nullish, invoking the callbacks will do nothing.
*/
export const carefullCallbackSource = (callbackObjectGetter) =>
//@ts-expect-error unassignable
carefullCallbackGenerator.bind(null, callbackObjectGetter);

View File

@@ -0,0 +1,32 @@
import { type Sides, type SidesStart } from './sizing.js';
export type Position = SidesStart;
/** This is a minimal version of DOMRect for our use.
* We don't use DOMRect constructor because the lack of legacy browsers support (e.g. IE11).
*/
export interface Rect extends Position {
width: number;
height: number;
}
type LegacyClientRect = Pick<Readonly<DOMRect>, 'height' | 'width' | 'left' | 'right' | 'top' | 'bottom'>;
/**
* A legacy-typed safer version of `element.getBoundingClientRect()`,
* that also invites minification capabilities (muliply calls can be forward to here, and it's pure).
* */
export declare const getElementRect: (element: HTMLElement) => LegacyClientRect;
export declare const getBordersSizeOffsets: {
(computedStyle: CSSStyleDeclaration, calcEnds?: true): Sides;
(computedStyle: CSSStyleDeclaration, calcEnds: false): SidesStart;
};
/**
* Computes the position and the dimensions of the element without the border.
*
* While `element.getBoundingClientRect()` gives the correct size with the borders, this method method does include the borders.
*
* Notice that for calculating the width and the height without the border, we must use this function instead of using
* `Element.clientWidth` and `Element.clientHeight`, beacuse they round the sizes of the pixels to be integer.
*/
export declare function elementRectWithoutBorder(element: HTMLElement, computedStyle?: CSSStyleDeclaration): Rect;
/** Get the cursor position relative to some element. */
export declare const positionDiff: (to: Position, from: Position) => Position;
export declare function getGlobalMousePosition(event: MouseEvent | TouchEvent): Position;
export {};

View File

@@ -0,0 +1,83 @@
import { pxToNumber } from './sizing.js';
import { calcComputedStyle } from './styling.js';
/**
* A legacy-typed safer version of `element.getBoundingClientRect()`,
* that also invites minification capabilities (muliply calls can be forward to here, and it's pure).
* */
export const getElementRect = (element) =>
/*@__PURE__*/ element.getBoundingClientRect();
export const getBordersSizeOffsets = (computedStyle, calcEnds = true) => {
if (computedStyle.getPropertyValue('box-sizing') === 'border-box') {
// In this case, no offset is needed since the box model of this element doesn't include the border.
return undefined;
}
// otherwise
const left = pxToNumber(computedStyle.getPropertyValue('border-left-width'));
if (left === undefined) {
console.error('Splitpanes Error: Fail to parse container `border-left-width`.');
return undefined;
}
// otherwise
const top = pxToNumber(computedStyle.getPropertyValue('border-top-width'));
if (top === undefined) {
console.error('Splitpanes Error: Fail to parse container `border-top-width`.');
return undefined;
}
// otherwise
const result = { left, top };
if (calcEnds) {
const right = pxToNumber(computedStyle.getPropertyValue('border-right-width'));
if (right === undefined) {
console.error('Splitpanes Error: Fail to parse container `border-right-width`.');
return undefined;
}
// otherwise
const bottom = pxToNumber(computedStyle.getPropertyValue('border-bottom-width'));
if (bottom === undefined) {
console.error('Splitpanes Error: Fail to parse container `border-bottom-width`.');
return undefined;
}
// otherwise
const resultExtended = result;
resultExtended.right = right;
resultExtended.bottom = bottom;
}
return result;
};
/**
* Computes the position and the dimensions of the element without the border.
*
* While `element.getBoundingClientRect()` gives the correct size with the borders, this method method does include the borders.
*
* Notice that for calculating the width and the height without the border, we must use this function instead of using
* `Element.clientWidth` and `Element.clientHeight`, beacuse they round the sizes of the pixels to be integer.
*/
export function elementRectWithoutBorder(element, computedStyle) {
if (!computedStyle) {
computedStyle = calcComputedStyle(element);
}
const rect = getElementRect(element);
const borderOffsets = getBordersSizeOffsets(computedStyle, true) || {
left: 0,
top: 0,
right: 0,
bottom: 0
};
return {
width: rect.width - borderOffsets.left - borderOffsets.right,
height: rect.height - borderOffsets.top - borderOffsets.bottom,
left: rect.left + borderOffsets.left,
top: rect.top + borderOffsets.top
};
}
/** Get the cursor position relative to some element. */
export const positionDiff = (to, from) => ({
left: to.left - from.left,
top: to.top - from.top
});
export function getGlobalMousePosition(event) {
const eventMouse = event;
const eventTouch = event;
const { clientX, clientY } = 'ontouchstart' in window && eventTouch.touches ? eventTouch.touches[0] : eventMouse;
return { left: clientX, top: clientY };
}

View File

@@ -0,0 +1,11 @@
export interface SidesStart {
left: number;
top: number;
}
export interface SidesEnd {
right: number;
bottom: number;
}
export type Sides = SidesStart & SidesEnd;
export declare function pxToNumber(pxString: string | undefined): number | undefined;
export declare const getDimensionName: (horizontal: boolean) => "height" | "width";

View File

@@ -0,0 +1,9 @@
export function pxToNumber(pxString) {
if (!pxString?.endsWith('px')) {
return undefined;
}
// otherwise
const num = parseFloat(pxString.slice(0, pxString.length - 2));
return isNaN(num) ? undefined : num;
}
export const getDimensionName = (horizontal) => (horizontal ? 'height' : 'width');

View File

@@ -0,0 +1,5 @@
/**
* A wrapper of `window.getComputedStyle()`,
* that also invites minification capabilities (muliply calls can be forward to here, and it's pure).
* */
export declare const calcComputedStyle: (element: HTMLElement) => CSSStyleDeclaration;

View File

@@ -0,0 +1,6 @@
/**
* A wrapper of `window.getComputedStyle()`,
* that also invites minification capabilities (muliply calls can be forward to here, and it's pure).
* */
export const calcComputedStyle = (element) =>
/*@__PURE__*/ window.getComputedStyle(element);