@riebeckite/plugin-bases 0.0.32 → 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 +13 -1
- package/README_ja.md +42 -30
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -3
- package/dist/src/expression.d.ts +2 -1
- package/dist/src/page.d.ts +2 -1
- package/dist/src/placeholder.d.ts +2 -2
- package/dist/src/remark.d.ts +2 -1
- package/dist/src/runtime.d.ts +2 -1
- package/package.json +5 -4
- package/style.css +0 -16
package/README.md
CHANGED
|
@@ -58,6 +58,18 @@ The same YAML may be placed in a fenced `base` block or in a `.base` file.
|
|
|
58
58
|
Top-level and view-local `filters` are combined with AND. Table and cards are
|
|
59
59
|
rendered at build time; all dynamic values are escaped before HTML output.
|
|
60
60
|
|
|
61
|
+
## Live example
|
|
62
|
+
|
|
63
|
+
~~~base
|
|
64
|
+
properties:
|
|
65
|
+
file.name:
|
|
66
|
+
displayName: Title
|
|
67
|
+
views:
|
|
68
|
+
- type: table
|
|
69
|
+
name: Pages
|
|
70
|
+
limit: 5
|
|
71
|
+
~~~
|
|
72
|
+
|
|
61
73
|
## Official syntax audit
|
|
62
74
|
|
|
63
75
|
This implementation follows the documented YAML shape in the [Obsidian Bases
|
|
@@ -161,6 +173,6 @@ the static, no-JavaScript output model.
|
|
|
161
173
|
## Options and exports
|
|
162
174
|
|
|
163
175
|
`className`, `language`, `limit`, `showFallback`, and `view` retain their existing
|
|
164
|
-
meanings. The package exports `bases`, `
|
|
176
|
+
meanings. The package exports `bases`, `bases`, `remarkBases`, `parseBases`,
|
|
165
177
|
`parseBasesExpression`, `analyzeBasesDependencies`, `evaluateBasesExpression`, `matchesCondition`, and the
|
|
166
178
|
public Bases types.
|
package/README_ja.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- Generated from docs/docs/plugins/bases.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
|
|
4
4
|
|
|
5
|
-
Obsidian Bases の互換サブセットをビルド時に描画します。`bases()`
|
|
5
|
+
Obsidian Bases の互換サブセットをビルド時に描画します。`bases()` はフェンス付き
|
|
6
6
|
`base` ブロックと、参照された `.base` ドキュメントを扱います。クライアント側の
|
|
7
7
|
評価器は含みません。
|
|
8
8
|
|
|
@@ -54,11 +54,23 @@ views:
|
|
|
54
54
|
order: [file.name, formula.label]
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
同じ YAML
|
|
58
|
-
レベルとビューごとの `filters` は AND
|
|
57
|
+
同じ YAML をフェンス付き `base` ブロックまたは `.base` ファイルに書けます。トップ
|
|
58
|
+
レベルとビューごとの `filters` は AND で結合します。表とカードはビルド時に
|
|
59
59
|
描画し、HTML に出す動的な値はすべてエスケープします。
|
|
60
60
|
|
|
61
|
-
##
|
|
61
|
+
## 実行例
|
|
62
|
+
|
|
63
|
+
~~~base
|
|
64
|
+
properties:
|
|
65
|
+
file.name:
|
|
66
|
+
displayName: Title
|
|
67
|
+
views:
|
|
68
|
+
- type: table
|
|
69
|
+
name: Pages
|
|
70
|
+
limit: 5
|
|
71
|
+
~~~
|
|
72
|
+
|
|
73
|
+
## 公式構文への対応
|
|
62
74
|
|
|
63
75
|
Obsidian の [Bases 構文](https://help.obsidian.md/bases/syntax) と
|
|
64
76
|
[ビュー](https://help.obsidian.md/bases/views) の YAML 形式を確認し、決定的な静的出力に
|
|
@@ -66,13 +78,13 @@ Obsidian の [Bases 構文](https://help.obsidian.md/bases/syntax) と
|
|
|
66
78
|
|
|
67
79
|
| 構文またはビュー機能 | 状態 | 静的出力での扱い |
|
|
68
80
|
| --- | --- | --- |
|
|
69
|
-
| ルートの `filters`、`formulas`、`properties`、`summaries`、`views` | 対応 | 再帰的な `and`/`or`/`not`
|
|
81
|
+
| ルートの `filters`、`formulas`、`properties`、`summaries`、`views` | 対応 | 再帰的な `and`/`or`/`not` フィルタと `displayName` を受け付けます。 |
|
|
70
82
|
| ビューの `type`、`name`、`limit`、`filters`、`order`、`sort`、`groupBy`、`groupOrder`、`summaries` | 対応 | `groupOrder` は排他的です。空リストはすべてのグループを隠し、存在しない値を列挙すると空グループを作ります。 |
|
|
71
|
-
|
|
|
72
|
-
|
|
|
83
|
+
| 表とカードのレイアウト | 対応 | 実行時の評価器を持たないセマンティック HTML を生成します。 |
|
|
84
|
+
| list、kanban、map のレイアウト | 未対応 | 対話的・空間的な動作はこの静的レンダラーでは表現できません。 |
|
|
73
85
|
| 編集、プロパティメニュー、列幅変更、ドラッグ&ドロップ、折りたたみ操作 | 対象外 | Bases はサイトのビルド時に描画します。 |
|
|
74
86
|
|
|
75
|
-
## 式と Formula
|
|
87
|
+
## 式と Formula の対応範囲
|
|
76
88
|
|
|
77
89
|
式は AST に構文解析して直接評価します。`eval`、`Function`、任意の JavaScript 実行は
|
|
78
90
|
使いません。リテラル、配列、ネストしたメンバー・インデックス参照、`!`、単項 `-`、
|
|
@@ -92,42 +104,42 @@ Formula の循環参照は空の値になります。
|
|
|
92
104
|
既存の Date だけを受け付けます。日付フィールドとフォーマットは UTC を使うため、静的
|
|
93
105
|
ビルドでホストのロケールや曖昧な日付構文に依存しません。
|
|
94
106
|
|
|
95
|
-
Formula の評価は、1回につき AST の 10,000 ステップとネストした式の 128 段階までです。
|
|
107
|
+
Formula の評価は、1 回につき AST の 10,000 ステップとネストした式の 128 段階までです。
|
|
96
108
|
いずれかを超えると決定的に停止し、`bases-invalid` 診断を出して Base のエラー表示に
|
|
97
|
-
|
|
109
|
+
切り替えます。大きな高階の式や深い式で静的ビルドの処理が無制限に続くことを防ぎ、
|
|
98
110
|
JavaScript のコールバックは実行しません。
|
|
99
111
|
|
|
100
112
|
## ファイルメタデータ
|
|
101
113
|
|
|
102
114
|
`file.size` はソースファイルのバイト数です。`file.mtime` と `file.ctime` は
|
|
103
|
-
ファイルシステムから得る UTC の `Date`
|
|
104
|
-
|
|
115
|
+
ファイルシステムから得る UTC の `Date` 値で、プロパティ、フィルタ、Formula、ソート、
|
|
116
|
+
グループ、集計、高階の式で使えます。ソースのメタデータが欠落または不正な場合は、描画後の
|
|
105
117
|
Markdown やビルド時刻から補わず、空の値として扱います。日付どうしの減算はミリ秒になり、
|
|
106
118
|
`"7 days"` のような duration による Date の加減算もできます。
|
|
107
119
|
|
|
108
120
|
ファイルシステムのコンテンツでは、`file.ctime` に Node の `birthtime` を使います。
|
|
109
|
-
|
|
121
|
+
状態変更時刻である `stat.ctime` は使いません。Windows では通常、作成時刻を取得
|
|
110
122
|
できます。Linux のファイルシステムは作成時刻を持たないことがあり、Node が
|
|
111
123
|
ファイルシステム依存の代替値を返すか、利用できる値がない場合があります。移植性が必要な
|
|
112
124
|
Base では空の `file.ctime` を扱ってください。キャッシュした時刻は UTC の瞬間を保ちます。
|
|
113
125
|
|
|
114
126
|
## 増分ビルド
|
|
115
127
|
|
|
116
|
-
Bases
|
|
117
|
-
Inventory
|
|
128
|
+
Bases は、フィルタ、Formula、列、ソート、グループ、集計が読むプロパティを永続 Output
|
|
129
|
+
Inventory に記録します。これはフェンス付き Base と参照された各 `.base` ドキュメントに個別に適用されます。
|
|
118
130
|
これらのプロパティ、参照するファイルメタデータ、または公開候補集合が変わった場合だけ、その値を読む Base 出力を
|
|
119
|
-
|
|
131
|
+
再生成します。フィルタに一致しない状態から一致する状態への変更も検出します。本文だけの編集と無関係な frontmatter 編集では Base 出力を
|
|
120
132
|
再利用します。
|
|
121
133
|
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
Formula の循環、動的なプロパティ参照など、静的に証明できない依存関係では Base 単位で保守的に再生成します。
|
|
135
|
+
不明な依存関係を依存なしとして扱うことはありません。下書き、スケジュール公開、unlisted のエントリは Base の行から除外され、
|
|
124
136
|
キャッシュ出力からも公開されません。
|
|
125
137
|
|
|
126
138
|
## 静的ビューのアクセシビリティ
|
|
127
139
|
|
|
128
|
-
|
|
140
|
+
表は列と行グループの見出しを維持し、画面読み上げ用の件数を持ちます。狭い画面では
|
|
129
141
|
キーボードでフォーカスできる横スクロール領域に収めます。グループ名には行数を示し、
|
|
130
|
-
`groupOrder`
|
|
142
|
+
`groupOrder` にあるが一致する行がない値は空グループとして明示します。カードのグループは
|
|
131
143
|
ラベル付きリストとし、集計値には画面読み上げ用の列名を加えます。いずれも JavaScript を
|
|
132
144
|
使わない静的出力のままです。
|
|
133
145
|
|
|
@@ -136,24 +148,24 @@ Table は列と行グループの見出しを維持し、画面読み上げ用
|
|
|
136
148
|
| Obsidian Base の機能 | 状態 | 備考 |
|
|
137
149
|
| --- | --- | --- |
|
|
138
150
|
| YAML ルート、`filters`、`properties`、`formulas`、`summaries`、`views` | 対応 | YAML または仕様が不正な場合は診断を出します。 |
|
|
139
|
-
|
|
|
140
|
-
| AST
|
|
151
|
+
| 表とカード | 対応 | ほかのビュー種別は描画しません。 |
|
|
152
|
+
| AST のフィルタと Formula | 一部対応 | 対応関数は上記のとおりです。 |
|
|
141
153
|
| Formula によるソートと複数の安定ソートキー | 対応 | 空の値は末尾に並びます。 |
|
|
142
|
-
| `groupBy` と `groupOrder` | 対応 | Formula
|
|
143
|
-
|
|
|
144
|
-
|
|
|
154
|
+
| `groupBy` と `groupOrder` | 対応 | Formula プロパティ、順序付きの空グループ、表、カードに対応します。対話的な折りたたみは対象外です。 |
|
|
155
|
+
| 表の集計 | 一部対応 | 名前付き集計、Empty、Filled、Unique、Checked、Unchecked、数値、日付の集計を使えます。 |
|
|
156
|
+
| カードの集計 | 対象外 | Obsidian は集計をカードではなく表に表示します。 |
|
|
145
157
|
| `file.name`、`file.path`、`file.ext`、`file.folder`、`file.tags`、`file.links`、`file.properties`、`file.link` | 一部対応 | Markdown マニフェストから導出します。name/path は `.md` のソース規則を使います。 |
|
|
146
158
|
| `file.size`、`file.mtime`、`file.ctime` | 対応 | バイト数、ファイルシステムの更新時刻、作成時刻相当を使います。Linux では `ctime` が利用できないことがあります。`stat.ctime`、frontmatter、ビルド時刻へは置き換えません。 |
|
|
147
|
-
| Backlinks
|
|
159
|
+
| Backlinks、埋め込み | 未対応 | これらの値は空になります。 |
|
|
148
160
|
| リストの `map`、`filter`、`reduce` | 一部対応 | `value`、`index`、`acc` スコープの式を使い、リスト長には上限があります。 |
|
|
149
|
-
|
|
|
150
|
-
| 増分依存追跡 | 対応 |
|
|
151
|
-
| 正規表現、オブジェクトリテラル、`file()
|
|
161
|
+
| 決定的なユーティリティ、オブジェクト、日付、ファイルプロパティの関数 | 一部対応 | UTC 日付、`duration`、コレクション/オブジェクトのヘルパー、`file.hasProperty` を使えます。Vault API や描画済みリンクを必要とする関数は使えません。 |
|
|
162
|
+
| 増分依存追跡 | 対応 | フィルタ候補集合と AST から得たプロパティ依存を追跡し、動的・循環 Formula は Base 単位でフォールバックします。 |
|
|
163
|
+
| 正規表現、オブジェクトリテラル、`file()`、リンク・画像・アイコン・HTML の描画、`now`、`today`、`random`、相対日付 | 未対応 | JavaScript を実行せず、ビルド時刻に依存せず、安全でない URL を出力しません。 |
|
|
152
164
|
| 編集、グループの折りたたみなどの対話的なビュー操作 | 対象外 | Riebeckite は静的なビルド出力を描画します。 |
|
|
153
165
|
|
|
154
166
|
## オプションとエクスポート
|
|
155
167
|
|
|
156
168
|
`className`、`language`、`limit`、`showFallback`、`view` の意味は従来どおりです。
|
|
157
|
-
パッケージは `bases`、`
|
|
169
|
+
パッケージは `bases`、`bases`、`remarkBases`、`parseBases`、
|
|
158
170
|
`parseBasesExpression`、`analyzeBasesDependencies`、`evaluateBasesExpression`、`matchesCondition`、公開 Bases 型を
|
|
159
171
|
エクスポートします。
|
package/dist/index.d.ts
CHANGED
|
@@ -14,5 +14,3 @@ export type { BasesBuiltinValue, BasesCondition, BasesExpression, BasesGroupBy,
|
|
|
14
14
|
* build time, so no client-side JavaScript is required.
|
|
15
15
|
*/
|
|
16
16
|
export declare function bases(options?: BasesOptions): import("@riebeckite/core").RiebeckitePlugin<BasesOptions>;
|
|
17
|
-
/** Alias kept for symmetry with other plugin factories. */
|
|
18
|
-
export declare const basesPlugin: typeof bases;
|
package/dist/index.js
CHANGED
|
@@ -1897,7 +1897,7 @@ function renderEmpty(className) {
|
|
|
1897
1897
|
return `<p class="${escapeHtmlAttribute(className)}__empty">No matching notes.</p>`;
|
|
1898
1898
|
}
|
|
1899
1899
|
function renderFallback(className, source) {
|
|
1900
|
-
return `<details class="${escapeHtmlAttribute(className)}__fallback"><summary>Base definition</summary><pre><code>${escapeHtml2(source)}</code></pre></details>`;
|
|
1900
|
+
return `<details class="${escapeHtmlAttribute(className)}__fallback rb-source-fallback"><summary>Base definition</summary><pre><code>${escapeHtml2(source)}</code></pre></details>`;
|
|
1901
1901
|
}
|
|
1902
1902
|
function renderCell(entry, property, className, spec) {
|
|
1903
1903
|
const key = property.toLowerCase();
|
|
@@ -2272,7 +2272,6 @@ function bases(options = {}) {
|
|
|
2272
2272
|
assets: [createStyleAsset("bases", "@riebeckite/plugin-bases/style.css")]
|
|
2273
2273
|
});
|
|
2274
2274
|
}
|
|
2275
|
-
var basesPlugin = bases;
|
|
2276
2275
|
function validateBasesOptions(options) {
|
|
2277
2276
|
if (!options) return [];
|
|
2278
2277
|
const issues = [];
|
|
@@ -2300,7 +2299,6 @@ export {
|
|
|
2300
2299
|
BasesEvaluationError,
|
|
2301
2300
|
analyzeBasesDependencies,
|
|
2302
2301
|
bases,
|
|
2303
|
-
basesPlugin,
|
|
2304
2302
|
evaluateBasesExpression,
|
|
2305
2303
|
groupBasesEntries,
|
|
2306
2304
|
matchesCondition,
|
package/dist/src/expression.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BasesExpression } from "./types.js";
|
|
2
|
-
|
|
2
|
+
type ExpressionResult = {
|
|
3
3
|
readonly ok: true;
|
|
4
4
|
readonly value: BasesExpression;
|
|
5
5
|
} | {
|
|
@@ -7,3 +7,4 @@ export type ExpressionResult = {
|
|
|
7
7
|
readonly message: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function parseBasesExpression(source: string): ExpressionResult;
|
|
10
|
+
export {};
|
package/dist/src/page.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ContentManifest, type ContentSource, type Diagnostic, type PluginPage } from "@riebeckite/core";
|
|
2
2
|
import type { BasesOptions } from "./types.js";
|
|
3
|
-
|
|
3
|
+
type BaseDocument = {
|
|
4
4
|
readonly pathname: string;
|
|
5
5
|
readonly dependencies: readonly import("@riebeckite/core").OutputDependency[];
|
|
6
6
|
};
|
|
@@ -15,3 +15,4 @@ export declare function resolveBaseDocument(input: {
|
|
|
15
15
|
readonly pathname: string;
|
|
16
16
|
readonly diagnostics: Diagnostic[];
|
|
17
17
|
}, options: BasesOptions): Promise<PluginPage | null>;
|
|
18
|
+
export {};
|
|
@@ -10,12 +10,12 @@ import type { BasesSpec } from "./types.js";
|
|
|
10
10
|
* HTML, so it never reaches the published page.
|
|
11
11
|
*/
|
|
12
12
|
export declare const BASES_ATTRIBUTE = "data-rr-bases";
|
|
13
|
-
|
|
13
|
+
type BasesPlaceholderPayload = {
|
|
14
14
|
readonly spec: BasesSpec;
|
|
15
15
|
readonly source: string;
|
|
16
16
|
};
|
|
17
|
-
export declare function encodeBasesPayload(payload: BasesPlaceholderPayload): string;
|
|
18
17
|
export declare function decodeBasesPayload(encoded: string): BasesPlaceholderPayload | null;
|
|
19
18
|
export declare function createBasesPlaceholder(payload: BasesPlaceholderPayload): string;
|
|
20
19
|
/** A fresh global pattern is returned per call to avoid shared `lastIndex`. */
|
|
21
20
|
export declare function createBasesPlaceholderPattern(): RegExp;
|
|
21
|
+
export {};
|
package/dist/src/remark.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Root } from "mdast";
|
|
2
|
-
|
|
2
|
+
type RemarkBasesOptions = {
|
|
3
3
|
/** Fenced code block language treated as a Base. Defaults to `base`. */
|
|
4
4
|
language?: string;
|
|
5
5
|
};
|
|
@@ -12,3 +12,4 @@ export type RemarkBasesOptions = {
|
|
|
12
12
|
* the content manifest exists.
|
|
13
13
|
*/
|
|
14
14
|
export declare function remarkBases(options?: RemarkBasesOptions): (tree: Root, file: unknown) => void;
|
|
15
|
+
export {};
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContentManifest, Diagnostic, OutputDependency, ResolvedRiebeckiteConfig } from "@riebeckite/core";
|
|
2
2
|
import type { BasesOptions } from "./types.js";
|
|
3
|
-
|
|
3
|
+
type BasesRuntime = {
|
|
4
4
|
/** Replaces every Base placeholder in the manifest with rendered output. */
|
|
5
5
|
resolve(manifest: ContentManifest, diagnostics: Diagnostic[], config?: ResolvedRiebeckiteConfig): void;
|
|
6
6
|
dependenciesFor(slug: string): readonly OutputDependency[];
|
|
@@ -8,3 +8,4 @@ export type BasesRuntime = {
|
|
|
8
8
|
setDocumentDependencies(dependencies: ReadonlyMap<string, readonly OutputDependency[]>): void;
|
|
9
9
|
};
|
|
10
10
|
export declare function createBasesRuntime(options: BasesOptions): BasesRuntime;
|
|
11
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-bases",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"./style.css": "./style.css"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@riebeckite/core": "0.0.33",
|
|
18
19
|
"@types/mdast": "^4.0.4",
|
|
19
20
|
"unist-util-visit": "^5.1.0",
|
|
20
|
-
"vfile-matter": "^5.0.1"
|
|
21
|
-
"@riebeckite/core": "0.0.32"
|
|
21
|
+
"vfile-matter": "^5.0.1"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"./style.css"
|
|
54
54
|
],
|
|
55
55
|
"scripts": {
|
|
56
|
-
"build": "node ../../../scripts/build_package.mjs"
|
|
56
|
+
"build": "node ../../../scripts/build_package.mjs",
|
|
57
|
+
"test": "node --import tsx --test \"test/*.test.ts\""
|
|
57
58
|
}
|
|
58
59
|
}
|
package/style.css
CHANGED
|
@@ -204,22 +204,6 @@
|
|
|
204
204
|
border: 0;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
.rb-bases__fallback {
|
|
208
|
-
margin-top: 1rem;
|
|
209
|
-
color: var(--rb-bases-muted);
|
|
210
|
-
font-size: 0.8125rem;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.rb-bases__fallback pre {
|
|
214
|
-
overflow-x: auto;
|
|
215
|
-
margin: 0.5rem 0 0;
|
|
216
|
-
padding: 0.75rem;
|
|
217
|
-
border: 1px solid var(--rb-bases-rule);
|
|
218
|
-
background: var(--rb-bases-surface);
|
|
219
|
-
color: var(--rb-bases-ink);
|
|
220
|
-
font-size: 0.8125rem;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
207
|
.rb-bases--error {
|
|
224
208
|
margin: 1.5rem 0;
|
|
225
209
|
padding: 0.75rem 1rem;
|