@riebeckite/plugin-lightbox 0.0.31 → 0.0.33

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.md CHANGED
@@ -17,17 +17,23 @@ Two parts:
17
17
 
18
18
  ```ts
19
19
  import { defineConfig } from "@riebeckite/core";
20
- import { lightboxPlugin } from "@riebeckite/plugin-lightbox";
20
+ import { lightbox } from "@riebeckite/plugin-lightbox";
21
21
 
22
22
  export default defineConfig({
23
23
  // ...
24
- plugins: [lightboxPlugin()],
24
+ plugins: [lightbox()],
25
25
  });
26
26
  ```
27
27
 
28
28
  The plugin registers `style.css` and a client entry (`initLightbox`), which
29
29
  the app calls on page initialization.
30
30
 
31
+ ## Live example
32
+
33
+ Click the image to open the lightbox.
34
+
35
+ ![riebeckite-logo.png](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/riebeckite-logo.png.md)
36
+
31
37
  ## Behavior
32
38
 
33
39
  ### Build (`rehypeLightbox`)
@@ -70,7 +76,7 @@ to style the displayed image without selecting its descendants.
70
76
 
71
77
  ## Exports
72
78
 
73
- - `lightboxPlugin(options?)` — plugin factory
79
+ - `lightbox(options?)` — plugin factory
74
80
  - `rehypeLightbox(options?)` — rehype transform
75
81
  - `initLightbox(root?, options?)` — client initializer, returns a cleanup
76
82
  function
package/README_ja.md CHANGED
@@ -8,18 +8,24 @@
8
8
 
9
9
  ## 仕組み
10
10
 
11
- ビルド時の Rehype 変換と、ブラウザ側の初期化処理で動きます。変換では画像をトリガーリンクで囲み、初期化処理ではアクセシブルなダイアログを用意します。
11
+ ビルド時の Rehype 変換と、ブラウザ側の初期化処理の 2 つで構成されます。変換では画像をトリガーリンクで囲み、初期化処理ではアクセシブルなダイアログを用意します。
12
12
 
13
13
  ```ts
14
14
  import { defineConfig } from "@riebeckite/core";
15
- import { lightboxPlugin } from "@riebeckite/plugin-lightbox";
15
+ import { lightbox } from "@riebeckite/plugin-lightbox";
16
16
 
17
17
  export default defineConfig({
18
18
  // ...
19
- plugins: [lightboxPlugin()],
19
+ plugins: [lightbox()],
20
20
  });
21
21
  ```
22
22
 
23
+ ## 実行例
24
+
25
+ 画像をクリックすると lightbox が開きます。
26
+
27
+ ![riebeckite-logo.png](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/riebeckite-logo.png.ja.md)
28
+
23
29
  ## 利用時の挙動
24
30
 
25
31
  - `rehypeLightbox` は各 `<img>` を `.rr-lightbox-trigger` で囲みます。
@@ -27,8 +33,7 @@ export default defineConfig({
27
33
  - `initLightbox` は `Escape`、背景クリック、閉じるボタンでダイアログを閉じ、開く前のフォーカスを戻します。
28
34
  - 開いている間は `html[data-lightbox-open="true"]` を設定するため、CSS でスクロールを止められます。
29
35
 
30
- Theme は `rr-lightbox` の root に `--rr-lightbox-image-border-radius` を指定すると、
31
- 子要素を選択せずに表示中の画像を調整できます。
36
+ テーマ側では、`rr-lightbox` のルート要素に `--rr-lightbox-image-border-radius` を指定すると、子要素を選択せずに表示中の画像を調整できます。
32
37
 
33
38
  ## オプション
34
39
 
@@ -37,16 +42,16 @@ Theme は `rr-lightbox` の root に `--rr-lightbox-image-border-radius` を指
37
42
  | `selectorClass` | `string` | `"rr-lightbox-trigger"` | トリガーに使う CSS クラス |
38
43
  | `expandLabel` | `string` | `"Expand image"` | トリガーとダイアログのアクセシブルラベル |
39
44
  | `closeLabel` | `string` | `"Close"` | 閉じるボタンのアクセシブルラベル |
40
- | `autoWrapImages` | `boolean` | `true` | 初期化時に未処理の画像も囲むか。クライアント側だけの設定 |
45
+ | `autoWrapImages` | `boolean` | `true` | 初期化時に未処理の画像も囲むか。クライアント側でのみ有効 |
41
46
 
42
- `initLightbox()` はイベントリスナー、ダイアログ、追加したトリガーを解除する cleanup 関数を返します。
47
+ `initLightbox()` はイベントリスナー、ダイアログ、追加したトリガーを片付けるクリーンアップ関数を返します。
43
48
 
44
49
  ## 公開 API
45
50
 
46
- - `lightboxPlugin(options?)`:プラグインファクトリ
51
+ - `lightbox(options?)`:プラグインファクトリ
47
52
  - `rehypeLightbox(options?)`:Rehype 変換
48
53
  - `initLightbox(root?, options?)`:ブラウザ初期化関数
49
- - `initLightboxFromOptions(options?)`:プラグインのクライアントスクリプトが呼ぶ、オプションを先に取る初期化関数
54
+ - `initLightboxFromOptions(options?)`:プラグインのクライアントスクリプトが呼ぶ初期化関数。オプションを第 1 引数に取る
50
55
  - `LightboxOptions`、`LightboxInitOptions`:型
51
56
 
52
57
  ## 関連資料
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { initLightboxFromOptions } from "./client.js";
3
3
  export { initLightbox } from "./src/init.js";
4
4
  export { rehypeLightbox } from "./src/rehype.js";
5
5
  export type { LightboxInitOptions, LightboxOptions } from "./src/types.js";
6
- export declare function lightboxPlugin(options?: LightboxOptions): import("@riebeckite/core").RiebeckitePlugin<LightboxOptions>;
6
+ export declare function lightbox(options?: LightboxOptions): import("@riebeckite/core").RiebeckitePlugin<LightboxOptions>;
package/dist/index.js CHANGED
@@ -250,7 +250,7 @@ function initLightboxFromOptions(options = {}) {
250
250
  }
251
251
 
252
252
  // index.ts
253
- function lightboxPlugin(options = {}) {
253
+ function lightbox(options = {}) {
254
254
  return definePlugin({
255
255
  name: "lightbox",
256
256
  processedContentCache: {
@@ -280,6 +280,6 @@ function lightboxPlugin(options = {}) {
280
280
  export {
281
281
  initLightbox,
282
282
  initLightboxFromOptions,
283
- lightboxPlugin,
283
+ lightbox,
284
284
  rehypeLightbox
285
285
  };
@@ -1,5 +1,4 @@
1
1
  import type { ElementNode, HastNode } from "./types.js";
2
2
  export declare function visitElements(node: HastNode, visitor: (node: ElementNode, parent?: ElementNode, index?: number) => void, parent?: ElementNode, index?: number): void;
3
- export declare function isElementNode(node: HastNode): node is ElementNode;
4
3
  export declare function getStringProperty(node: ElementNode, key: string): string | null;
5
4
  export declare function mergeClassName(current: string | null, next: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-lightbox",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "./style.css": "./style.css"
22
22
  },
23
23
  "dependencies": {
24
- "@riebeckite/core": "0.0.31"
24
+ "@riebeckite/core": "0.0.33"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"