@davidsouther/jiffies 2.3.0 → 2026.4.1

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.
Files changed (178) hide show
  1. package/package.json +17 -20
  2. package/src/dom/README.md +1 -1
  3. package/src/dom/dom.ts +10 -1
  4. package/src/dom/fc.ts +4 -1
  5. package/src/dom/form/form.ts +1 -4
  6. package/src/dom/html.ts +1 -1
  7. package/src/dom/index.ts +2 -0
  8. package/src/dom/router/router.ts +1 -1
  9. package/src/observable/observable.ts +2 -0
  10. package/src/scope/fix.ts +0 -2
  11. package/src/transpile.mjs +0 -1
  12. package/tsconfig.json +34 -0
  13. package/lib/cjs/assert.d.ts +0 -26
  14. package/lib/cjs/awaitable.d.ts +0 -1
  15. package/lib/cjs/case.d.ts +0 -1
  16. package/lib/cjs/components/button_bar.d.ts +0 -8
  17. package/lib/cjs/components/inline_edit.d.ts +0 -12
  18. package/lib/cjs/components/logger.d.ts +0 -6
  19. package/lib/cjs/components/select.d.ts +0 -10
  20. package/lib/cjs/components/test.d.ts +0 -1
  21. package/lib/cjs/components/virtual_scroll.d.ts +0 -42
  22. package/lib/cjs/components/virtual_scroll.test.d.ts +0 -1
  23. package/lib/cjs/context.d.ts +0 -11
  24. package/lib/cjs/context.test.d.ts +0 -1
  25. package/lib/cjs/debounce.d.ts +0 -1
  26. package/lib/cjs/diff.d.ts +0 -15
  27. package/lib/cjs/diff.test.d.ts +0 -1
  28. package/lib/cjs/display.d.ts +0 -5
  29. package/lib/cjs/dom/css/border.d.ts +0 -11
  30. package/lib/cjs/dom/css/constants.d.ts +0 -31
  31. package/lib/cjs/dom/css/core.d.ts +0 -5
  32. package/lib/cjs/dom/css/fstyle.d.ts +0 -5
  33. package/lib/cjs/dom/css/sizing.d.ts +0 -5
  34. package/lib/cjs/dom/dom.d.ts +0 -27
  35. package/lib/cjs/dom/fc.d.ts +0 -10
  36. package/lib/cjs/dom/fc.test.d.ts +0 -1
  37. package/lib/cjs/dom/form/form.app.d.ts +0 -1
  38. package/lib/cjs/dom/form/form.d.ts +0 -25
  39. package/lib/cjs/dom/form/form.test.d.ts +0 -0
  40. package/lib/cjs/dom/html.d.ts +0 -112
  41. package/lib/cjs/dom/html.test.d.ts +0 -1
  42. package/lib/cjs/dom/observable.d.ts +0 -2
  43. package/lib/cjs/dom/observable.test.d.ts +0 -1
  44. package/lib/cjs/dom/provide.d.ts +0 -3
  45. package/lib/cjs/dom/router/link.d.ts +0 -6
  46. package/lib/cjs/dom/router/router.d.ts +0 -13
  47. package/lib/cjs/dom/svg.d.ts +0 -64
  48. package/lib/cjs/dom/test.d.ts +0 -1
  49. package/lib/cjs/dom/types/css.d.ts +0 -6590
  50. package/lib/cjs/dom/types/dom.d.ts +0 -0
  51. package/lib/cjs/dom/types/html.d.ts +0 -614
  52. package/lib/cjs/dom/xml.d.ts +0 -1
  53. package/lib/cjs/equal.d.ts +0 -11
  54. package/lib/cjs/equal.test.d.ts +0 -1
  55. package/lib/cjs/flags.d.ts +0 -7
  56. package/lib/cjs/flags.test.d.ts +0 -1
  57. package/lib/cjs/fs.d.ts +0 -72
  58. package/lib/cjs/fs.test.d.ts +0 -1
  59. package/lib/cjs/fs_node.d.ts +0 -15
  60. package/lib/cjs/fs_win.test.d.ts +0 -1
  61. package/lib/cjs/generator.d.ts +0 -1
  62. package/lib/cjs/generator.test.d.ts +0 -1
  63. package/lib/cjs/is_browser.d.ts +0 -1
  64. package/lib/cjs/lock.d.ts +0 -1
  65. package/lib/cjs/lock.test.d.ts +0 -1
  66. package/lib/cjs/log.d.ts +0 -54
  67. package/lib/cjs/observable/event.d.ts +0 -35
  68. package/lib/cjs/observable/observable.d.ts +0 -134
  69. package/lib/cjs/observable/observable.test.d.ts +0 -1
  70. package/lib/cjs/range.d.ts +0 -1
  71. package/lib/cjs/result.d.ts +0 -31
  72. package/lib/cjs/result.test.d.ts +0 -1
  73. package/lib/cjs/safe.d.ts +0 -1
  74. package/lib/cjs/scope/describe.d.ts +0 -18
  75. package/lib/cjs/scope/display/console.d.ts +0 -2
  76. package/lib/cjs/scope/display/dom.d.ts +0 -3
  77. package/lib/cjs/scope/display/junit.d.ts +0 -2
  78. package/lib/cjs/scope/execute.d.ts +0 -12
  79. package/lib/cjs/scope/expect.d.ts +0 -23
  80. package/lib/cjs/scope/fix.d.ts +0 -4
  81. package/lib/cjs/scope/index.d.ts +0 -3
  82. package/lib/cjs/scope/scope.d.ts +0 -17
  83. package/lib/cjs/scope/state.d.ts +0 -2
  84. package/lib/cjs/server/http/apps.d.ts +0 -5
  85. package/lib/cjs/server/http/css.d.ts +0 -5
  86. package/lib/cjs/server/http/index.d.ts +0 -16
  87. package/lib/cjs/server/http/response.d.ts +0 -4
  88. package/lib/cjs/server/http/sitemap.d.ts +0 -2
  89. package/lib/cjs/server/http/static.d.ts +0 -2
  90. package/lib/cjs/server/http/typescript.d.ts +0 -5
  91. package/lib/cjs/server/main.d.ts +0 -2
  92. package/lib/cjs/test.d.mts +0 -2
  93. package/lib/cjs/test_all.d.ts +0 -9
  94. package/lib/cjs/transpile.d.mts +0 -3
  95. package/lib/cjs/tsconfig.tsbuildinfo +0 -1
  96. package/lib/esm/assert.d.ts +0 -26
  97. package/lib/esm/awaitable.d.ts +0 -1
  98. package/lib/esm/case.d.ts +0 -1
  99. package/lib/esm/components/button_bar.d.ts +0 -8
  100. package/lib/esm/components/inline_edit.d.ts +0 -12
  101. package/lib/esm/components/logger.d.ts +0 -6
  102. package/lib/esm/components/select.d.ts +0 -10
  103. package/lib/esm/components/test.d.ts +0 -1
  104. package/lib/esm/components/virtual_scroll.d.ts +0 -42
  105. package/lib/esm/components/virtual_scroll.test.d.ts +0 -1
  106. package/lib/esm/context.d.ts +0 -11
  107. package/lib/esm/context.test.d.ts +0 -1
  108. package/lib/esm/debounce.d.ts +0 -1
  109. package/lib/esm/diff.d.ts +0 -15
  110. package/lib/esm/diff.test.d.ts +0 -1
  111. package/lib/esm/display.d.ts +0 -5
  112. package/lib/esm/dom/css/border.d.ts +0 -11
  113. package/lib/esm/dom/css/constants.d.ts +0 -31
  114. package/lib/esm/dom/css/core.d.ts +0 -5
  115. package/lib/esm/dom/css/fstyle.d.ts +0 -5
  116. package/lib/esm/dom/css/sizing.d.ts +0 -5
  117. package/lib/esm/dom/dom.d.ts +0 -27
  118. package/lib/esm/dom/fc.d.ts +0 -10
  119. package/lib/esm/dom/fc.test.d.ts +0 -1
  120. package/lib/esm/dom/form/form.app.d.ts +0 -1
  121. package/lib/esm/dom/form/form.d.ts +0 -25
  122. package/lib/esm/dom/form/form.test.d.ts +0 -0
  123. package/lib/esm/dom/html.d.ts +0 -112
  124. package/lib/esm/dom/html.test.d.ts +0 -1
  125. package/lib/esm/dom/observable.d.ts +0 -2
  126. package/lib/esm/dom/observable.test.d.ts +0 -1
  127. package/lib/esm/dom/provide.d.ts +0 -3
  128. package/lib/esm/dom/router/link.d.ts +0 -6
  129. package/lib/esm/dom/router/router.d.ts +0 -13
  130. package/lib/esm/dom/svg.d.ts +0 -64
  131. package/lib/esm/dom/test.d.ts +0 -1
  132. package/lib/esm/dom/types/css.d.ts +0 -6590
  133. package/lib/esm/dom/types/dom.d.ts +0 -0
  134. package/lib/esm/dom/types/html.d.ts +0 -614
  135. package/lib/esm/dom/xml.d.ts +0 -1
  136. package/lib/esm/equal.d.ts +0 -11
  137. package/lib/esm/equal.test.d.ts +0 -1
  138. package/lib/esm/flags.d.ts +0 -7
  139. package/lib/esm/flags.test.d.ts +0 -1
  140. package/lib/esm/fs.d.ts +0 -72
  141. package/lib/esm/fs.test.d.ts +0 -1
  142. package/lib/esm/fs_node.d.ts +0 -15
  143. package/lib/esm/fs_win.test.d.ts +0 -1
  144. package/lib/esm/generator.d.ts +0 -1
  145. package/lib/esm/generator.test.d.ts +0 -1
  146. package/lib/esm/is_browser.d.ts +0 -1
  147. package/lib/esm/lock.d.ts +0 -1
  148. package/lib/esm/lock.test.d.ts +0 -1
  149. package/lib/esm/log.d.ts +0 -54
  150. package/lib/esm/observable/event.d.ts +0 -35
  151. package/lib/esm/observable/observable.d.ts +0 -134
  152. package/lib/esm/observable/observable.test.d.ts +0 -1
  153. package/lib/esm/range.d.ts +0 -1
  154. package/lib/esm/result.d.ts +0 -31
  155. package/lib/esm/result.test.d.ts +0 -1
  156. package/lib/esm/safe.d.ts +0 -1
  157. package/lib/esm/scope/describe.d.ts +0 -18
  158. package/lib/esm/scope/display/console.d.ts +0 -2
  159. package/lib/esm/scope/display/dom.d.ts +0 -3
  160. package/lib/esm/scope/display/junit.d.ts +0 -2
  161. package/lib/esm/scope/execute.d.ts +0 -12
  162. package/lib/esm/scope/expect.d.ts +0 -23
  163. package/lib/esm/scope/fix.d.ts +0 -4
  164. package/lib/esm/scope/index.d.ts +0 -3
  165. package/lib/esm/scope/scope.d.ts +0 -17
  166. package/lib/esm/scope/state.d.ts +0 -2
  167. package/lib/esm/server/http/apps.d.ts +0 -5
  168. package/lib/esm/server/http/css.d.ts +0 -5
  169. package/lib/esm/server/http/index.d.ts +0 -16
  170. package/lib/esm/server/http/response.d.ts +0 -4
  171. package/lib/esm/server/http/sitemap.d.ts +0 -2
  172. package/lib/esm/server/http/static.d.ts +0 -2
  173. package/lib/esm/server/http/typescript.d.ts +0 -5
  174. package/lib/esm/server/main.d.ts +0 -2
  175. package/lib/esm/test.d.mts +0 -2
  176. package/lib/esm/test_all.d.ts +0 -9
  177. package/lib/esm/transpile.d.mts +0 -3
  178. package/lib/esm/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@davidsouther/jiffies",
3
- "version": "2.3.0",
3
+ "version": "2026.4.1",
4
4
  "private": false,
5
5
  "displayName": "JEFRi Jiffies",
6
6
  "type": "module",
7
- "main": "./lib/cjs/",
8
- "module": "./lib/esm/",
9
- "types": "./lib/esm/index.d.ts",
10
- "directories": {
11
- "lib": "./lib/cjs"
7
+ "exports": {
8
+ "./*.ts": "./src/*.ts"
12
9
  },
10
+ "files": [
11
+ "src",
12
+ "LICENSE",
13
+ "package.json",
14
+ "README.md",
15
+ "tsconfig.json"
16
+ ],
13
17
  "engines": {
14
- "node": ">=20.0.9"
18
+ "node": ">=22.18.0"
15
19
  },
16
20
  "scripts": {
17
- "node": "node --import ./src/loader-register.mjs",
18
21
  "start": "node ./src/server/main.ts",
19
22
  "test": "node ./src/test.mjs",
20
23
  "ci": "npm run node ./src/test.mjs --mode=junit",
@@ -22,22 +25,16 @@
22
25
  "fix": "biome check --write --unsafe",
23
26
  "check:format": "biome format",
24
27
  "check:lint": "biome check",
25
- "build": "npm run build:esm & npm run build:cjs & npm run build:css",
26
- "postbuild": "npm run fixup",
27
- "build:esm": "tsc",
28
- "build:cjs": "tsc --module commonjs --outDir lib/cjs",
29
- "fixup:cjs": "echo '{\"module\":\"commonjs\"}' > lib/cjs/package.json",
30
- "fixup": "npm run fixup:cjs",
31
- "build:css": "sass ./src/pico/pico.scss ./build/pico.css",
32
- "watch": "npx tsc --watch",
33
- "all": "npm run check:lint && npm run test && npm run build"
28
+ "all": "npm run check:lint && npm run test"
34
29
  },
35
30
  "devDependencies": {
36
- "@biomejs/biome": "^2.3.10",
31
+ "@biomejs/biome": "^2.3.11",
32
+ "@types/jsdom": "^27.0.0",
37
33
  "@types/node": "^20.8.9"
38
34
  },
39
35
  "dependencies": {
40
- "ts-blank-space": "^0.6.2",
36
+ "jsdom": "^27.4.0",
37
+ "ts-blank-space": "^0.7.0",
41
38
  "typescript": "^5.9.3"
42
39
  }
43
- }
40
+ }
package/src/dom/README.md CHANGED
@@ -35,7 +35,7 @@ export const Input(name, type="string") => {
35
35
  )
36
36
  }
37
37
 
38
- document.body.append(
38
+ window.document.body.append(
39
39
  Form(
40
40
  {
41
41
  title: "Details",
package/src/dom/dom.ts CHANGED
@@ -1,6 +1,13 @@
1
1
  import { assertExists } from "../assert.ts";
2
2
  import type { Properties as SVGProperties } from "./types/css.ts";
3
3
 
4
+ if (typeof window === "undefined") {
5
+ const { JSDOM } = await import("jsdom");
6
+ // biome-ignore lint/suspicious/noGlobalAssign: Load JSDom globally
7
+ window = global.window = new JSDOM().window as unknown as Window &
8
+ typeof globalThis;
9
+ }
10
+
4
11
  export const XHTML_NAMESPACE_URI = "http://www.w3.org/1999/xhtml";
5
12
  export const SVG_NAMESPACE_URI = "http://www.w3.org/2000/svg";
6
13
 
@@ -22,7 +29,9 @@ export type DomAttrs = {
22
29
  };
23
30
 
24
31
  export type Attrs<E extends Omit<Element, "update">, S = object> = Partial<
25
- Omit<{ [k in keyof E]: string | number | boolean }, "style"> & S & DomAttrs
32
+ Omit<{ [k in keyof E]: string | number | boolean }, "style" | "toString"> &
33
+ S &
34
+ DomAttrs
26
35
  >;
27
36
 
28
37
  export type DenormAttrs<E extends Omit<Element, "update">, S = object> =
package/src/dom/fc.ts CHANGED
@@ -68,7 +68,10 @@ export function FC<Props extends object, State extends object = object>(
68
68
  attrs?: Attrs<Props> | DenormChildren,
69
69
  ...children: DenormChildren[]
70
70
  ): FCComponent<Props, State> => {
71
- const element = document.createElement(name) as FCComponent<Props, State>;
71
+ const element = window.document.createElement(name) as FCComponent<
72
+ Props,
73
+ State
74
+ >;
72
75
  element.update(attrs, ...children);
73
76
  return element;
74
77
  };
@@ -61,10 +61,7 @@ const prepareOptions = (
61
61
  : { value, ...label },
62
62
  );
63
63
  export const Option = (attrs: OptionAttributes) =>
64
- option(
65
- // @ts-expect-error
66
- attrs as Attrs<HTMLOptionElement>,
67
- );
64
+ option(attrs as Attrs<HTMLOptionElement>);
68
65
 
69
66
  export const Dropdown = (
70
67
  attrs: SelectAttributes | { selected?: string },
package/src/dom/html.ts CHANGED
@@ -7,7 +7,7 @@ const makeHTMLElement =
7
7
  ...children: DenormChildren[]
8
8
  ) =>
9
9
  up(
10
- document.createElement(name),
10
+ window.document.createElement(name),
11
11
  attrs,
12
12
  ...children,
13
13
  ) as HTMLElementTagNameMap[K];
@@ -0,0 +1,2 @@
1
+ export * as fc from "./fc.ts";
2
+ export * as html from "./html.ts";
@@ -7,7 +7,7 @@ export interface Router {
7
7
  (target: DOMElement): DOMElement;
8
8
  }
9
9
 
10
- const baseURI = `${document.baseURI}`;
10
+ const baseURI = `${window.document.baseURI}`;
11
11
  const normalizeHref = () => {
12
12
  return `${location.href}/` === baseURI ? baseURI : location.href;
13
13
  };
@@ -307,6 +307,8 @@ export function eventListener<E extends Event>() {
307
307
  }
308
308
 
309
309
  export class EventHandler<E extends Event> extends Subject<E> {
310
+ eventFn: (e: E) => void | Promise<void>;
311
+
310
312
  constructor(eventFn: (e: E) => void | Promise<void>) {
311
313
  super(AsyncScheduler);
312
314
  this.eventFn = eventFn;
package/src/scope/fix.ts CHANGED
@@ -3,7 +3,6 @@
3
3
  */
4
4
  export function fix<T>(n: T): T {
5
5
  if (typeof n === "number") {
6
- // @ts-expect-error
7
6
  return +n.toFixed(1) as T;
8
7
  }
9
8
  if (n !== Object(n)) {
@@ -11,7 +10,6 @@ export function fix<T>(n: T): T {
11
10
  return n;
12
11
  }
13
12
  if (Array.isArray(n)) {
14
- // @ts-expect-error
15
13
  return n.map(fix) as T;
16
14
  }
17
15
  // @ts-expect-error
package/src/transpile.mjs CHANGED
@@ -1,4 +1,3 @@
1
- // @ts-expect-error
2
1
  import tsBlankSpace from "ts-blank-space";
3
2
 
4
3
  const tsmap = new Map();
package/tsconfig.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Assume browser environment & esm
4
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "emitDeclarationOnly": true,
9
+ "allowJs": true,
10
+ "checkJs": true,
11
+ "jsx": "react",
12
+
13
+ // Checks and strictness
14
+ "strict": true,
15
+ "allowUnreachableCode": false,
16
+ "allowUnusedLabels": false,
17
+ // "exactOptionalPropertyTypes": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ // "noImplicitOverride": true,
20
+ "noImplicitReturns": true,
21
+ // "noPropertyAccessFromIndexSignature": true,
22
+ // "noUncheckedIndexedAccess": true,
23
+ // "noUnusedLocals": true,
24
+ "skipLibCheck": true,
25
+ "exactOptionalPropertyTypes": true,
26
+ "erasableSyntaxOnly": true,
27
+ "allowImportingTsExtensions": true,
28
+
29
+ "incremental": true,
30
+ "outDir": "lib/esm",
31
+ "declaration": true
32
+ },
33
+ "include": ["src"]
34
+ }
@@ -1,26 +0,0 @@
1
- type AssertMessage = string | (() => string);
2
- export declare class AssertionError extends Error {
3
- constructor(message?: string);
4
- }
5
- /**
6
- * Throw an error when a condition is not met.
7
- */
8
- export declare function assert<_T extends true>(condition: boolean, message?: AssertMessage): undefined | never;
9
- /**
10
- * Given a value, return it if it is not null nor undefined. Otherwise throw an
11
- * error.
12
- *
13
- * @template T
14
- * @returns {NonNullable<T>}
15
- */
16
- export declare function assertExists<T>(t: T, message?: AssertMessage): NonNullable<T>;
17
- /**
18
- * @param {*} n
19
- * @returns string
20
- */
21
- export declare function assertString(n: unknown, message?: AssertMessage): string;
22
- /**
23
- * Compile time assertion that no value will used at this point in control flow.
24
- */
25
- export declare function checkExhaustive(value: never, message?: AssertMessage): never;
26
- export {};
@@ -1 +0,0 @@
1
- export type Awaitable<T> = T | PromiseLike<T>;
package/lib/cjs/case.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function dashCase(identifier: string): string;
@@ -1,8 +0,0 @@
1
- declare const ButtonBar: import("../dom/fc.ts").FCComponentCtor<{
2
- value: T;
3
- values: T[];
4
- events: {
5
- onSelect: (current: T) => void;
6
- };
7
- }, object>;
8
- export default ButtonBar;
@@ -1,12 +0,0 @@
1
- export interface InlineEditState {
2
- mode: number;
3
- value: string;
4
- }
5
- export declare const InlineEdit: import("../dom/fc.ts").FCComponentCtor<{
6
- mode?: number;
7
- value: string;
8
- events: {
9
- change: (value: string) => void;
10
- };
11
- }, InlineEditState>;
12
- export default InlineEdit;
@@ -1,6 +0,0 @@
1
- import { type Logger } from "../log.ts";
2
- export interface HTMLLogger extends Logger {
3
- root: Element;
4
- }
5
- export declare function isHTMLLogger(logger: Logger): logger is HTMLLogger;
6
- export declare function makeHTMLLogger(name: string): HTMLLogger;
@@ -1,10 +0,0 @@
1
- import type { EventHandler } from "../dom/dom.ts";
2
- export declare const Select: import("../dom/fc.ts").FCComponentCtor<{
3
- name: string;
4
- value: string;
5
- events: {
6
- change: EventHandler;
7
- };
8
- disabled: boolean;
9
- options: [string, string][];
10
- }, object>;
@@ -1 +0,0 @@
1
- export declare function loadTests(): Promise<void>;
@@ -1,42 +0,0 @@
1
- export interface VirtualScrollSettings {
2
- minIndex: number;
3
- maxIndex: number;
4
- startIndex: number;
5
- itemHeight: number;
6
- count: number;
7
- tolerance: number;
8
- }
9
- export type VirtualScrollDataAdapter<T> = (offset: number, limit: number) => Iterable<T>;
10
- export declare function arrayAdapter<T>(data: T[]): VirtualScrollDataAdapter<T>;
11
- export interface VirtualScrollProps<T, U extends HTMLElement> {
12
- settings: Partial<VirtualScrollSettings>;
13
- get: VirtualScrollDataAdapter<T>;
14
- row: (t: T) => U;
15
- }
16
- export declare function fillVirtualScrollSettings(settings: Partial<VirtualScrollSettings>): VirtualScrollSettings;
17
- export declare function initialState<T>(settings: VirtualScrollSettings): VirtualScrollState<T>;
18
- export declare function getData<T>(minIndex: number, maxIndex: number, offset: number, limit: number, get: VirtualScrollDataAdapter<T>): T[];
19
- export declare function doScroll<T>(scrollTop: number, state: VirtualScrollState<T>, get: VirtualScrollDataAdapter<T>): {
20
- scrollTop: number;
21
- topPaddingHeight: number;
22
- bottomPaddingHeight: number;
23
- data: T[];
24
- };
25
- interface VirtualScrollState<T, U extends HTMLElement = HTMLElement> {
26
- settings: VirtualScrollSettings;
27
- scrollTop: number;
28
- bufferedItems: number;
29
- totalHeight: number;
30
- viewportHeight: number;
31
- topPaddingHeight: number;
32
- bottomPaddingHeight: number;
33
- toleranceHeight: number;
34
- data: T[];
35
- rows: U[];
36
- }
37
- export interface VirtualScroll<T, U extends HTMLElement> {
38
- state: VirtualScrollState<T>;
39
- rows: U[];
40
- }
41
- export declare const VirtualScroll: import("../dom/fc.ts").FCComponentCtor<VirtualScrollProps<unknown, HTMLElement>, VirtualScrollState<unknown, HTMLElement>>;
42
- export default VirtualScroll;
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { Err, type Result } from "./result.ts";
2
- export declare const Enter: unique symbol;
3
- export declare const Exit: unique symbol;
4
- export interface Context {
5
- [Enter]: () => void;
6
- [Exit]: () => void;
7
- }
8
- export type Operation<T, E extends Error, C extends Context> = (c: C) => T | Result<T, E>;
9
- export type AsyncOperation<T, E extends Error, C extends Context> = (c: C) => Promise<T | Result<T, E>>;
10
- export declare function using<T, E extends Error, C extends Context>(context: C | (() => C) | Operation<T, E, C>, operation?: Operation<T, E, C>, normalizeError?: (e: Error | unknown) => Err<E>): Result<T, E>;
11
- export declare function asyncUsing<T, E extends Error, C extends Context>(context: C | (() => Promise<C>), operation: AsyncOperation<T, E, C>, normalizeError?: (e: E) => Err<E>): Promise<Result<T, E>>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function debounce<T extends unknown[]>(fn: (...args: T) => void, ms?: number): (...args: T) => void;
package/lib/cjs/diff.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export declare const DiffA: unique symbol;
2
- export declare const DiffB: unique symbol;
3
- export type DiffIndex = string | number;
4
- export type DiffPrimitive = string | number | boolean | null | undefined;
5
- interface DiffEntry {
6
- key: DiffIndex;
7
- left: DiffPrimitive;
8
- right: DiffPrimitive;
9
- }
10
- interface DiffList {
11
- key: DiffIndex;
12
- children: (DiffEntry | DiffList)[];
13
- }
14
- export declare function diff<T>(a: Partial<T>, b: Partial<T>): (DiffEntry | DiffList)[];
15
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export type Display = string | {
2
- toString(): string;
3
- };
4
- export declare const isDisplay: (a: unknown) => a is Display;
5
- export declare const display: (a: unknown | Display) => string;
@@ -1,11 +0,0 @@
1
- import type { Properties } from "../types/css.ts";
2
- import type { Side, Size } from "./constants.ts";
3
- export declare function rounded(size?: Size, side?: Side): Properties<0 | (string & {}), string & {}>;
4
- export declare function border({ side, style, radius, width, color, }: {
5
- side?: Side;
6
- style?: "solid" | "dotted" | "dashed" | "double" | "none";
7
- radius?: Size;
8
- width?: 0 | 1 | 2 | 4 | 8;
9
- color?: string;
10
- }): {};
11
- export declare function inset(width: 0 | 1 | 2 | 4 | 8, color1?: string, color2?: string): {};
@@ -1,31 +0,0 @@
1
- export declare const Sizes: {
2
- none: string;
3
- sm: string;
4
- "": string;
5
- md: string;
6
- lg: string;
7
- xl: string;
8
- "2xl": string;
9
- "3xl": string;
10
- full: string;
11
- };
12
- export declare const Sides: {
13
- "": string;
14
- t: string;
15
- r: string;
16
- l: string;
17
- b: string;
18
- tl: string;
19
- tr: string;
20
- bl: string;
21
- br: string;
22
- };
23
- export declare const Widths: {
24
- "1/4": string;
25
- "1/2": string;
26
- "3/4": string;
27
- full: string;
28
- };
29
- export type Size = keyof typeof Sizes;
30
- export type Side = keyof typeof Sides;
31
- export type Width = keyof typeof Widths;
@@ -1,5 +0,0 @@
1
- import { type Side, type Size, Sizes } from "./constants.ts";
2
- export declare function isSide(v: string): v is Side;
3
- export declare function isSize(v: string): v is Size;
4
- export declare function getSize(size: keyof typeof Sizes): string;
5
- export declare function getSide(side: Side): string[];
@@ -1,5 +0,0 @@
1
- import type { Properties } from "../types/css.ts";
2
- export type FStyle = Properties | {
3
- [k: string]: FStyle;
4
- };
5
- export declare function compileFStyle(fstyle: FStyle, prefix?: string): string;
@@ -1,5 +0,0 @@
1
- import { type Width } from "./constants.ts";
2
- export declare function width(amount: Width, block?: "inline"): {
3
- width: string;
4
- display?: string;
5
- };
@@ -1,27 +0,0 @@
1
- import type { Properties } from "./types/css.ts";
2
- declare const Events: unique symbol;
3
- export declare const CLEAR: unique symbol;
4
- export type EventHandler = EventListenerOrEventListenerObject;
5
- export type DenormChildren = Node | string | typeof CLEAR;
6
- export type DOMElement = Element & ElementCSSInlineStyle;
7
- export type DomAttrs = {
8
- class: string | string[];
9
- style: Partial<Properties> | string;
10
- role: "button" | "list" | "listbox";
11
- events: Partial<{
12
- [K in keyof HTMLElementEventMap]: EventHandler | null;
13
- }>;
14
- };
15
- export type Attrs<E extends Omit<Element, "update">, S = object> = Partial<Omit<E, "style"> & S & DomAttrs>;
16
- export type DenormAttrs<E extends Omit<Element, "update">, S = object> = Attrs<E, S> | DenormChildren;
17
- declare global {
18
- interface Element {
19
- [Events]: Map<string, EventHandler>;
20
- update(attrs?: DenormAttrs<Element>, ...children: DenormChildren[]): this;
21
- }
22
- }
23
- export type DOMUpdates<E extends Element = Element> = [DenormAttrs<E>, ...DenormChildren[]] | DenormChildren[];
24
- export declare function normalizeArguments<E extends Element>(attrs?: DenormAttrs<E>, children?: DenormChildren[], defaultAttrs?: Attrs<E>): [Attrs<E>, DenormChildren[]];
25
- export declare function up<E extends Element>(element: Omit<E, "update">, attrs?: DenormAttrs<E>, ...children: DenormChildren[]): E;
26
- export declare function update(element: Omit<Element, "update">, attrs: Attrs<Element>, children: DenormChildren[]): Element;
27
- export {};
@@ -1,10 +0,0 @@
1
- import { type DenormChildren, type DomAttrs } from "./dom.ts";
2
- export type Attrs<S> = S & Partial<DomAttrs>;
3
- export declare const State: unique symbol;
4
- export interface FCComponent<Props extends object, State extends object> extends Element {
5
- [State]?: Partial<State>;
6
- update(attrs?: Partial<Attrs<Props> & DomAttrs> | DenormChildren, ...children: DenormChildren[]): this;
7
- }
8
- export type RenderFn<Props extends object, State extends object> = (el: FCComponent<Props, State>, attrs: Attrs<Props>, children: DenormChildren[]) => Element | Element[];
9
- export type FCComponentCtor<Props extends object, State extends object> = (attrs?: Attrs<Props> | DenormChildren, ...children: DenormChildren[]) => FCComponent<Props, State>;
10
- export declare function FC<Props extends object, State extends object = object>(name: string, component: RenderFn<Props, State>): FCComponentCtor<Props, State>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const App: () => HTMLElement;
@@ -1,25 +0,0 @@
1
- import type { DenormChildren } from "../dom.ts";
2
- import type { FormAttributes, InputAttributes, LabelAttributes, OptionAttributes, SelectAttributes } from "../types/html";
3
- export declare const Form: (attrs: FormAttributes, ...children: DenormChildren[]) => HTMLFormElement;
4
- export declare const Input: (attrs: InputAttributes, ...children: DenormChildren[]) => HTMLLabelElement;
5
- export declare const Select: (attrs: {
6
- options: string[] | object;
7
- selected?: string;
8
- } & SelectAttributes & LabelAttributes) => HTMLLabelElement;
9
- export declare const Button: () => void;
10
- declare const prepareOptions: (attrs: string[] | Record<string, string | {
11
- label: string;
12
- disabled?: boolean;
13
- selected?: boolean;
14
- }>, selected?: string) => Parameters<typeof Option>[0][];
15
- export declare const Option: (attrs: OptionAttributes) => HTMLOptionElement;
16
- export declare const Dropdown: (attrs: SelectAttributes | {
17
- selected?: string;
18
- }, ...options: Parameters<typeof prepareOptions>[0][]) => HTMLLabelElement;
19
- export declare const Radios: () => void;
20
- export declare const Checks: () => void;
21
- export declare const Switches: () => void;
22
- export declare const Radio: (attrs: Omit<InputAttributes, "type">) => HTMLLabelElement;
23
- export declare const Checkbox: (attrs: Omit<InputAttributes, "type">) => HTMLLabelElement;
24
- export declare const Switch: () => HTMLLabelElement;
25
- export {};
File without changes