@realmorg/realm 0.0.19 → 2.0.0-alpha.3

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.
@@ -0,0 +1,60 @@
1
+ import type { CssBindings } from "./css";
2
+ import type { PropType, prop } from "./props";
3
+ export type Handler = (this: Element, event: Event, ...vars: unknown[]) => unknown;
4
+ export interface SetupResult {
5
+ get(name: string): unknown;
6
+ handlers: Handler[];
7
+ }
8
+ export interface StoreOptions {
9
+ persist?: "local" | "session" | StorageAdapter;
10
+ }
11
+ export interface StorageAdapter {
12
+ get(key: string): string | null;
13
+ set(key: string, value: string): void;
14
+ }
15
+ export interface Context {
16
+ defineProps<T extends Record<string, PropType>>(schema: T): Record<keyof T, unknown>;
17
+ useState<T extends object>(initial: T): T;
18
+ useChildren(selector: string, attributes?: string[]): Element[];
19
+ tick(): Promise<void>;
20
+ listen(type: string, handler: (event: Event) => unknown, target?: EventTarget): void;
21
+ defineMethods(methods: object): void;
22
+ dispatch(type: string, detail?: unknown, options?: CustomEventInit): boolean;
23
+ attrs: Record<string, string | null>;
24
+ observe(fn: () => unknown): () => void;
25
+ onConnected(fn: () => unknown): void;
26
+ onDisconnected(fn: () => void): void;
27
+ onFormReset(fn: () => void): void;
28
+ onFormDisabled(fn: (disabled: boolean) => void): void;
29
+ onFormStateRestore(fn: (state: unknown, mode: string) => void): void;
30
+ defineStore<T extends object>(name: string, initial: T, options?: StoreOptions): T;
31
+ /** `report` is set only by generated handler code, for names the script never declared. */
32
+ lookup(name: string, report?: boolean): unknown;
33
+ prop: typeof prop;
34
+ host: HTMLElement;
35
+ refs: Record<string, Element>;
36
+ signal: AbortSignal;
37
+ internals: ElementInternals;
38
+ setTimeout(callback: (...args: unknown[]) => void, delay?: number, ...args: unknown[]): number;
39
+ setInterval(callback: (...args: unknown[]) => void, delay?: number, ...args: unknown[]): number;
40
+ clearTimeout(id?: number): void;
41
+ clearInterval(id?: number): void;
42
+ untrack<T>(fn: () => T): T;
43
+ }
44
+ export type Setup = (context: Context) => SetupResult;
45
+ export interface Definition {
46
+ name: string;
47
+ source: string;
48
+ base: string;
49
+ markup: DocumentFragment;
50
+ sheets: CSSStyleSheet[];
51
+ names: Set<string>;
52
+ handlers: Map<string, number>;
53
+ events: string[];
54
+ formAssociated: boolean;
55
+ role: string | null;
56
+ slot: string | null;
57
+ delegatesFocus: boolean;
58
+ css: CssBindings;
59
+ setup: Setup;
60
+ }
package/package.json CHANGED
@@ -1,40 +1,67 @@
1
1
  {
2
2
  "name": "@realmorg/realm",
3
- "version": "0.0.19",
4
- "description": "Reactive Lightweight Markup Language. HTML framework for building an MVP (Minimum Viable Product) website.",
5
- "main": "dist/index.js",
6
- "keywords": [],
3
+ "version": "2.0.0-alpha.3",
4
+ "description": "Write native web components in plain HTML. No compiler or build step.",
5
+ "type": "module",
6
+ "license": "MIT",
7
7
  "author": {
8
8
  "name": "Ribhararnus Pracutian",
9
9
  "email": "oknoorap@gmail.com"
10
10
  },
11
- "repository": "https://github.com/realmorg/realm",
12
- "homepage": "https://realm.codes",
13
- "license": "MIT",
14
- "devDependencies": {
15
- "@types/node": "^20.1.0",
16
- "cssnano": "^6.0.1",
17
- "postcss-cli": "^10.1.0",
18
- "postcss-header": "^3.0.3",
19
- "terser": "^5.17.6",
20
- "tsup": "^6.7.0",
21
- "typescript": "^5.0.4",
22
- "vitest": "^0.34.2",
23
- "tsconfig": "0.0.0"
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/realmorg/realm.git",
14
+ "directory": "packages/realm"
15
+ },
16
+ "homepage": "https://realm.js.org",
17
+ "keywords": [
18
+ "web-components",
19
+ "custom-elements",
20
+ "html",
21
+ "reactive",
22
+ "no-build"
23
+ ],
24
+ "sideEffects": [
25
+ "./dist/realm.js"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/types/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ },
32
+ "./auto": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "default": "./dist/realm.js"
35
+ },
36
+ "./compiler": {
37
+ "types": "./dist/types/compiler.d.ts",
38
+ "default": "./dist/compiler.js"
39
+ },
40
+ "./realm.css": "./dist/realm.css"
24
41
  },
42
+ "types": "./dist/types/index.d.ts",
25
43
  "files": [
26
44
  "dist"
27
45
  ],
46
+ "devDependencies": {
47
+ "@vitest/browser-playwright": "5.0.5",
48
+ "@vitest/coverage-v8": "5.0.5",
49
+ "playwright": "1.64.1",
50
+ "typescript": "7.0.2",
51
+ "vite": "8.3.4",
52
+ "vitest": "5.0.5",
53
+ "tsconfig": "0.0.0"
54
+ },
28
55
  "publishConfig": {
29
- "registry": "https://registry.npmjs.org",
30
- "access": "public"
56
+ "access": "public",
57
+ "registry": "https://registry.npmjs.org"
31
58
  },
32
59
  "scripts": {
33
- "build": "pnpm build:dev && pnpm build:prod",
34
- "build:prod": "NODE_ENV=production tsup src/index.ts",
35
- "build:dev": "tsup src/index.ts --onSuccess 'pnpm build:css'",
36
- "build:css": "postcss src/index.css > dist/realm.css",
37
- "dev": "pnpm build:dev --watch --dts",
38
- "test": "vitest run"
60
+ "build": "vite build && tsc -p tsconfig.build.json",
61
+ "dev": "vite",
62
+ "test": "vitest run",
63
+ "test:cross": "vitest run --project cross",
64
+ "coverage": "vitest run --project chromium --coverage",
65
+ "typecheck": "tsc --noEmit"
39
66
  }
40
67
  }