@riebeckite/plugin-ux 0.0.21 → 0.0.23
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 +4 -6
- package/README_ja.md +4 -6
- package/dist/index.js +4 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-ux
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/ux.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
Client-side progressive enhancements for reading. The plugin leaves the built
|
|
4
6
|
article HTML untouched and adds a reading progress bar, a back-to-top button,
|
|
5
7
|
table-of-contents scroll-spy, and code copy buttons at runtime.
|
|
@@ -60,11 +62,7 @@ The factory is also exported as `ux`.
|
|
|
60
62
|
## How configuration reaches the client
|
|
61
63
|
|
|
62
64
|
Client initializers are bundled statically and cannot receive plugin options.
|
|
63
|
-
At build time the plugin prepends an inert JSON element to each article HTML
|
|
64
|
-
|
|
65
|
-
```html
|
|
66
|
-
<script type="application/json" id="rb-ux-config" data-rb-ux-config>{...}</script>
|
|
67
|
-
```
|
|
65
|
+
At build time the plugin prepends an inert JSON configuration element to each article HTML. It is implementation data and is not displayed in article content.
|
|
68
66
|
|
|
69
67
|
`initUx()` reads that element to restore the options; when it is missing, every
|
|
70
68
|
feature falls back to its enabled default. Injection happens in
|
|
@@ -116,4 +114,4 @@ Styles ship as `@riebeckite/plugin-ux/style.css` and use the theme's
|
|
|
116
114
|
|
|
117
115
|
## See also
|
|
118
116
|
|
|
119
|
-
- [Plugin guide](
|
|
117
|
+
- [Plugin guide](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.md)
|
package/README_ja.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @riebeckite/plugin-ux
|
|
2
2
|
|
|
3
|
+
<!-- Generated from docs/docs/plugins/ux.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
|
+
|
|
3
5
|
記事の読みやすさを高めるクライアント側のプログレッシブ・エンハンスメントをまとめたプラグインです。ビルド後の記事 HTML はそのままに、読み進捗バー・トップへ戻るボタン・目次のスクロール連動ハイライト・コードのコピーボタンを追加します。
|
|
4
6
|
|
|
5
7
|
[English](./README.md)
|
|
@@ -51,11 +53,7 @@ export default defineConfig({
|
|
|
51
53
|
|
|
52
54
|
## 設定がクライアントへ渡る仕組み
|
|
53
55
|
|
|
54
|
-
クライアント側の初期化コードは静的にバンドルされ、プラグインのオプションを直接受け取れません。そのためこのプラグインは、ビルド時に各記事 HTML
|
|
55
|
-
|
|
56
|
-
```html
|
|
57
|
-
<script type="application/json" id="rb-ux-config" data-rb-ux-config>{...}</script>
|
|
58
|
-
```
|
|
56
|
+
クライアント側の初期化コードは静的にバンドルされ、プラグインのオプションを直接受け取れません。そのためこのプラグインは、ビルド時に各記事 HTML の先頭へ不活性な JSON 設定要素を挿入します。これは実装用のデータであり、記事本文には表示しません。
|
|
59
57
|
|
|
60
58
|
`initUx()` はこの要素を読み取って設定を復元します。要素が無い場合は全機能が有効な既定値で動作します。挿入は `onPostProcessed` で行い、`onManifestCreated` でも未挿入の記事エントリへ反映します。挿入はページごとに一度だけで、`data-rb-ux-config` を目印に重複挿入を防ぎます。
|
|
61
59
|
|
|
@@ -97,4 +95,4 @@ export default defineConfig({
|
|
|
97
95
|
|
|
98
96
|
## 関連資料
|
|
99
97
|
|
|
100
|
-
- [プラグインシステム](
|
|
98
|
+
- [プラグインシステム](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.ja.md)
|
package/dist/index.js
CHANGED
|
@@ -62,8 +62,10 @@ function uxPlugin(options = {}) {
|
|
|
62
62
|
},
|
|
63
63
|
options,
|
|
64
64
|
validateOptions: validateUxOptions,
|
|
65
|
-
assets: [createStyleAsset("ux")],
|
|
66
|
-
clientEntries: [
|
|
65
|
+
assets: [createStyleAsset("ux", "@riebeckite/plugin-ux/style.css")],
|
|
66
|
+
clientEntries: [
|
|
67
|
+
createClientEntry("ux", "@riebeckite/plugin-ux/client", "initUx")
|
|
68
|
+
],
|
|
67
69
|
onPostProcessed: (context) => {
|
|
68
70
|
context.content.html = injectUxConfig(context.content.html, config);
|
|
69
71
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-ux",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
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.
|
|
24
|
+
"@riebeckite/core": "0.0.23"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|