@usenagi/core 0.4.0 → 0.4.2

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/README.ja.md CHANGED
@@ -113,7 +113,7 @@ app.component(Analytics, { when: idle() })(el);
113
113
  ### BYO mounter recipe
114
114
 
115
115
  `[data-component]` スキャン、manifest、cue を組み合わせた自動マウントの例。
116
- → [examples/recipes/byo-mounter](./examples/recipes/byo-mounter/main.ts)
116
+ → [examples/recipes/byo-mounter](../../examples/recipes/byo-mounter/main.ts)
117
117
 
118
118
  ---
119
119
 
@@ -175,7 +175,7 @@ setup(el) {
175
175
 
176
176
  `useSlot()` で子コンポーネントをマウントできる。親から子へは `props` または `createContext` / `withContext` で値を渡せる。`addChild()` が返す child context から、子の `setup()` の返り値も参照できる。
177
177
 
178
- → [examples/parent-child](./examples/parent-child/main.ts)
178
+ → [examples/parent-child](../../examples/parent-child/main.ts)
179
179
 
180
180
  ### Observers
181
181
 
@@ -263,11 +263,11 @@ import { visible, idle, interaction, media } from "@usenagi/core/addons/cue";
263
263
 
264
264
  | Example | 説明 |
265
265
  | ----------------------------------------------------- | --------------------------------------------------- |
266
- | [basic-counter](./examples/basic-counter/) | 最小の `signal` + `useWatch` 例 |
267
- | [computed](./examples/computed/) | `useComputed` による派生値(width × height = area) |
268
- | [parent-child](./examples/parent-child/) | `createContext` + `withContext` + `useSlot` |
269
- | [lenis-scroll-scene](./examples/lenis-scroll-scene/) | Lenis + `useComputed` によるスクロール進捗連動 |
270
- | [byo-mounter recipe](./examples/recipes/byo-mounter/) | `[data-component]` スキャン + manifest + cue |
266
+ | [basic-counter](../../examples/basic-counter/) | 最小の `signal` + `useWatch` 例 |
267
+ | [computed](../../examples/computed/) | `useComputed` による派生値(width × height = area) |
268
+ | [parent-child](../../examples/parent-child/) | `createContext` + `withContext` + `useSlot` |
269
+ | [lenis-scroll-scene](../../examples/lenis-scroll-scene/) | Lenis + `useComputed` によるスクロール進捗連動 |
270
+ | [byo-mounter recipe](../../examples/recipes/byo-mounter/) | `[data-component]` スキャン + manifest + cue |
271
271
 
272
272
  ---
273
273
 
package/README.md CHANGED
@@ -113,7 +113,7 @@ With `schedulerAddon()`, `when` is a condition to wait for before `setup()`, and
113
113
  ### BYO mounter recipe
114
114
 
115
115
  An example of automatic mounting by combining `[data-component]` scanning, manifests, and cues.
116
- → [examples/recipes/byo-mounter](./examples/recipes/byo-mounter/main.ts)
116
+ → [examples/recipes/byo-mounter](../../examples/recipes/byo-mounter/main.ts)
117
117
 
118
118
  ---
119
119
 
@@ -175,7 +175,7 @@ Use **`setup(el)`** for the root element and **`useDomRef()`** for `[data-ref]`
175
175
 
176
176
  You can mount child components with `useSlot()`. You can pass values from parent to child via `props` or `createContext` / `withContext`. From the child context returned by `addChild()`, you can also reference the return value of the child's `setup()`.
177
177
 
178
- → [examples/parent-child](./examples/parent-child/main.ts)
178
+ → [examples/parent-child](../../examples/parent-child/main.ts)
179
179
 
180
180
  ### Observers
181
181
 
@@ -263,11 +263,11 @@ import { visible, idle, interaction, media } from "@usenagi/core/addons/cue";
263
263
 
264
264
  | Example | Description |
265
265
  | ----------------------------------------------------- | -------------------------------------------------------- |
266
- | [basic-counter](./examples/basic-counter/) | Minimal `signal` + `useWatch` example |
267
- | [computed](./examples/computed/) | Derived value with `useComputed` (width × height = area) |
268
- | [parent-child](./examples/parent-child/) | `createContext` + `withContext` + `useSlot` |
269
- | [lenis-scroll-scene](./examples/lenis-scroll-scene/) | Scroll-progress animation with Lenis + `useComputed` |
270
- | [byo-mounter recipe](./examples/recipes/byo-mounter/) | `[data-component]` scanning + manifest + cue |
266
+ | [basic-counter](../../examples/basic-counter/) | Minimal `signal` + `useWatch` example |
267
+ | [computed](../../examples/computed/) | Derived value with `useComputed` (width × height = area) |
268
+ | [parent-child](../../examples/parent-child/) | `createContext` + `withContext` + `useSlot` |
269
+ | [lenis-scroll-scene](../../examples/lenis-scroll-scene/) | Scroll-progress animation with Lenis + `useComputed` |
270
+ | [byo-mounter recipe](../../examples/recipes/byo-mounter/) | `[data-component]` scanning + manifest + cue |
271
271
 
272
272
  ---
273
273
 
@@ -1,4 +1,4 @@
1
- //#region lib/addons/cue/index.ts
1
+ //#region ../addons/cue/index.ts
2
2
  function e() {
3
3
  return new DOMException("aborted", "AbortError");
4
4
  }
@@ -3,7 +3,7 @@ function e(e) {
3
3
  return e;
4
4
  }
5
5
  //#endregion
6
- //#region lib/addons/scheduler/_internal/pending.ts
6
+ //#region ../addons/scheduler/_internal/pending.ts
7
7
  function t() {
8
8
  let e = /* @__PURE__ */ new Map();
9
9
  return {
@@ -28,7 +28,7 @@ function t() {
28
28
  };
29
29
  }
30
30
  //#endregion
31
- //#region lib/addons/scheduler/_internal/schedule.ts
31
+ //#region ../addons/scheduler/_internal/schedule.ts
32
32
  function n(e) {
33
33
  return (e instanceof DOMException || e instanceof Error) && e.name === "AbortError";
34
34
  }
@@ -75,7 +75,7 @@ function a(e = {}) {
75
75
  } };
76
76
  }
77
77
  //#endregion
78
- //#region lib/addons/scheduler/index.ts
78
+ //#region ../addons/scheduler/index.ts
79
79
  function o(e) {
80
80
  return (e instanceof DOMException || e instanceof Error) && e.name === "AbortError";
81
81
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usenagi/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Composition-API ergonomics for vanilla DOM. Bring your own mounter.",
5
5
  "main": "./dist/main.umd.js",
6
6
  "module": "./dist/main.es.js",
@@ -23,18 +23,22 @@
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
- "types"
26
+ "types",
27
+ "README.md",
28
+ "README.ja.md",
29
+ "LICENSE"
27
30
  ],
28
31
  "author": "hayakawasho",
29
32
  "license": "MIT",
30
33
  "repository": {
31
34
  "type": "git",
32
- "url": "git+https://github.com/hayakawasho/nagi.git"
35
+ "url": "git+https://github.com/hayakawasho/nagi.git",
36
+ "directory": "packages/core"
33
37
  },
34
38
  "bugs": {
35
39
  "url": "https://github.com/hayakawasho/nagi/issues"
36
40
  },
37
- "homepage": "https://github.com/hayakawasho/nagi#readme",
41
+ "homepage": "https://github.com/hayakawasho/nagi/blob/main/packages/core/README.md",
38
42
  "keywords": [
39
43
  "dom",
40
44
  "component",
@@ -49,22 +53,8 @@
49
53
  "access": "public"
50
54
  },
51
55
  "scripts": {
52
- "build": "NODE_ENV=production tsc && vite build && vite build --config vite.addons.config.ts",
53
- "watch": "vite build -w",
54
- "test": "vitest run",
55
- "test:watch": "vitest",
56
- "lint": "oxlint ./lib",
57
- "format": "biome format --write ./lib",
58
- "fix:biome": "biome check --write ./lib",
59
- "fix": "npm run fix:biome"
60
- },
61
- "devDependencies": {
62
- "@biomejs/biome": "^2.4.13",
63
- "happy-dom": "^20.9.0",
64
- "oxlint": "^1.66.0",
65
- "typescript": "^6.0.3",
66
- "vite": "^8.0.14",
67
- "vitest": "^4.1.7"
56
+ "build": "NODE_ENV=production tsc && tsc -p ../addons/tsconfig.json && vite build && vite build --config vite.addons.config.ts",
57
+ "watch": "vite build -w"
68
58
  },
69
59
  "type": "module",
70
60
  "sideEffects": false
@@ -1,4 +1,4 @@
1
- import type { Cue } from "../../types";
1
+ import type { Cue } from "@usenagi/core";
2
2
  export declare function visible(opts?: IntersectionObserverInit): Cue;
3
3
  export declare function idle(timeout?: number): Cue;
4
4
  export declare function media(query: string): Cue;
@@ -1,4 +1,4 @@
1
- import type { RefElement } from "../../../types";
1
+ import type { RefElement } from "@usenagi/core";
2
2
  type PendingMounts = {
3
3
  add(el: RefElement): {
4
4
  readonly signal: AbortSignal;
@@ -1,4 +1,4 @@
1
- import type { SchedulePriority } from "../../../types";
1
+ import type { SchedulePriority } from "@usenagi/core";
2
2
  type Scheduler = {
3
3
  schedule(task: () => void, options?: {
4
4
  priority?: SchedulePriority;
@@ -1,5 +1,5 @@
1
- import type { Cue, SchedulePriority } from "../../types";
2
- declare module "../../core/addon" {
1
+ import type { Cue, SchedulePriority } from "@usenagi/core";
2
+ declare module "@usenagi/core" {
3
3
  interface MountOptions {
4
4
  priority?: SchedulePriority;
5
5
  when?: Cue;
@@ -7,4 +7,4 @@ declare module "../../core/addon" {
7
7
  }
8
8
  export declare function schedulerAddon(opts?: {
9
9
  priority?: SchedulePriority;
10
- }): import("../../main").Addon;
10
+ }): import("@usenagi/core").Addon;