@wcstack/worker 1.15.0 → 1.16.0

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 (3) hide show
  1. package/README.ja.md +11 -0
  2. package/README.md +11 -0
  3. package/package.json +1 -1
package/README.ja.md CHANGED
@@ -123,6 +123,17 @@ npm install @wcstack/worker
123
123
 
124
124
  DOM トリガは**常に文字列を post します** — リテラルの `data-worker-text`、または解決された要素の `value` / `textContent`。これは単純なテキストペイロードのための利便機能であり、意図的に値のパース・型変換・構造化を行いません。structured clone データ(オブジェクト、typed array、transferable)を送るには、command-token プロトコル(`command.post: $command.run`)経由で `post` を起動するか、命令的に `element.post(data, transfer?)` を呼んでください。
125
125
 
126
+ > **autoTrigger は既定で有効。** 最初に接続した `<wcs-worker>` が document レベルの `click` リスナーを 1 つ設置します(`data-worker-target` 要素のクリックで参照先 worker に post し、`event.preventDefault()` を呼ぶ)。DOM ショートカットを使わないなら bootstrap エントリで無効化してください:
127
+ >
128
+ > ```js
129
+ > import { bootstrapWorker, getConfig } from "@wcstack/worker";
130
+ > bootstrapWorker({ autoTrigger: false }); // document クリックリスナーを設置しない
131
+ > bootstrapWorker({ triggerAttribute: "data-run" }); // トリガ属性名を変更(既定: data-worker-target)
132
+ > getConfig(); // 実効設定(deep-frozen)を読む
133
+ > ```
134
+ >
135
+ > `bootstrapWorker()` は要素が接続される前に呼んでください。(`setConfig` は内部用。設定は `bootstrapWorker` 経由で行います。)
136
+
126
137
  ## 観測可能なプロパティ(出力)
127
138
 
128
139
  | プロパティ | イベント | 説明 |
package/README.md CHANGED
@@ -123,6 +123,17 @@ The duality in one element: `post` is wired from a command-token, and an incomin
123
123
 
124
124
  The DOM trigger **always posts a string** — the literal `data-worker-text`, or the resolved element's `value` / `textContent`. It is a convenience for simple text payloads and intentionally does not parse, coerce, or structure the value. To send structured-clone data (objects, typed arrays, transferables), drive `post` via the command-token protocol (`command.post: $command.run`) or call `element.post(data, transfer?)` imperatively.
125
125
 
126
+ > **autoTrigger is on by default.** The first `<wcs-worker>` to connect installs a single **document-level `click` listener** (a click on a `data-worker-target` element posts to the referenced worker, calling `event.preventDefault()`). If you don't use the DOM shortcut, opt out via the bootstrap entry:
127
+ >
128
+ > ```js
129
+ > import { bootstrapWorker, getConfig } from "@wcstack/worker";
130
+ > bootstrapWorker({ autoTrigger: false }); // no document click listener
131
+ > bootstrapWorker({ triggerAttribute: "data-run" }); // rename the trigger attribute (default: data-worker-target)
132
+ > getConfig(); // read the effective (deep-frozen) config
133
+ > ```
134
+ >
135
+ > Call `bootstrapWorker()` before the elements connect. (`setConfig` is internal; configure through `bootstrapWorker`.)
136
+
126
137
  ## Observable Properties (outputs)
127
138
 
128
139
  | Property | Event | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wcstack/worker",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Declarative Web Worker component for Web Components. Framework-agnostic Dedicated Worker primitive via wc-bindable-protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.esm.js",