@aiquants/contact-map 0.19.0 → 0.21.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.
- package/README.md +24 -11
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/dist/styles/contact-map.standalone.css +1 -1
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -49,12 +49,13 @@ Peer dependencies:
|
|
|
49
49
|
```json
|
|
50
50
|
{
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@aiquants/
|
|
52
|
+
"@aiquants/console-ui": "^0.6.0",
|
|
53
|
+
"@aiquants/directory-tree": "^6.0.0",
|
|
53
54
|
"@aiquants/fuzzy-search": "^3.2.1",
|
|
54
55
|
"@aiquants/resize-panels": "^2.2.0",
|
|
55
56
|
"@aiquants/select-box": "^0.22.0",
|
|
56
57
|
"@aiquants/swipe-overlay": "^1.4.0",
|
|
57
|
-
"@aiquants/virtualscroll": "^3.
|
|
58
|
+
"@aiquants/virtualscroll": "^3.23.1",
|
|
58
59
|
"drizzle-orm": ">=1.0.0-beta.4 <2.0.0",
|
|
59
60
|
"react": ">=18",
|
|
60
61
|
"react-dom": ">=18",
|
|
@@ -217,17 +218,29 @@ function PrebuildContactMapTree() {
|
|
|
217
218
|
|
|
218
219
|
## Styling / スタイル
|
|
219
220
|
|
|
220
|
-
The components are styled with Tailwind CSS v4 utility classes
|
|
221
|
+
The components are styled with Tailwind CSS v4 utility classes. Every colour they paint is a pair of the package's palette written as `light-dark(<light>, <dark>)` in an arbitrary value (`text-[color:light-dark(#0f172b,#f8fafc)]`), so the colours follow the `color-scheme` the components inherit: a host that sets `color-scheme: dark` on its root, or on an ancestor of the components, gets the dark scheme, and a host that sets nothing keeps the light one. The package declares no `color-scheme` of its own and reads neither `prefers-color-scheme` nor a `dark` class.
|
|
221
222
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
-
|
|
223
|
+
The palette's values are `@aiquants/console-ui`'s tokens and tone table, but for the muted surface, the focus colour and the tree's line colour, which are the map's own; the package imports the values of `@aiquants/console-ui/core` and none of its stylesheets.
|
|
224
|
+
|
|
225
|
+
- **Browsers:** `light-dark()` needs Chrome / Edge 123, Firefox 120 or Safari 17.5 or later.
|
|
226
|
+
- **Contrast (WCAG 2.2 AAA):** in both schemes every text keeps 7:1 against each surface it lies on and every non-text mark (a control's border, the focus ring, the progress bar, the tree lines) 3:1. Nothing is translucent but the modal backdrop.
|
|
227
|
+
- **Uncoloured text:** text the package paints no colour on inherits the host's text colour, so the host gives its page a text colour that follows its scheme.
|
|
228
|
+
- **The tree view:** `@aiquants/directory-tree` paints the colours the package leaves to it from its own `light-dark()` palette, so the whole tree follows the same `color-scheme` and needs no `dark` class. Its lines and expand glyphs are drawn on a canvas above the rows, which cannot resolve `light-dark()`, so they take one colour, `#71829b`, which keeps 3.5:1 on every surface of both schemes, the hovered and the selected rows' included. While a search is in progress the tree is not dimmed: it is marked busy (`aria-busy`) and shows the progress cursor.
|
|
229
|
+
|
|
230
|
+
- A host that builds with Tailwind CSS v4 generates the classes in its own build, with Tailwind CSS v4.1 or later (the package's classes use the `pointer-coarse:` variant of the 16 px text of the search field and the settings' selects on touch screens and the `wrap-break-word` utility, both added in v4.1): it adds an `@source` for the package's files (`@source "<path to node_modules>/@aiquants/contact-map/dist";` for the published package) and defines the `animate-progress-indeterminate` utility of the indeterminate progress bar (the definition below).
|
|
231
|
+
The palette's classes are arbitrary values, so they need no theme variables. It does not import the standalone CSS as well, whose copy of the utilities would compete with its own.
|
|
232
|
+
- A host without Tailwind CSS imports `@aiquants/contact-map/styles/contact-map.standalone.css`: the package's utilities, the palette's colours among them, and the progress animation, compiled. Its corner radii follow the host's `--radius` variable when the host sets one (0.5rem otherwise).
|
|
225
233
|
- Either way, the host imports the CSS of the embedded packages itself, which the standalone CSS leaves out so that an older copy baked into it never overrides the host's newer one: `@aiquants/virtualscroll/styles/virtualscroll.css`, `@aiquants/directory-tree/styles/directory-tree.css` and `@aiquants/resize-panels/styles/resize-panels.css`.
|
|
226
234
|
|
|
227
|
-
コンポーネントは Tailwind CSS v4
|
|
235
|
+
コンポーネントは Tailwind CSS v4 のユーティリティクラスで装飾する。塗る色はどれもパッケージの配色表の組で、任意の値の中に `light-dark(<明るい>, <暗い>)` と書く (`text-[color:light-dark(#0f172b,#f8fafc)]`)。そのため色はコンポーネントが受け継ぐ `color-scheme` に従う: 根かコンポーネントの祖先に `color-scheme: dark` を置いたホストは暗い配色になり、何も置かないホストは明るい配色のまま。パッケージは自分の `color-scheme` を宣言せず、`prefers-color-scheme` も `dark` クラスも読まない。配色表の値は `@aiquants/console-ui` のトークンと色調の表で、控えめな面・フォーカスの色・ツリーの線の色だけは地図のもの。パッケージは `@aiquants/console-ui/core` の値を読み、スタイルシートは読まない。
|
|
236
|
+
|
|
237
|
+
- **ブラウザー**: `light-dark()` には Chrome・Edge 123、Firefox 120、Safari 17.5 以降が要る。
|
|
238
|
+
- **対比 (WCAG 2.2 AAA)**: どちらの配色でも、どの字も載るどの面の上でも 7:1 を、字でない印 (操作部品の枠・フォーカスの輪・進捗のバー・ツリーの線) は 3:1 を保つ。半透明のものはモーダルの背景だけ。
|
|
239
|
+
- **色を塗らない字**: パッケージが色を塗らない字はホストの字の色を受け継ぐので、ホストはページに配色に従う字の色を置く。
|
|
240
|
+
- **ツリービュー**: `@aiquants/directory-tree` は、パッケージが任せる色を自分の `light-dark()` の配色表で塗るので、ツリー全体が同じ `color-scheme` に従い、`dark` クラスは要らない。線と展開の印は行の上のキャンバスに描き、キャンバスは `light-dark()` を解けないので 1 つの色 `#71829b` を使う。どちらの配色のどの面の上でも (ホバーした行と選んだ行の面も) 3.5:1 を保つ。検索の途中のツリーは薄めず、処理中 (`aria-busy`) と示して処理中のカーソルを出す。
|
|
228
241
|
|
|
229
|
-
- Tailwind CSS v4 でビルドするホストは、自分のビルドでクラスを生成する。Tailwind CSS は v4.1 以降が要る (パッケージのクラスは、タッチの画面での検索欄と設定のセレクトの 16 px の文字の `pointer-coarse:` バリアントと `wrap-break-word` ユーティリティを使い、どちらも v4.1 で加わった): パッケージのファイルへの `@source` を足し (公開版なら `@source "<node_modules への道>/@aiquants/contact-map/dist";`)
|
|
230
|
-
- Tailwind CSS を使わないホストは `@aiquants/contact-map/styles/contact-map.standalone.css` を読み込む:
|
|
242
|
+
- Tailwind CSS v4 でビルドするホストは、自分のビルドでクラスを生成する。Tailwind CSS は v4.1 以降が要る (パッケージのクラスは、タッチの画面での検索欄と設定のセレクトの 16 px の文字の `pointer-coarse:` バリアントと `wrap-break-word` ユーティリティを使い、どちらも v4.1 で加わった): パッケージのファイルへの `@source` を足し (公開版なら `@source "<node_modules への道>/@aiquants/contact-map/dist";`)、不確定の進捗バーの `animate-progress-indeterminate` ユーティリティを定義する (定義は下)。配色表のクラスは任意の値なので、テーマの変数は要らない。スタンドアロンの CSS は併せて読み込まない (その写しのユーティリティが自分のものと競り合う)。
|
|
243
|
+
- Tailwind CSS を使わないホストは `@aiquants/contact-map/styles/contact-map.standalone.css` を読み込む: パッケージのユーティリティ (配色表の色を含む) と進捗のアニメーションをコンパイルしたもの。角の丸みは、ホストが `--radius` 変数を置けばそれに従う (無ければ 0.5rem)。
|
|
231
244
|
- どちらの場合も、埋め込みのパッケージの CSS はホストが自分で読み込む (スタンドアロンの CSS は含めないので、焼き込んだ古い写しがホストの新しい CSS を上書きしない): `@aiquants/virtualscroll/styles/virtualscroll.css`・`@aiquants/directory-tree/styles/directory-tree.css`・`@aiquants/resize-panels/styles/resize-panels.css`。
|
|
232
245
|
|
|
233
246
|
A host that builds with Tailwind CSS v4 (in the CSS file its build reads; the `@source` path is relative to that file):
|
|
@@ -443,7 +456,7 @@ The search page normalizes the typed text with `normalizeSearchInput` (exported
|
|
|
443
456
|
- The keywords are written back with fuzzy-search's `formatQuerySets`: single spaces between them, a keyword holding whitespace in ASCII quotation marks (`"ABC 商事"` → `"abc 商事"`), and neither a blank keyword nor a keyword that normalization made equal to an earlier one. `parseQuerySets` therefore reads exactly these keywords from the term. Text without quotation marks becomes its whitespace-separated words, each normalized as above and written once, separated by single spaces.
|
|
444
457
|
|
|
445
458
|
The result highlight and the exact-match ranking are one derivation from the text as typed. `createSearchQueryPattern(query)` finds the spellings that `getSearchQuerySpellings(query)` lists (select-box's `getNormalizedVariants` of each word of the text's keywords and of its normalized form's keywords, read with fuzzy-search's `parseQuerySets`, so a quotation mark is never part of a spelling, each followed by its half-width katakana spelling when every kana of it has one: `タナカ` after `タナカ`, `サトウ` after `サトウ`, the form many stored fields hold), longest first and case-insensitively.
|
|
446
|
-
`HighlightedText` marks its matches in `mark` elements, dark text on yellow
|
|
459
|
+
`HighlightedText` marks its matches in `mark` elements, the palette's text on its mark fill: dark text on yellow in the light scheme and light text on dark yellow in the dark one (15.33:1 and 8.29:1, both above the 7:1 contrast of WCAG 2.2 AAA), and `createExactMatchRanker(query, fields)` moves the results with a match in one of the fields to the top, keeping the fuzzy order within each group. A field is therefore highlighted exactly when it ranks its record as an exact match. A kana reading is marked only when every keyword reads as romaji.
|
|
447
460
|
|
|
448
461
|
The typed query is used because normalization can drop a spelling it holds. The width unification (Unicode NFKC) reads `㈱` as `(株)`, so `㈱山田` becomes the search term `(株)山田`, while the highlight and the ranking still find `㈱山田` in a company stored with `㈱`. The search outlet context carries both: `searchQuery` (as typed) and `searchTerm` (`normalizeSearchInput(searchQuery)`).
|
|
449
462
|
|
|
@@ -461,7 +474,7 @@ The typed query is used because normalization can drop a spelling it holds. The
|
|
|
461
474
|
- キーワードは fuzzy-search の `formatQuerySets` で書き戻す: キーワードの間は 1 つの空白、空白を持つキーワードは ASCII の引用符で囲み (`"ABC 商事"` → `"abc 商事"`)、空のキーワードと、正規化で先のキーワードと等しくなったキーワードは書かない。そのため `parseQuerySets` は検索語からちょうどこれらのキーワードを読む。引用符の無いテキストは、空白で区切った各語を上のとおり正規化して 1 度ずつ並べ、1 つの空白で区切ったものになる。
|
|
462
475
|
|
|
463
476
|
検索結果のハイライトと完全一致による並べ替えは、入力されたままのテキストからの 1 つの導出。`createSearchQueryPattern(query)` は `getSearchQuerySpellings(query)` が並べる表記 (テキストのキーワードとその正規化形のキーワードの各語に対する select-box の `getNormalizedVariants`。語は fuzzy-search の `parseQuerySets` で読むため、引用符は表記の一部にならない。どの仮名も半角の形を持つ表記には、続けて半角カナの表記を置く:
|
|
464
|
-
`タナカ` の次に `タナカ`、`サトウ` の次に `サトウ`。保存されたフィールドに多い形) を、最長のものから大文字小文字を区別せずに探す。`HighlightedText` はその一致に `mark` 要素で印を付け (
|
|
477
|
+
`タナカ` の次に `タナカ`、`サトウ` の次に `サトウ`。保存されたフィールドに多い形) を、最長のものから大文字小文字を区別せずに探す。`HighlightedText` はその一致に `mark` 要素で印を付け (配色表の印の塗りの上の配色表の字。明るい配色は黄色の上の暗い字、暗い配色は暗い黄色の上の明るい字で、15.33:1 と 8.29:1。どちらも WCAG 2.2 AAA の 7:1 を超える)、`createExactMatchRanker(query, fields)` はいずれかのフィールドに一致を持つ結果を先頭へ移す (各グループ内ではあいまい検索の順序を保つ)。そのため、フィールドにハイライトが付くのは、そのフィールドがレコードを完全一致として並べさせるときちょうど。かなの読みに印が付くのはどのキーワードもローマ字として読めるときだけ。
|
|
465
478
|
|
|
466
479
|
入力されたままの検索語を使うのは、正規化が検索語の持つ表記を落とすことがあるため。全角/半角の統一 (Unicode の NFKC) は `㈱` を `(株)` と読むので、`㈱山田` は検索語 `(株)山田` になるが、ハイライトと並べ替えは `㈱` で保存された会社の `㈱山田` を探し続ける。検索のアウトレットコンテキストは両方を運ぶ: `searchQuery` (入力されたまま) と `searchTerm` (`normalizeSearchInput(searchQuery)`)。
|
|
467
480
|
|