@cosense-toolbox/tailwind 0.1.0-beta.6 → 0.1.0-beta.7
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 -0
- package/dist/index.cjs +100 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +100 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -75,6 +75,10 @@ Tailwind v4 の CSS に `@plugin` で足す。
|
|
|
75
75
|
| `cosense-table:{utility}` | `.table` | `table:名前` の表 |
|
|
76
76
|
| `cosense-td:{utility}` | `.table td` | 表のセル |
|
|
77
77
|
| `cosense-image:{utility}` | `.image` | 画像 |
|
|
78
|
+
| `cosense-video:{utility}` | `.video` | 動画 |
|
|
79
|
+
| `cosense-audio:{utility}` | `.audio` | 音声 |
|
|
80
|
+
| `cosense-embed:{utility}` | `.embed` | YouTube などの埋め込み |
|
|
81
|
+
| `cosense-location:{utility}` | `.link-location` | 地図 `[N35,E139]` |
|
|
78
82
|
| `cosense-icon:{utility}` | `.icon` | `[ユーザー名.icon]` |
|
|
79
83
|
| `cosense-formula:{utility}` | `.formula` | `[$ 数式]` |
|
|
80
84
|
|
package/dist/index.cjs
CHANGED
|
@@ -114,6 +114,26 @@ const MODIFIERS = [
|
|
|
114
114
|
target: ".image",
|
|
115
115
|
notation: "画像"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
name: "video",
|
|
119
|
+
target: ".video",
|
|
120
|
+
notation: "動画"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "audio",
|
|
124
|
+
target: ".audio",
|
|
125
|
+
notation: "音声"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "embed",
|
|
129
|
+
target: ".embed",
|
|
130
|
+
notation: "YouTube などの埋め込み"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "location",
|
|
134
|
+
target: ".link-location",
|
|
135
|
+
notation: "地図 `[N35,E139]`"
|
|
136
|
+
},
|
|
117
137
|
{
|
|
118
138
|
name: "icon",
|
|
119
139
|
target: ".icon",
|
|
@@ -338,6 +358,45 @@ const styles = {
|
|
|
338
358
|
"vertical-align": "bottom"
|
|
339
359
|
}
|
|
340
360
|
},
|
|
361
|
+
{
|
|
362
|
+
"selector": {
|
|
363
|
+
"body": ".video",
|
|
364
|
+
"pseudo": ""
|
|
365
|
+
},
|
|
366
|
+
"declarations": {
|
|
367
|
+
"display": "inline-block",
|
|
368
|
+
"max-width": "100%",
|
|
369
|
+
"max-height": "300px",
|
|
370
|
+
"vertical-align": "bottom"
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"selector": {
|
|
375
|
+
"body": ".audio",
|
|
376
|
+
"pseudo": ""
|
|
377
|
+
},
|
|
378
|
+
"declarations": {
|
|
379
|
+
"display": "inline-flex",
|
|
380
|
+
"align-items": "center",
|
|
381
|
+
"gap": "0.5em",
|
|
382
|
+
"max-width": "100%",
|
|
383
|
+
"vertical-align": "middle"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"selector": {
|
|
388
|
+
"body": ".embed",
|
|
389
|
+
"pseudo": ""
|
|
390
|
+
},
|
|
391
|
+
"declarations": {
|
|
392
|
+
"display": "block",
|
|
393
|
+
"width": "100%",
|
|
394
|
+
"max-width": "560px",
|
|
395
|
+
"aspect-ratio": "16 / 9",
|
|
396
|
+
"margin": "3px 0",
|
|
397
|
+
"border": "0"
|
|
398
|
+
}
|
|
399
|
+
},
|
|
341
400
|
{
|
|
342
401
|
"selector": {
|
|
343
402
|
"body": ".formula",
|
|
@@ -372,6 +431,16 @@ const styles = {
|
|
|
372
431
|
"white-space": "nowrap"
|
|
373
432
|
}
|
|
374
433
|
},
|
|
434
|
+
{
|
|
435
|
+
"selector": {
|
|
436
|
+
"body": ".audio audio",
|
|
437
|
+
"pseudo": ""
|
|
438
|
+
},
|
|
439
|
+
"declarations": {
|
|
440
|
+
"max-width": "100%",
|
|
441
|
+
"height": "2.5em"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
375
444
|
{
|
|
376
445
|
"selector": {
|
|
377
446
|
"body": "img.icon",
|
|
@@ -488,6 +557,37 @@ const styles = {
|
|
|
488
557
|
"max-height": "none"
|
|
489
558
|
}
|
|
490
559
|
},
|
|
560
|
+
{
|
|
561
|
+
"selector": {
|
|
562
|
+
"body": ".video[data-large]",
|
|
563
|
+
"pseudo": ""
|
|
564
|
+
},
|
|
565
|
+
"declarations": {
|
|
566
|
+
"margin": "3px 0",
|
|
567
|
+
"max-width": "95%",
|
|
568
|
+
"max-height": "none"
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"selector": {
|
|
573
|
+
"body": ".embed[data-provider=\"spotify\"]",
|
|
574
|
+
"pseudo": ""
|
|
575
|
+
},
|
|
576
|
+
"declarations": {
|
|
577
|
+
"aspect-ratio": "auto",
|
|
578
|
+
"height": "152px"
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
"selector": {
|
|
583
|
+
"body": ".embed[data-provider=\"anchor\"]",
|
|
584
|
+
"pseudo": ""
|
|
585
|
+
},
|
|
586
|
+
"declarations": {
|
|
587
|
+
"aspect-ratio": "auto",
|
|
588
|
+
"height": "152px"
|
|
589
|
+
}
|
|
590
|
+
},
|
|
491
591
|
{
|
|
492
592
|
"selector": {
|
|
493
593
|
"body": ".decoration[data-size-level=\"1\"]",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["plugin"],"sources":["../src/modifiers.ts","../src/styles.generated.ts","../src/index.ts"],"sourcesContent":["/**\n * modifiers.ts — `cosense-link:underline` のように、記事の中の特定の要素にだけ utility を当てる modifier。\n * typography の `prose-a:` にあたる。\n *\n * 対象は HTML の要素名ではなく Cosense の記法で選ぶ。`toHtml` は同じ `<a>` をリンク・タグ・\n * アイコンに使い分けるので、要素名で選ぶと区別できないため。class 名は parser の既定\n * (`defaultClassNames`) に合わせている。\n */\n\nexport interface Modifier {\n /** modifier の名前。`{className}-{name}:` になる */\n readonly name: string\n /** 当てる先のセレクタ。`.cosense` の子孫として探す */\n readonly target: string\n /** 対応する Cosense の記法 (README の表に出す) */\n readonly notation: string\n}\n\nexport const MODIFIERS: readonly Modifier[] = [\n { name: \"title\", target: \".title\", notation: \"タイトル (1 行目)\" },\n { name: \"line\", target: \".line\", notation: \"各行\" },\n {\n name: \"heading\",\n target: \".decoration[data-size-level]\",\n notation: \"`[** 見出し]` などの大きな文字\",\n },\n { name: \"strong\", target: \"strong\", notation: \"`[[太字]]` `[* 太字]`\" },\n { name: \"em\", target: \"em\", notation: \"`[/ 斜体]`\" },\n { name: \"s\", target: \"s\", notation: \"`[- 打ち消し]`\" },\n { name: \"u\", target: \"u\", notation: \"`[_ 下線]`\" },\n {\n name: \"link\",\n target: \".link\",\n notation: \"リンクすべて (`[ページ]` `[https://…]` `[/project/ページ]`)\",\n },\n { name: \"link-external\", target: \".link-external\", notation: \"外部リンク `[https://…]`\" },\n {\n name: \"link-project\",\n target: \".link-project\",\n notation: \"別プロジェクトへのリンク `[/project/ページ]`\",\n },\n { name: \"hashtag\", target: \".hashtag\", notation: \"`#タグ`\" },\n { name: \"code\", target: \".code\", notation: \"`` `コード` ``\" },\n {\n name: \"code-block\",\n target: \".code-block > code\",\n notation: \"`code:ファイル名` のブロックの各行\",\n },\n {\n name: \"code-filename\",\n target: \".code-block-start\",\n notation: \"`code:ファイル名` のファイル名\",\n },\n { name: \"quote\", target: \".quote\", notation: \"`>` で始まる引用\" },\n { name: \"table\", target: \".table\", notation: \"`table:名前` の表\" },\n { name: \"td\", target: \".table td\", notation: \"表のセル\" },\n { name: \"image\", target: \".image\", notation: \"画像\" },\n { name: \"icon\", target: \".icon\", notation: \"`[ユーザー名.icon]`\" },\n { name: \"formula\", target: \".formula\", notation: \"`[$ 数式]`\" },\n]\n","/**\n * 生成物。編集しない。\n * packages/style/style.css から `bun run generate` で作る。\n */\nimport type { CosenseStyles } from './extract'\n\nexport const styles: CosenseStyles = {\n \"root\": {\n \"font-family\": \"var(--cosense-font, \\\"Open Sans\\\", Helvetica, Arial, \\\"Hiragino Sans\\\", sans-serif)\",\n \"font-size\": \"var(--cosense-font-size, 15px)\",\n \"line-height\": \"var(--cosense-line-height, 1.87)\",\n \"color\": \"var(--cosense-text, var(--page-text-color, #4a4a4a))\",\n \"background\": \"var(--cosense-bg, var(--page-bg, #fefefe))\",\n \"text-align\": \"left\",\n \"word-wrap\": \"break-word\"\n },\n \"rules\": [\n {\n \"selector\": {\n \"body\": \".title\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0 0 0.77em\",\n \"font-size\": \"1.73em\",\n \"font-weight\": \"700\",\n \"line-height\": \"1.62\",\n \"color\": \"var(--cosense-title, var(--line-title-color, var(--page-text-color, #4a4a4a)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"relative\",\n \"min-height\": \"1em\",\n \"font-variant-ligatures\": \"no-common-ligatures\"\n }\n },\n {\n \"selector\": {\n \"body\": \".indent-mark\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"left\": \"0\",\n \"top\": \"0\",\n \"height\": \"1em\",\n \"color\": \"transparent\"\n }\n },\n {\n \"selector\": {\n \"body\": \".pad\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"width\": \"var(--cosense-indent, 1.5em)\",\n \"height\": \"1em\",\n \"overflow\": \"hidden\"\n }\n },\n {\n \"selector\": {\n \"body\": \".dot\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"right\": \"0.65em\",\n \"top\": \"0.7em\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-block-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"font-size\": \"0.95em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".quote\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"margin\": \"0\",\n \"padding-left\": \"3px\",\n \"border-left\": \"solid 1px #a0a0a0\",\n \"background\": \"var(--cosense-quote-bg, var(--quote-bg-color, rgba(0, 0, 0, 0.05)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0\",\n \"border-collapse\": \"collapse\",\n \"caption-side\": \"top\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".formula\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"auto 6px\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"font-style\": \"italic\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table caption\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"text-align\": \"center\",\n \"font-size\": \"0.9em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 2px 0 8px\",\n \"white-space\": \"nowrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \"img.icon\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"position\": \"relative\",\n \"top\": \"-0.3em\",\n \"height\": \"1.3em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"baseline\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"6\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"7\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"7\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"8\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"8\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"9\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"9\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"10\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"10\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.2em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.44em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.73em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"2.07em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"line-height\": \"1.6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"\\\"\\\"\",\n \"position\": \"absolute\",\n \"top\": \"0.7em\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0) - 1.05em)\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line:has(> .indent-mark)\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"min-height\": \"1.7em\",\n \"line-height\": \"1.7em\",\n \"tab-size\": \"4\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(odd)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.04)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(even)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.06)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin-left\": \"calc(var(--cosense-indent, 1.5em) * -1)\",\n \"padding-left\": \"var(--cosense-indent, 1.5em)\",\n \"white-space\": \"pre-wrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block:not(:has(> .code-start))\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"attr(data-line)\",\n \"top\": \"0\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * (var(--cosense-depth, 1) - 1))\",\n \"width\": \"calc(0.6em + var(--cosense-line-digits, 5) * 1ch)\",\n \"height\": \"auto\",\n \"display\": \"flex\",\n \"justify-content\": \"flex-end\",\n \"white-space\": \"nowrap\",\n \"border-radius\": \"0\",\n \"background\": \"none\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"line-height\": \"1.7em\",\n \"color\": \"var(--cosense-line-number, rgba(0, 0, 0, 0.35))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line] > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(0.6em + (var(--cosense-line-digits, 5) + 1) * 1ch)\"\n }\n }\n ]\n}\n","/**\n * `@cosense-toolbox/tailwind` — `class=\"cosense\"` を付けた要素の中に、Cosense 記法の既定の見た目を当てる。\n * typography の `prose` と同じ使い方をする。\n *\n * ```css\n * @import \"tailwindcss\";\n * @plugin \"@cosense-toolbox/tailwind\";\n * ```\n *\n * 当てるスタイルは `@cosense-toolbox/style` の style.css と同じもの。`cosense-link:underline` のような\n * modifier で、記事の中の特定の記法にだけ utility を当てられる。\n */\nimport plugin, { type PluginAPI } from \"tailwindcss/plugin\"\n\nimport type { Declarations, StyleRule } from \"./extract\"\nimport { type Modifier, MODIFIERS } from \"./modifiers\"\nimport { styles } from \"./styles.generated\"\n\nexport interface CosenseTailwindOptions {\n /**\n * スタイルを当てる class 名。`not-{className}` を付けた要素とその中身には当てない。\n *\n * @defaultValue `'cosense'`\n */\n readonly className?: string\n}\n\ntype Components = Parameters<PluginAPI[\"addComponents\"]>[0]\n\n/** 生成したデータは readonly なので、Tailwind の可変の型に合わせる (中身は書き換えない)。 */\nconst mutable = (declarations: Declarations) => declarations as Record<string, string | string[]>\n\n/**\n * `not-{className}` を付けた要素とその中を除く条件。`:where()` の中なので詳細度を増やさない。\n */\nconst outside = (className: string): string =>\n `:not(:where([class~=\"not-${className}\"],[class~=\"not-${className}\"] *))`\n\n/**\n * 1 つのルールのセレクタ。本文を `:where()` で包み、どのルールも `.cosense` と同じ詳細度にする。\n * 除く条件は擬似要素より前に付ける。\n *\n * 詳細度を揃えるので、ルールどうしの勝ち負けは並び順だけで決まる。生成したデータは元の詳細度の\n * 低い順に並んでいるので、style.css と同じ勝ち負けになる。後ろに出る `cosense-link:` などの\n * modifier や、同じ詳細度の utility が既定のスタイルに勝てるのは、このため。\n */\nconst selectorOf = ({ selector }: StyleRule, className: string): string =>\n `& :where(${selector.body})${outside(className)}${selector.pseudo}`\n\n/**\n * ルールごとに別のオブジェクトにする。1 つのオブジェクトのキーにすると、同じセレクタのルールが\n * 後のもので上書きされてしまうため。Tailwind は並べた順のまま `.cosense` の中に出す。\n */\nconst componentsOf = (className: string): Components => [\n { [`.${className}`]: mutable(styles.root) },\n ...styles.rules.map((rule) => ({\n [`.${className}`]: { [selectorOf(rule, className)]: mutable(rule.declarations) },\n })),\n]\n\n/** `cosense-link:` なら `.cosense-link\\:underline :is(…)` のように、中の対象だけに当てる。 */\nconst modifierOf = (modifier: Modifier, className: string): string =>\n `& :is(:where(${modifier.target})${outside(className)})`\n\n/** class 名に使えない記号を、CSS のセレクタ用にエスケープする。 */\nconst escapeClassChar = (char: string): string => (/[A-Za-z0-9_-]/.test(char) ? char : `\\\\${char}`)\n\n/**\n * `cosense-deco-[|]:` の `[...]` に書いた記号の装飾。`toHtml` は装飾を\n * `<span class=\"decoration deco-|\">` のように記号ごとの class で出すので、それを選ぶ。\n * 記号を並べると (`[-/]`)、それらをすべて持つ装飾に当たる。\n *\n * Tailwind は `[...]` の中の `_` を空白に変える。下線の記号 `_` は `[\\_]` と書く (Tailwind の決まり)。\n */\nconst decorationOf = (markers: string, className: string): string => {\n const classes = [...new Set(markers)].map((marker) => `.deco-${escapeClassChar(marker)}`).join(\"\")\n return `& :is(:where(.decoration${classes})${outside(className)})`\n}\n\n/** Tailwind の型を公開する型定義に書き出せるよう、型を明示する。 */\ntype CosensePlugin = ReturnType<typeof plugin.withOptions<CosenseTailwindOptions>>\n\nconst cosense: CosensePlugin = plugin.withOptions<CosenseTailwindOptions>(\n (options) =>\n ({ addComponents, addVariant, matchVariant }) => {\n const className = options?.className ?? \"cosense\"\n addComponents(componentsOf(className))\n for (const modifier of MODIFIERS) {\n addVariant(`${className}-${modifier.name}`, modifierOf(modifier, className))\n }\n // 記号は `[...]` にそのまま書く (`cosense-deco-[|]:`)。名前を覚えなくて済むようにするため。\n matchVariant(`${className}-deco`, (markers) => decorationOf(markers, className))\n },\n)\n\nexport default cosense\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAa,YAAiC;CAC5C;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAc;CAC3D;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAK;CAChD;EACE,MAAM;EACN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AAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,UAAU;IACV,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;GACd;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,YAAY;IACZ,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,iBAAiB;IACjB,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,SAAS;IACT,mBAAmB;IACnB,+BAA+B;GACjC;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,SAAS;IACT,mBAAmB;IACnB,+BAA+B;GACjC;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,mBAAmB;IACnB,gBAAgB;GAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,cAAc;IACd,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,UAAU;IACV,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,KACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,gBAAgB,+DAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,QACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ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C;AACjF,CACJ"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["plugin"],"sources":["../src/modifiers.ts","../src/styles.generated.ts","../src/index.ts"],"sourcesContent":["/**\n * modifiers.ts — `cosense-link:underline` のように、記事の中の特定の要素にだけ utility を当てる modifier。\n * typography の `prose-a:` にあたる。\n *\n * 対象は HTML の要素名ではなく Cosense の記法で選ぶ。`toHtml` は同じ `<a>` をリンク・タグ・\n * アイコンに使い分けるので、要素名で選ぶと区別できないため。class 名は parser の既定\n * (`defaultClassNames`) に合わせている。\n */\n\nexport interface Modifier {\n /** modifier の名前。`{className}-{name}:` になる */\n readonly name: string\n /** 当てる先のセレクタ。`.cosense` の子孫として探す */\n readonly target: string\n /** 対応する Cosense の記法 (README の表に出す) */\n readonly notation: string\n}\n\nexport const MODIFIERS: readonly Modifier[] = [\n { name: \"title\", target: \".title\", notation: \"タイトル (1 行目)\" },\n { name: \"line\", target: \".line\", notation: \"各行\" },\n {\n name: \"heading\",\n target: \".decoration[data-size-level]\",\n notation: \"`[** 見出し]` などの大きな文字\",\n },\n { name: \"strong\", target: \"strong\", notation: \"`[[太字]]` `[* 太字]`\" },\n { name: \"em\", target: \"em\", notation: \"`[/ 斜体]`\" },\n { name: \"s\", target: \"s\", notation: \"`[- 打ち消し]`\" },\n { name: \"u\", target: \"u\", notation: \"`[_ 下線]`\" },\n {\n name: \"link\",\n target: \".link\",\n notation: \"リンクすべて (`[ページ]` `[https://…]` `[/project/ページ]`)\",\n },\n { name: \"link-external\", target: \".link-external\", notation: \"外部リンク `[https://…]`\" },\n {\n name: \"link-project\",\n target: \".link-project\",\n notation: \"別プロジェクトへのリンク `[/project/ページ]`\",\n },\n { name: \"hashtag\", target: \".hashtag\", notation: \"`#タグ`\" },\n { name: \"code\", target: \".code\", notation: \"`` `コード` ``\" },\n {\n name: \"code-block\",\n target: \".code-block > code\",\n notation: \"`code:ファイル名` のブロックの各行\",\n },\n {\n name: \"code-filename\",\n target: \".code-block-start\",\n notation: \"`code:ファイル名` のファイル名\",\n },\n { name: \"quote\", target: \".quote\", notation: \"`>` で始まる引用\" },\n { name: \"table\", target: \".table\", notation: \"`table:名前` の表\" },\n { name: \"td\", target: \".table td\", notation: \"表のセル\" },\n { name: \"image\", target: \".image\", notation: \"画像\" },\n { name: \"video\", target: \".video\", notation: \"動画\" },\n { name: \"audio\", target: \".audio\", notation: \"音声\" },\n { name: \"embed\", target: \".embed\", notation: \"YouTube などの埋め込み\" },\n { name: \"location\", target: \".link-location\", notation: \"地図 `[N35,E139]`\" },\n { name: \"icon\", target: \".icon\", notation: \"`[ユーザー名.icon]`\" },\n { name: \"formula\", target: \".formula\", notation: \"`[$ 数式]`\" },\n]\n","/**\n * 生成物。編集しない。\n * packages/style/style.css から `bun run generate` で作る。\n */\nimport type { CosenseStyles } from './extract'\n\nexport const styles: CosenseStyles = {\n \"root\": {\n \"font-family\": \"var(--cosense-font, \\\"Open Sans\\\", Helvetica, Arial, \\\"Hiragino Sans\\\", sans-serif)\",\n \"font-size\": \"var(--cosense-font-size, 15px)\",\n \"line-height\": \"var(--cosense-line-height, 1.87)\",\n \"color\": \"var(--cosense-text, var(--page-text-color, #4a4a4a))\",\n \"background\": \"var(--cosense-bg, var(--page-bg, #fefefe))\",\n \"text-align\": \"left\",\n \"word-wrap\": \"break-word\"\n },\n \"rules\": [\n {\n \"selector\": {\n \"body\": \".title\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0 0 0.77em\",\n \"font-size\": \"1.73em\",\n \"font-weight\": \"700\",\n \"line-height\": \"1.62\",\n \"color\": \"var(--cosense-title, var(--line-title-color, var(--page-text-color, #4a4a4a)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"relative\",\n \"min-height\": \"1em\",\n \"font-variant-ligatures\": \"no-common-ligatures\"\n }\n },\n {\n \"selector\": {\n \"body\": \".indent-mark\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"left\": \"0\",\n \"top\": \"0\",\n \"height\": \"1em\",\n \"color\": \"transparent\"\n }\n },\n {\n \"selector\": {\n \"body\": \".pad\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"width\": \"var(--cosense-indent, 1.5em)\",\n \"height\": \"1em\",\n \"overflow\": \"hidden\"\n }\n },\n {\n \"selector\": {\n \"body\": \".dot\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"right\": \"0.65em\",\n \"top\": \"0.7em\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-block-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"font-size\": \"0.95em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".quote\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"margin\": \"0\",\n \"padding-left\": \"3px\",\n \"border-left\": \"solid 1px #a0a0a0\",\n \"background\": \"var(--cosense-quote-bg, var(--quote-bg-color, rgba(0, 0, 0, 0.05)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0\",\n \"border-collapse\": \"collapse\",\n \"caption-side\": \"top\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".video\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".audio\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-flex\",\n \"align-items\": \"center\",\n \"gap\": \"0.5em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"middle\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"width\": \"100%\",\n \"max-width\": \"560px\",\n \"aspect-ratio\": \"16 / 9\",\n \"margin\": \"3px 0\",\n \"border\": \"0\"\n }\n },\n {\n \"selector\": {\n \"body\": \".formula\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"auto 6px\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"font-style\": \"italic\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table caption\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"text-align\": \"center\",\n \"font-size\": \"0.9em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 2px 0 8px\",\n \"white-space\": \"nowrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".audio audio\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"max-width\": \"100%\",\n \"height\": \"2.5em\"\n }\n },\n {\n \"selector\": {\n \"body\": \"img.icon\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"position\": \"relative\",\n \"top\": \"-0.3em\",\n \"height\": \"1.3em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"baseline\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"6\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"7\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"7\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"8\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"8\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"9\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"9\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"10\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"10\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".video[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed[data-provider=\\\"spotify\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"aspect-ratio\": \"auto\",\n \"height\": \"152px\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed[data-provider=\\\"anchor\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"aspect-ratio\": \"auto\",\n \"height\": \"152px\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.2em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.44em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.73em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"2.07em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"line-height\": \"1.6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"\\\"\\\"\",\n \"position\": \"absolute\",\n \"top\": \"0.7em\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0) - 1.05em)\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line:has(> .indent-mark)\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"min-height\": \"1.7em\",\n \"line-height\": \"1.7em\",\n \"tab-size\": \"4\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(odd)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.04)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(even)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.06)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin-left\": \"calc(var(--cosense-indent, 1.5em) * -1)\",\n \"padding-left\": \"var(--cosense-indent, 1.5em)\",\n \"white-space\": \"pre-wrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block:not(:has(> .code-start))\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"attr(data-line)\",\n \"top\": \"0\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * (var(--cosense-depth, 1) - 1))\",\n \"width\": \"calc(0.6em + var(--cosense-line-digits, 5) * 1ch)\",\n \"height\": \"auto\",\n \"display\": \"flex\",\n \"justify-content\": \"flex-end\",\n \"white-space\": \"nowrap\",\n \"border-radius\": \"0\",\n \"background\": \"none\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"line-height\": \"1.7em\",\n \"color\": \"var(--cosense-line-number, rgba(0, 0, 0, 0.35))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line] > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(0.6em + (var(--cosense-line-digits, 5) + 1) * 1ch)\"\n }\n }\n ]\n}\n","/**\n * `@cosense-toolbox/tailwind` — `class=\"cosense\"` を付けた要素の中に、Cosense 記法の既定の見た目を当てる。\n * typography の `prose` と同じ使い方をする。\n *\n * ```css\n * @import \"tailwindcss\";\n * @plugin \"@cosense-toolbox/tailwind\";\n * ```\n *\n * 当てるスタイルは `@cosense-toolbox/style` の style.css と同じもの。`cosense-link:underline` のような\n * modifier で、記事の中の特定の記法にだけ utility を当てられる。\n */\nimport plugin, { type PluginAPI } from \"tailwindcss/plugin\"\n\nimport type { Declarations, StyleRule } from \"./extract\"\nimport { type Modifier, MODIFIERS } from \"./modifiers\"\nimport { styles } from \"./styles.generated\"\n\nexport interface CosenseTailwindOptions {\n /**\n * スタイルを当てる class 名。`not-{className}` を付けた要素とその中身には当てない。\n *\n * @defaultValue `'cosense'`\n */\n readonly className?: string\n}\n\ntype Components = Parameters<PluginAPI[\"addComponents\"]>[0]\n\n/** 生成したデータは readonly なので、Tailwind の可変の型に合わせる (中身は書き換えない)。 */\nconst mutable = (declarations: Declarations) => declarations as Record<string, string | string[]>\n\n/**\n * `not-{className}` を付けた要素とその中を除く条件。`:where()` の中なので詳細度を増やさない。\n */\nconst outside = (className: string): string =>\n `:not(:where([class~=\"not-${className}\"],[class~=\"not-${className}\"] *))`\n\n/**\n * 1 つのルールのセレクタ。本文を `:where()` で包み、どのルールも `.cosense` と同じ詳細度にする。\n * 除く条件は擬似要素より前に付ける。\n *\n * 詳細度を揃えるので、ルールどうしの勝ち負けは並び順だけで決まる。生成したデータは元の詳細度の\n * 低い順に並んでいるので、style.css と同じ勝ち負けになる。後ろに出る `cosense-link:` などの\n * modifier や、同じ詳細度の utility が既定のスタイルに勝てるのは、このため。\n */\nconst selectorOf = ({ selector }: StyleRule, className: string): string =>\n `& :where(${selector.body})${outside(className)}${selector.pseudo}`\n\n/**\n * ルールごとに別のオブジェクトにする。1 つのオブジェクトのキーにすると、同じセレクタのルールが\n * 後のもので上書きされてしまうため。Tailwind は並べた順のまま `.cosense` の中に出す。\n */\nconst componentsOf = (className: string): Components => [\n { [`.${className}`]: mutable(styles.root) },\n ...styles.rules.map((rule) => ({\n [`.${className}`]: { [selectorOf(rule, className)]: mutable(rule.declarations) },\n })),\n]\n\n/** `cosense-link:` なら `.cosense-link\\:underline :is(…)` のように、中の対象だけに当てる。 */\nconst modifierOf = (modifier: Modifier, className: string): string =>\n `& :is(:where(${modifier.target})${outside(className)})`\n\n/** class 名に使えない記号を、CSS のセレクタ用にエスケープする。 */\nconst escapeClassChar = (char: string): string => (/[A-Za-z0-9_-]/.test(char) ? char : `\\\\${char}`)\n\n/**\n * `cosense-deco-[|]:` の `[...]` に書いた記号の装飾。`toHtml` は装飾を\n * `<span class=\"decoration deco-|\">` のように記号ごとの class で出すので、それを選ぶ。\n * 記号を並べると (`[-/]`)、それらをすべて持つ装飾に当たる。\n *\n * Tailwind は `[...]` の中の `_` を空白に変える。下線の記号 `_` は `[\\_]` と書く (Tailwind の決まり)。\n */\nconst decorationOf = (markers: string, className: string): string => {\n const classes = [...new Set(markers)].map((marker) => `.deco-${escapeClassChar(marker)}`).join(\"\")\n return `& :is(:where(.decoration${classes})${outside(className)})`\n}\n\n/** Tailwind の型を公開する型定義に書き出せるよう、型を明示する。 */\ntype CosensePlugin = ReturnType<typeof plugin.withOptions<CosenseTailwindOptions>>\n\nconst cosense: CosensePlugin = plugin.withOptions<CosenseTailwindOptions>(\n (options) =>\n ({ addComponents, addVariant, matchVariant }) => {\n const className = options?.className ?? \"cosense\"\n addComponents(componentsOf(className))\n for (const modifier of MODIFIERS) {\n addVariant(`${className}-${modifier.name}`, modifierOf(modifier, className))\n }\n // 記号は `[...]` にそのまま書く (`cosense-deco-[|]:`)。名前を覚えなくて済むようにするため。\n matchVariant(`${className}-deco`, (markers) => decorationOf(markers, className))\n },\n)\n\nexport default cosense\n"],"mappings":";;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;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,mBAAmB;IACnB,gBAAgB;GAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;IACf,OAAO;IACP,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,cAAc;IACd,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,aAAa;IACb,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,UAAU;IACV,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,KACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,gBAAgB,+DAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,gBAAgB;IAChB,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,gBAAgB;IAChB,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,QACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IAC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92
92
|
notation: "画像"
|
|
93
93
|
},
|
|
94
|
+
{
|
|
95
|
+
name: "video",
|
|
96
|
+
target: ".video",
|
|
97
|
+
notation: "動画"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "audio",
|
|
101
|
+
target: ".audio",
|
|
102
|
+
notation: "音声"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "embed",
|
|
106
|
+
target: ".embed",
|
|
107
|
+
notation: "YouTube などの埋め込み"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "location",
|
|
111
|
+
target: ".link-location",
|
|
112
|
+
notation: "地図 `[N35,E139]`"
|
|
113
|
+
},
|
|
94
114
|
{
|
|
95
115
|
name: "icon",
|
|
96
116
|
target: ".icon",
|
|
@@ -315,6 +335,45 @@ const styles = {
|
|
|
315
335
|
"vertical-align": "bottom"
|
|
316
336
|
}
|
|
317
337
|
},
|
|
338
|
+
{
|
|
339
|
+
"selector": {
|
|
340
|
+
"body": ".video",
|
|
341
|
+
"pseudo": ""
|
|
342
|
+
},
|
|
343
|
+
"declarations": {
|
|
344
|
+
"display": "inline-block",
|
|
345
|
+
"max-width": "100%",
|
|
346
|
+
"max-height": "300px",
|
|
347
|
+
"vertical-align": "bottom"
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"selector": {
|
|
352
|
+
"body": ".audio",
|
|
353
|
+
"pseudo": ""
|
|
354
|
+
},
|
|
355
|
+
"declarations": {
|
|
356
|
+
"display": "inline-flex",
|
|
357
|
+
"align-items": "center",
|
|
358
|
+
"gap": "0.5em",
|
|
359
|
+
"max-width": "100%",
|
|
360
|
+
"vertical-align": "middle"
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"selector": {
|
|
365
|
+
"body": ".embed",
|
|
366
|
+
"pseudo": ""
|
|
367
|
+
},
|
|
368
|
+
"declarations": {
|
|
369
|
+
"display": "block",
|
|
370
|
+
"width": "100%",
|
|
371
|
+
"max-width": "560px",
|
|
372
|
+
"aspect-ratio": "16 / 9",
|
|
373
|
+
"margin": "3px 0",
|
|
374
|
+
"border": "0"
|
|
375
|
+
}
|
|
376
|
+
},
|
|
318
377
|
{
|
|
319
378
|
"selector": {
|
|
320
379
|
"body": ".formula",
|
|
@@ -349,6 +408,16 @@ const styles = {
|
|
|
349
408
|
"white-space": "nowrap"
|
|
350
409
|
}
|
|
351
410
|
},
|
|
411
|
+
{
|
|
412
|
+
"selector": {
|
|
413
|
+
"body": ".audio audio",
|
|
414
|
+
"pseudo": ""
|
|
415
|
+
},
|
|
416
|
+
"declarations": {
|
|
417
|
+
"max-width": "100%",
|
|
418
|
+
"height": "2.5em"
|
|
419
|
+
}
|
|
420
|
+
},
|
|
352
421
|
{
|
|
353
422
|
"selector": {
|
|
354
423
|
"body": "img.icon",
|
|
@@ -465,6 +534,37 @@ const styles = {
|
|
|
465
534
|
"max-height": "none"
|
|
466
535
|
}
|
|
467
536
|
},
|
|
537
|
+
{
|
|
538
|
+
"selector": {
|
|
539
|
+
"body": ".video[data-large]",
|
|
540
|
+
"pseudo": ""
|
|
541
|
+
},
|
|
542
|
+
"declarations": {
|
|
543
|
+
"margin": "3px 0",
|
|
544
|
+
"max-width": "95%",
|
|
545
|
+
"max-height": "none"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"selector": {
|
|
550
|
+
"body": ".embed[data-provider=\"spotify\"]",
|
|
551
|
+
"pseudo": ""
|
|
552
|
+
},
|
|
553
|
+
"declarations": {
|
|
554
|
+
"aspect-ratio": "auto",
|
|
555
|
+
"height": "152px"
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"selector": {
|
|
560
|
+
"body": ".embed[data-provider=\"anchor\"]",
|
|
561
|
+
"pseudo": ""
|
|
562
|
+
},
|
|
563
|
+
"declarations": {
|
|
564
|
+
"aspect-ratio": "auto",
|
|
565
|
+
"height": "152px"
|
|
566
|
+
}
|
|
567
|
+
},
|
|
468
568
|
{
|
|
469
569
|
"selector": {
|
|
470
570
|
"body": ".decoration[data-size-level=\"1\"]",
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/modifiers.ts","../src/styles.generated.ts","../src/index.ts"],"sourcesContent":["/**\n * modifiers.ts — `cosense-link:underline` のように、記事の中の特定の要素にだけ utility を当てる modifier。\n * typography の `prose-a:` にあたる。\n *\n * 対象は HTML の要素名ではなく Cosense の記法で選ぶ。`toHtml` は同じ `<a>` をリンク・タグ・\n * アイコンに使い分けるので、要素名で選ぶと区別できないため。class 名は parser の既定\n * (`defaultClassNames`) に合わせている。\n */\n\nexport interface Modifier {\n /** modifier の名前。`{className}-{name}:` になる */\n readonly name: string\n /** 当てる先のセレクタ。`.cosense` の子孫として探す */\n readonly target: string\n /** 対応する Cosense の記法 (README の表に出す) */\n readonly notation: string\n}\n\nexport const MODIFIERS: readonly Modifier[] = [\n { name: \"title\", target: \".title\", notation: \"タイトル (1 行目)\" },\n { name: \"line\", target: \".line\", notation: \"各行\" },\n {\n name: \"heading\",\n target: \".decoration[data-size-level]\",\n notation: \"`[** 見出し]` などの大きな文字\",\n },\n { name: \"strong\", target: \"strong\", notation: \"`[[太字]]` `[* 太字]`\" },\n { name: \"em\", target: \"em\", notation: \"`[/ 斜体]`\" },\n { name: \"s\", target: \"s\", notation: \"`[- 打ち消し]`\" },\n { name: \"u\", target: \"u\", notation: \"`[_ 下線]`\" },\n {\n name: \"link\",\n target: \".link\",\n notation: \"リンクすべて (`[ページ]` `[https://…]` `[/project/ページ]`)\",\n },\n { name: \"link-external\", target: \".link-external\", notation: \"外部リンク `[https://…]`\" },\n {\n name: \"link-project\",\n target: \".link-project\",\n notation: \"別プロジェクトへのリンク `[/project/ページ]`\",\n },\n { name: \"hashtag\", target: \".hashtag\", notation: \"`#タグ`\" },\n { name: \"code\", target: \".code\", notation: \"`` `コード` ``\" },\n {\n name: \"code-block\",\n target: \".code-block > code\",\n notation: \"`code:ファイル名` のブロックの各行\",\n },\n {\n name: \"code-filename\",\n target: \".code-block-start\",\n notation: \"`code:ファイル名` のファイル名\",\n },\n { name: \"quote\", target: \".quote\", notation: \"`>` で始まる引用\" },\n { name: \"table\", target: \".table\", notation: \"`table:名前` の表\" },\n { name: \"td\", target: \".table td\", notation: \"表のセル\" },\n { name: \"image\", target: \".image\", notation: \"画像\" },\n { name: \"icon\", target: \".icon\", notation: \"`[ユーザー名.icon]`\" },\n { name: \"formula\", target: \".formula\", notation: \"`[$ 数式]`\" },\n]\n","/**\n * 生成物。編集しない。\n * packages/style/style.css から `bun run generate` で作る。\n */\nimport type { CosenseStyles } from './extract'\n\nexport const styles: CosenseStyles = {\n \"root\": {\n \"font-family\": \"var(--cosense-font, \\\"Open Sans\\\", Helvetica, Arial, \\\"Hiragino Sans\\\", sans-serif)\",\n \"font-size\": \"var(--cosense-font-size, 15px)\",\n \"line-height\": \"var(--cosense-line-height, 1.87)\",\n \"color\": \"var(--cosense-text, var(--page-text-color, #4a4a4a))\",\n \"background\": \"var(--cosense-bg, var(--page-bg, #fefefe))\",\n \"text-align\": \"left\",\n \"word-wrap\": \"break-word\"\n },\n \"rules\": [\n {\n \"selector\": {\n \"body\": \".title\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0 0 0.77em\",\n \"font-size\": \"1.73em\",\n \"font-weight\": \"700\",\n \"line-height\": \"1.62\",\n \"color\": \"var(--cosense-title, var(--line-title-color, var(--page-text-color, #4a4a4a)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"relative\",\n \"min-height\": \"1em\",\n \"font-variant-ligatures\": \"no-common-ligatures\"\n }\n },\n {\n \"selector\": {\n \"body\": \".indent-mark\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"left\": \"0\",\n \"top\": \"0\",\n \"height\": \"1em\",\n \"color\": \"transparent\"\n }\n },\n {\n \"selector\": {\n \"body\": \".pad\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"width\": \"var(--cosense-indent, 1.5em)\",\n \"height\": \"1em\",\n \"overflow\": \"hidden\"\n }\n },\n {\n \"selector\": {\n \"body\": \".dot\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"right\": \"0.65em\",\n \"top\": \"0.7em\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-block-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"font-size\": \"0.95em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".quote\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"margin\": \"0\",\n \"padding-left\": \"3px\",\n \"border-left\": \"solid 1px #a0a0a0\",\n \"background\": \"var(--cosense-quote-bg, var(--quote-bg-color, rgba(0, 0, 0, 0.05)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0\",\n \"border-collapse\": \"collapse\",\n \"caption-side\": \"top\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".formula\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"auto 6px\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"font-style\": \"italic\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table caption\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"text-align\": \"center\",\n \"font-size\": \"0.9em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 2px 0 8px\",\n \"white-space\": \"nowrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \"img.icon\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"position\": \"relative\",\n \"top\": \"-0.3em\",\n \"height\": \"1.3em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"baseline\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"6\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"7\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"7\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"8\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"8\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"9\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"9\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"10\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"10\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.2em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.44em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.73em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"2.07em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"line-height\": \"1.6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"\\\"\\\"\",\n \"position\": \"absolute\",\n \"top\": \"0.7em\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0) - 1.05em)\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line:has(> .indent-mark)\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"min-height\": \"1.7em\",\n \"line-height\": \"1.7em\",\n \"tab-size\": \"4\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(odd)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.04)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(even)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.06)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin-left\": \"calc(var(--cosense-indent, 1.5em) * -1)\",\n \"padding-left\": \"var(--cosense-indent, 1.5em)\",\n \"white-space\": \"pre-wrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block:not(:has(> .code-start))\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"attr(data-line)\",\n \"top\": \"0\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * (var(--cosense-depth, 1) - 1))\",\n \"width\": \"calc(0.6em + var(--cosense-line-digits, 5) * 1ch)\",\n \"height\": \"auto\",\n \"display\": \"flex\",\n \"justify-content\": \"flex-end\",\n \"white-space\": \"nowrap\",\n \"border-radius\": \"0\",\n \"background\": \"none\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"line-height\": \"1.7em\",\n \"color\": \"var(--cosense-line-number, rgba(0, 0, 0, 0.35))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line] > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(0.6em + (var(--cosense-line-digits, 5) + 1) * 1ch)\"\n }\n }\n ]\n}\n","/**\n * `@cosense-toolbox/tailwind` — `class=\"cosense\"` を付けた要素の中に、Cosense 記法の既定の見た目を当てる。\n * typography の `prose` と同じ使い方をする。\n *\n * ```css\n * @import \"tailwindcss\";\n * @plugin \"@cosense-toolbox/tailwind\";\n * ```\n *\n * 当てるスタイルは `@cosense-toolbox/style` の style.css と同じもの。`cosense-link:underline` のような\n * modifier で、記事の中の特定の記法にだけ utility を当てられる。\n */\nimport plugin, { type PluginAPI } from \"tailwindcss/plugin\"\n\nimport type { Declarations, StyleRule } from \"./extract\"\nimport { type Modifier, MODIFIERS } from \"./modifiers\"\nimport { styles } from \"./styles.generated\"\n\nexport interface CosenseTailwindOptions {\n /**\n * スタイルを当てる class 名。`not-{className}` を付けた要素とその中身には当てない。\n *\n * @defaultValue `'cosense'`\n */\n readonly className?: string\n}\n\ntype Components = Parameters<PluginAPI[\"addComponents\"]>[0]\n\n/** 生成したデータは readonly なので、Tailwind の可変の型に合わせる (中身は書き換えない)。 */\nconst mutable = (declarations: Declarations) => declarations as Record<string, string | string[]>\n\n/**\n * `not-{className}` を付けた要素とその中を除く条件。`:where()` の中なので詳細度を増やさない。\n */\nconst outside = (className: string): string =>\n `:not(:where([class~=\"not-${className}\"],[class~=\"not-${className}\"] *))`\n\n/**\n * 1 つのルールのセレクタ。本文を `:where()` で包み、どのルールも `.cosense` と同じ詳細度にする。\n * 除く条件は擬似要素より前に付ける。\n *\n * 詳細度を揃えるので、ルールどうしの勝ち負けは並び順だけで決まる。生成したデータは元の詳細度の\n * 低い順に並んでいるので、style.css と同じ勝ち負けになる。後ろに出る `cosense-link:` などの\n * modifier や、同じ詳細度の utility が既定のスタイルに勝てるのは、このため。\n */\nconst selectorOf = ({ selector }: StyleRule, className: string): string =>\n `& :where(${selector.body})${outside(className)}${selector.pseudo}`\n\n/**\n * ルールごとに別のオブジェクトにする。1 つのオブジェクトのキーにすると、同じセレクタのルールが\n * 後のもので上書きされてしまうため。Tailwind は並べた順のまま `.cosense` の中に出す。\n */\nconst componentsOf = (className: string): Components => [\n { [`.${className}`]: mutable(styles.root) },\n ...styles.rules.map((rule) => ({\n [`.${className}`]: { [selectorOf(rule, className)]: mutable(rule.declarations) },\n })),\n]\n\n/** `cosense-link:` なら `.cosense-link\\:underline :is(…)` のように、中の対象だけに当てる。 */\nconst modifierOf = (modifier: Modifier, className: string): string =>\n `& :is(:where(${modifier.target})${outside(className)})`\n\n/** class 名に使えない記号を、CSS のセレクタ用にエスケープする。 */\nconst escapeClassChar = (char: string): string => (/[A-Za-z0-9_-]/.test(char) ? char : `\\\\${char}`)\n\n/**\n * `cosense-deco-[|]:` の `[...]` に書いた記号の装飾。`toHtml` は装飾を\n * `<span class=\"decoration deco-|\">` のように記号ごとの class で出すので、それを選ぶ。\n * 記号を並べると (`[-/]`)、それらをすべて持つ装飾に当たる。\n *\n * Tailwind は `[...]` の中の `_` を空白に変える。下線の記号 `_` は `[\\_]` と書く (Tailwind の決まり)。\n */\nconst decorationOf = (markers: string, className: string): string => {\n const classes = [...new Set(markers)].map((marker) => `.deco-${escapeClassChar(marker)}`).join(\"\")\n return `& :is(:where(.decoration${classes})${outside(className)})`\n}\n\n/** Tailwind の型を公開する型定義に書き出せるよう、型を明示する。 */\ntype CosensePlugin = ReturnType<typeof plugin.withOptions<CosenseTailwindOptions>>\n\nconst cosense: CosensePlugin = plugin.withOptions<CosenseTailwindOptions>(\n (options) =>\n ({ addComponents, addVariant, matchVariant }) => {\n const className = options?.className ?? \"cosense\"\n addComponents(componentsOf(className))\n for (const modifier of MODIFIERS) {\n addVariant(`${className}-${modifier.name}`, modifierOf(modifier, className))\n }\n // 記号は `[...]` にそのまま書く (`cosense-deco-[|]:`)。名前を覚えなくて済むようにするため。\n matchVariant(`${className}-deco`, (markers) => decorationOf(markers, className))\n },\n)\n\nexport default cosense\n"],"mappings":";;AAkBA,MAAa,YAAiC;CAC5C;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAc;CAC3D;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAK;CAChD;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAU,QAAQ;EAAU,UAAU;CAAoB;CAClE;EAAE,MAAM;EAAM,QAAQ;EAAM,UAAU;CAAW;CACjD;EAAE,MAAM;EAAK,QAAQ;EAAK,UAAU;CAAa;CACjD;EAAE,MAAM;EAAK,QAAQ;EAAK,UAAU;CAAW;CAC/C;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAiB,QAAQ;EAAkB,UAAU;CAAsB;CACnF;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAW,QAAQ;EAAY,UAAU;CAAQ;CACzD;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAc;CACzD;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAa;CAC1D;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAgB;CAC7D;EAAE,MAAM;EAAM,QAAQ;EAAa,UAAU;CAAO;CACpD;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAK;CAClD;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAiB;CAC5D;EAAE,MAAM;EAAW,QAAQ;EAAY,UAAU;CAAW;AAC9D;;;ACrDA,MAAa,SAAwB;CACnC,QAAQ;EACN,eAAe;EACf,aAAa;EACb,eAAe;EACf,SAAS;EACT,cAAc;EACd,cAAc;EACd,aAAa;CACf;CACA,SAAS;EACP;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,eAAe;IACf,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,YAAY;IACZ,cAAc;IACd,0BAA0B;GAC5B;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,YAAY;IACZ,QAAQ;IACR,OAAO;IACP,UAAU;IACV,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,SAAS;IACT,UAAU;IACV,YAAY;GACd;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,YAAY;IACZ,SAAS;IACT,OAAO;IACP,SAAS;IACT,UAAU;IACV,iBAAiB;IACjB,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,SAAS;IACT,mBAAmB;IACnB,+BAA+B;GACjC;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,SAAS;IACT,mBAAmB;IACnB,+BAA+B;GACjC;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,mBAAmB;IACnB,gBAAgB;GAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,cAAc;IACd,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,UAAU;IACV,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,KACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,gBAAgB,+DAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,QACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,SAAS;IACT,UAAU;IACV,iBAAiB;IACjB,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,WAAW,OACb;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,cAAc;IACd,eAAe;IACf,YAAY;IACZ,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,cAAc,sBAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,cAAc,sBAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,gBAAgB;IAChB,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,yBAAyB,IAC3B;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,yBAAyB,IAC3B;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,yBAAyB,IAC3B;EACF;EACA;GACE,YAAY;IACV,QAAQ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M,GAAG,CAAC,CAAC,KAAK,EACvD,EAAE,GAAG,QAAQ,SAAS,EAAE;AAClE;AAKA,MAAM,UAAyB,OAAO,aACnC,aACE,EAAE,eAAe,YAAY,mBAAmB;CAC/C,MAAM,YAAY,SAAS,aAAa;CACxC,cAAc,aAAa,SAAS,CAAC;CACrC,KAAK,MAAM,YAAY,WACrB,WAAW,GAAG,UAAU,GAAG,SAAS,QAAQ,WAAW,UAAU,SAAS,CAAC;CAG7E,aAAa,GAAG,UAAU,SAAS,YAAY,aAAa,SAAS,SAAS,CAAC;AACjF,CACJ"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/modifiers.ts","../src/styles.generated.ts","../src/index.ts"],"sourcesContent":["/**\n * modifiers.ts — `cosense-link:underline` のように、記事の中の特定の要素にだけ utility を当てる modifier。\n * typography の `prose-a:` にあたる。\n *\n * 対象は HTML の要素名ではなく Cosense の記法で選ぶ。`toHtml` は同じ `<a>` をリンク・タグ・\n * アイコンに使い分けるので、要素名で選ぶと区別できないため。class 名は parser の既定\n * (`defaultClassNames`) に合わせている。\n */\n\nexport interface Modifier {\n /** modifier の名前。`{className}-{name}:` になる */\n readonly name: string\n /** 当てる先のセレクタ。`.cosense` の子孫として探す */\n readonly target: string\n /** 対応する Cosense の記法 (README の表に出す) */\n readonly notation: string\n}\n\nexport const MODIFIERS: readonly Modifier[] = [\n { name: \"title\", target: \".title\", notation: \"タイトル (1 行目)\" },\n { name: \"line\", target: \".line\", notation: \"各行\" },\n {\n name: \"heading\",\n target: \".decoration[data-size-level]\",\n notation: \"`[** 見出し]` などの大きな文字\",\n },\n { name: \"strong\", target: \"strong\", notation: \"`[[太字]]` `[* 太字]`\" },\n { name: \"em\", target: \"em\", notation: \"`[/ 斜体]`\" },\n { name: \"s\", target: \"s\", notation: \"`[- 打ち消し]`\" },\n { name: \"u\", target: \"u\", notation: \"`[_ 下線]`\" },\n {\n name: \"link\",\n target: \".link\",\n notation: \"リンクすべて (`[ページ]` `[https://…]` `[/project/ページ]`)\",\n },\n { name: \"link-external\", target: \".link-external\", notation: \"外部リンク `[https://…]`\" },\n {\n name: \"link-project\",\n target: \".link-project\",\n notation: \"別プロジェクトへのリンク `[/project/ページ]`\",\n },\n { name: \"hashtag\", target: \".hashtag\", notation: \"`#タグ`\" },\n { name: \"code\", target: \".code\", notation: \"`` `コード` ``\" },\n {\n name: \"code-block\",\n target: \".code-block > code\",\n notation: \"`code:ファイル名` のブロックの各行\",\n },\n {\n name: \"code-filename\",\n target: \".code-block-start\",\n notation: \"`code:ファイル名` のファイル名\",\n },\n { name: \"quote\", target: \".quote\", notation: \"`>` で始まる引用\" },\n { name: \"table\", target: \".table\", notation: \"`table:名前` の表\" },\n { name: \"td\", target: \".table td\", notation: \"表のセル\" },\n { name: \"image\", target: \".image\", notation: \"画像\" },\n { name: \"video\", target: \".video\", notation: \"動画\" },\n { name: \"audio\", target: \".audio\", notation: \"音声\" },\n { name: \"embed\", target: \".embed\", notation: \"YouTube などの埋め込み\" },\n { name: \"location\", target: \".link-location\", notation: \"地図 `[N35,E139]`\" },\n { name: \"icon\", target: \".icon\", notation: \"`[ユーザー名.icon]`\" },\n { name: \"formula\", target: \".formula\", notation: \"`[$ 数式]`\" },\n]\n","/**\n * 生成物。編集しない。\n * packages/style/style.css から `bun run generate` で作る。\n */\nimport type { CosenseStyles } from './extract'\n\nexport const styles: CosenseStyles = {\n \"root\": {\n \"font-family\": \"var(--cosense-font, \\\"Open Sans\\\", Helvetica, Arial, \\\"Hiragino Sans\\\", sans-serif)\",\n \"font-size\": \"var(--cosense-font-size, 15px)\",\n \"line-height\": \"var(--cosense-line-height, 1.87)\",\n \"color\": \"var(--cosense-text, var(--page-text-color, #4a4a4a))\",\n \"background\": \"var(--cosense-bg, var(--page-bg, #fefefe))\",\n \"text-align\": \"left\",\n \"word-wrap\": \"break-word\"\n },\n \"rules\": [\n {\n \"selector\": {\n \"body\": \".title\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0 0 0.77em\",\n \"font-size\": \"1.73em\",\n \"font-weight\": \"700\",\n \"line-height\": \"1.62\",\n \"color\": \"var(--cosense-title, var(--line-title-color, var(--page-text-color, #4a4a4a)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"relative\",\n \"min-height\": \"1em\",\n \"font-variant-ligatures\": \"no-common-ligatures\"\n }\n },\n {\n \"selector\": {\n \"body\": \".indent-mark\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"left\": \"0\",\n \"top\": \"0\",\n \"height\": \"1em\",\n \"color\": \"transparent\"\n }\n },\n {\n \"selector\": {\n \"body\": \".pad\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"width\": \"var(--cosense-indent, 1.5em)\",\n \"height\": \"1em\",\n \"overflow\": \"hidden\"\n }\n },\n {\n \"selector\": {\n \"body\": \".dot\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"position\": \"absolute\",\n \"right\": \"0.65em\",\n \"top\": \"0.7em\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link, var(--page-link-color, #3d72f5))\",\n \"text-decoration\": \"none\",\n \"-webkit-tap-highlight-color\": \"rgba(0, 0, 0, 0.2)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"color\": \"var(--cosense-code-text, var(--code-color, #342d9c))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".monospace\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 0.2em\",\n \"border-radius\": \"4px\",\n \"font-size\": \"90%\",\n \"word-wrap\": \"break-word\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".code-block-start\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"font-size\": \"0.95em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".quote\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"margin\": \"0\",\n \"padding-left\": \"3px\",\n \"border-left\": \"solid 1px #a0a0a0\",\n \"background\": \"var(--cosense-quote-bg, var(--quote-bg-color, rgba(0, 0, 0, 0.05)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"0\",\n \"border-collapse\": \"collapse\",\n \"caption-side\": \"top\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".video\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"max-width\": \"100%\",\n \"max-height\": \"300px\",\n \"vertical-align\": \"bottom\"\n }\n },\n {\n \"selector\": {\n \"body\": \".audio\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-flex\",\n \"align-items\": \"center\",\n \"gap\": \"0.5em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"middle\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"width\": \"100%\",\n \"max-width\": \"560px\",\n \"aspect-ratio\": \"16 / 9\",\n \"margin\": \"3px 0\",\n \"border\": \"0\"\n }\n },\n {\n \"selector\": {\n \"body\": \".formula\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"auto 6px\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"font-style\": \"italic\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table caption\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"1px 2px\",\n \"text-align\": \"center\",\n \"font-size\": \"0.9em\",\n \"color\": \"var(--cosense-badge-text, #342d9c)\",\n \"background\": \"var(--cosense-badge-bg, #ffcfc6)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding\": \"0 2px 0 8px\",\n \"white-space\": \"nowrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".audio audio\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"max-width\": \"100%\",\n \"height\": \"2.5em\"\n }\n },\n {\n \"selector\": {\n \"body\": \"img.icon\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"position\": \"relative\",\n \"top\": \"-0.3em\",\n \"height\": \"1.3em\",\n \"max-width\": \"100%\",\n \"vertical-align\": \"baseline\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"6\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"7\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"7\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"8\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"8\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"9\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"9\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent=\\\"10\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-depth\": \"10\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".link:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".hashtag:hover\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"color\": \"var(--cosense-link-hover, var(--page-link-hover-color, #0d4ff3))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".image[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".video[data-large]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin\": \"3px 0\",\n \"max-width\": \"95%\",\n \"max-height\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed[data-provider=\\\"spotify\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"aspect-ratio\": \"auto\",\n \"height\": \"152px\"\n }\n },\n {\n \"selector\": {\n \"body\": \".embed[data-provider=\\\"anchor\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"aspect-ratio\": \"auto\",\n \"height\": \"152px\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.2em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.44em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"1.73em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"font-size\": \"2.07em\"\n }\n },\n {\n \"selector\": {\n \"body\": \".decoration[data-size-level]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"inline-block\",\n \"line-height\": \"1.6\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line[data-indent]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"\\\"\\\"\",\n \"position\": \"absolute\",\n \"top\": \"0.7em\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * var(--cosense-depth, 0) - 1.05em)\",\n \"width\": \"6px\",\n \"height\": \"6px\",\n \"border-radius\": \"50%\",\n \"background\": \"var(--cosense-text, var(--page-text-color, #555))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line:has(> .indent-mark)\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > code\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"display\": \"block\",\n \"min-height\": \"1.7em\",\n \"line-height\": \"1.7em\",\n \"tab-size\": \"4\",\n \"background\": \"var(--cosense-code-bg, var(--code-bg, rgba(0, 0, 0, 0.04)))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(odd)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.04)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".table td:nth-child(even)\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"background\": \"rgba(0, 0, 0, 0.06)\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"margin-left\": \"calc(var(--cosense-indent, 1.5em) * -1)\",\n \"padding-left\": \"var(--cosense-indent, 1.5em)\",\n \"white-space\": \"pre-wrap\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"1\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"1\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"2\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"2\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"3\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"3\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"4\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"4\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line-digits=\\\"5\\\"]\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"--cosense-line-digits\": \"5\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block:not(:has(> .code-start))\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"none\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line]\",\n \"pseudo\": \"::before\"\n },\n \"declarations\": {\n \"content\": \"attr(data-line)\",\n \"top\": \"0\",\n \"left\": \"calc(var(--cosense-indent, 1.5em) * (var(--cosense-depth, 1) - 1))\",\n \"width\": \"calc(0.6em + var(--cosense-line-digits, 5) * 1ch)\",\n \"height\": \"auto\",\n \"display\": \"flex\",\n \"justify-content\": \"flex-end\",\n \"white-space\": \"nowrap\",\n \"border-radius\": \"0\",\n \"background\": \"none\",\n \"font-family\": \"var(--cosense-code-font, ui-monospace, SFMono-Regular, Menlo, monospace)\",\n \"line-height\": \"1.7em\",\n \"color\": \"var(--cosense-line-number, rgba(0, 0, 0, 0.35))\"\n }\n },\n {\n \"selector\": {\n \"body\": \".line.code-block[data-line] > .code-body\",\n \"pseudo\": \"\"\n },\n \"declarations\": {\n \"padding-left\": \"calc(0.6em + (var(--cosense-line-digits, 5) + 1) * 1ch)\"\n }\n }\n ]\n}\n","/**\n * `@cosense-toolbox/tailwind` — `class=\"cosense\"` を付けた要素の中に、Cosense 記法の既定の見た目を当てる。\n * typography の `prose` と同じ使い方をする。\n *\n * ```css\n * @import \"tailwindcss\";\n * @plugin \"@cosense-toolbox/tailwind\";\n * ```\n *\n * 当てるスタイルは `@cosense-toolbox/style` の style.css と同じもの。`cosense-link:underline` のような\n * modifier で、記事の中の特定の記法にだけ utility を当てられる。\n */\nimport plugin, { type PluginAPI } from \"tailwindcss/plugin\"\n\nimport type { Declarations, StyleRule } from \"./extract\"\nimport { type Modifier, MODIFIERS } from \"./modifiers\"\nimport { styles } from \"./styles.generated\"\n\nexport interface CosenseTailwindOptions {\n /**\n * スタイルを当てる class 名。`not-{className}` を付けた要素とその中身には当てない。\n *\n * @defaultValue `'cosense'`\n */\n readonly className?: string\n}\n\ntype Components = Parameters<PluginAPI[\"addComponents\"]>[0]\n\n/** 生成したデータは readonly なので、Tailwind の可変の型に合わせる (中身は書き換えない)。 */\nconst mutable = (declarations: Declarations) => declarations as Record<string, string | string[]>\n\n/**\n * `not-{className}` を付けた要素とその中を除く条件。`:where()` の中なので詳細度を増やさない。\n */\nconst outside = (className: string): string =>\n `:not(:where([class~=\"not-${className}\"],[class~=\"not-${className}\"] *))`\n\n/**\n * 1 つのルールのセレクタ。本文を `:where()` で包み、どのルールも `.cosense` と同じ詳細度にする。\n * 除く条件は擬似要素より前に付ける。\n *\n * 詳細度を揃えるので、ルールどうしの勝ち負けは並び順だけで決まる。生成したデータは元の詳細度の\n * 低い順に並んでいるので、style.css と同じ勝ち負けになる。後ろに出る `cosense-link:` などの\n * modifier や、同じ詳細度の utility が既定のスタイルに勝てるのは、このため。\n */\nconst selectorOf = ({ selector }: StyleRule, className: string): string =>\n `& :where(${selector.body})${outside(className)}${selector.pseudo}`\n\n/**\n * ルールごとに別のオブジェクトにする。1 つのオブジェクトのキーにすると、同じセレクタのルールが\n * 後のもので上書きされてしまうため。Tailwind は並べた順のまま `.cosense` の中に出す。\n */\nconst componentsOf = (className: string): Components => [\n { [`.${className}`]: mutable(styles.root) },\n ...styles.rules.map((rule) => ({\n [`.${className}`]: { [selectorOf(rule, className)]: mutable(rule.declarations) },\n })),\n]\n\n/** `cosense-link:` なら `.cosense-link\\:underline :is(…)` のように、中の対象だけに当てる。 */\nconst modifierOf = (modifier: Modifier, className: string): string =>\n `& :is(:where(${modifier.target})${outside(className)})`\n\n/** class 名に使えない記号を、CSS のセレクタ用にエスケープする。 */\nconst escapeClassChar = (char: string): string => (/[A-Za-z0-9_-]/.test(char) ? char : `\\\\${char}`)\n\n/**\n * `cosense-deco-[|]:` の `[...]` に書いた記号の装飾。`toHtml` は装飾を\n * `<span class=\"decoration deco-|\">` のように記号ごとの class で出すので、それを選ぶ。\n * 記号を並べると (`[-/]`)、それらをすべて持つ装飾に当たる。\n *\n * Tailwind は `[...]` の中の `_` を空白に変える。下線の記号 `_` は `[\\_]` と書く (Tailwind の決まり)。\n */\nconst decorationOf = (markers: string, className: string): string => {\n const classes = [...new Set(markers)].map((marker) => `.deco-${escapeClassChar(marker)}`).join(\"\")\n return `& :is(:where(.decoration${classes})${outside(className)})`\n}\n\n/** Tailwind の型を公開する型定義に書き出せるよう、型を明示する。 */\ntype CosensePlugin = ReturnType<typeof plugin.withOptions<CosenseTailwindOptions>>\n\nconst cosense: CosensePlugin = plugin.withOptions<CosenseTailwindOptions>(\n (options) =>\n ({ addComponents, addVariant, matchVariant }) => {\n const className = options?.className ?? \"cosense\"\n addComponents(componentsOf(className))\n for (const modifier of MODIFIERS) {\n addVariant(`${className}-${modifier.name}`, modifierOf(modifier, className))\n }\n // 記号は `[...]` にそのまま書く (`cosense-deco-[|]:`)。名前を覚えなくて済むようにするため。\n matchVariant(`${className}-deco`, (markers) => decorationOf(markers, className))\n },\n)\n\nexport default cosense\n"],"mappings":";;AAkBA,MAAa,YAAiC;CAC5C;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAc;CAC3D;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAK;CAChD;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAU,QAAQ;EAAU,UAAU;CAAoB;CAClE;EAAE,MAAM;EAAM,QAAQ;EAAM,UAAU;CAAW;CACjD;EAAE,MAAM;EAAK,QAAQ;EAAK,UAAU;CAAa;CACjD;EAAE,MAAM;EAAK,QAAQ;EAAK,UAAU;CAAW;CAC/C;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAiB,QAAQ;EAAkB,UAAU;CAAsB;CACnF;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAW,QAAQ;EAAY,UAAU;CAAQ;CACzD;EAAE,MAAM;EAAQ,QAAQ;EAAS,UAAU;CAAc;CACzD;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EACE,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAa;CAC1D;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU;CAAgB;CAC7D;EAAE,MAAM;EAAM,QAAQ;EAAa,UAAU;CAAO;CACpD;EAAE,MAAM;EAAS,QAAQ;EAAU,UAAU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S;IACT,mBAAmB;IACnB,+BAA+B;GACjC;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,eAAe;IACf,SAAS;GACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,mBAAmB;IACnB,gBAAgB;GAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,aAAa;IACb,cAAc;IACd,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;IACf,OAAO;IACP,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,UAAU;IACV,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,eAAe;IACf,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,cAAc;IACd,aAAa;IACb,SAAS;IACT,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,eAAe;GACjB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,aAAa;IACb,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,WAAW;IACX,YAAY;IACZ,OAAO;IACP,UAAU;IACV,aAAa;IACb,kBAAkB;GACpB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,IACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,mBAAmB,KACrB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,gBAAgB,+DAClB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,SAAS,mEACX;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,UAAU;IACV,aAAa;IACb,cAAc;GAChB;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,gBAAgB;IAChB,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB;IACd,gBAAgB;IAChB,UAAU;GACZ;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,QACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,aAAa,SACf;EACF;EACA;GACE,YAAY;IACV,QAAQ;IACR,UAAU;GACZ;GACA,gBAAgB,EACd,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,YAAY,SAAS,aAAa;CACxC,cAAc,aAAa,SAAS,CAAC;CACrC,KAAK,MAAM,YAAY,WACrB,WAAW,GAAG,UAAU,GAAG,SAAS,QAAQ,WAAW,UAAU,SAAS,CAAC;CAG7E,aAAa,GAAG,UAAU,SAAS,YAAY,aAAa,SAAS,SAAS,CAAC;AACjF,CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosense-toolbox/tailwind",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.7",
|
|
4
4
|
"description": "Tailwind CSS plugin: add class=\"cosense\" and the Cosense notation HTML inside it gets the default look.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"tailwindcss": ">=4.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@cosense-toolbox/parser": "0.1.0-beta.
|
|
48
|
-
"@cosense-toolbox/style": "0.1.0-beta.
|
|
47
|
+
"@cosense-toolbox/parser": "0.1.0-beta.7",
|
|
48
|
+
"@cosense-toolbox/style": "0.1.0-beta.7",
|
|
49
49
|
"@tailwindcss/node": "^4.3.3",
|
|
50
50
|
"effect": "^3.22.1",
|
|
51
51
|
"playwright-core": "^1.56.1",
|