comark-comments 0.8.0 → 0.8.1

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.
Files changed (2) hide show
  1. package/dist/html.mjs +30 -5
  2. package/package.json +3 -3
package/dist/html.mjs CHANGED
@@ -80,6 +80,29 @@ const groups = {
80
80
  "#60a5fa"
81
81
  ]
82
82
  }),
83
+ primary: [
84
+ [
85
+ "primary",
86
+ "ui-primary",
87
+ "primary",
88
+ "var(--_comark-foreground)",
89
+ "var(--_comark-foreground)"
90
+ ],
91
+ [
92
+ "primary-foreground",
93
+ "ui-text-inverted",
94
+ "primary-foreground",
95
+ "var(--_comark-background)",
96
+ "var(--_comark-background)"
97
+ ],
98
+ [
99
+ "secondary",
100
+ "ui-secondary",
101
+ "",
102
+ "var(--_comark-muted)",
103
+ "var(--_comark-muted)"
104
+ ]
105
+ ],
83
106
  shadow: [[
84
107
  "shadow",
85
108
  "",
@@ -100,14 +123,16 @@ const resolve = (list, scheme) => list.map((token) => `--_comark-${token[0]}:${c
100
123
  * They resolve on the component rather than `:root`, so a `.dark` class anywhere above it switches the theme, and a
101
124
  * `--comark-*` set on any ancestor still inherits down. `:where()` keeps them at zero specificity.
102
125
  *
103
- * Every block gets the core tokens. Name `"status"` for `--comark-success`, `-danger`, `-warning`, and `-info`, and
104
- * `"shadow"` for `--comark-shadow`, so a block that never draws them doesn't carry them.
126
+ * Every block gets the core tokens. Name `"status"` for `--comark-success`, `-danger`, `-warning`, and `-info`,
127
+ * `"primary"` for `--comark-primary`, `-primary-foreground`, and `-secondary`, and `"shadow"` for `--comark-shadow`, so
128
+ * a block that never draws them doesn't carry them.
105
129
  */
106
130
  function theme(selector, ...extras) {
107
131
  const where = `:where(${selector})`;
108
132
  const added = extras.flatMap((name) => groups[name]);
109
133
  const list = [...tokens, ...added];
110
- const classes = added.length ? `:where(.light,.light *)${where}{${resolve(added, 3)}}:where(.dark,.dark *)${where}{${resolve(added, 4)}}` : "";
134
+ const schemed = added.filter((token) => token[3] !== token[4]);
135
+ const classes = schemed.length ? `:where(.light,.light *)${where}{${resolve(schemed, 3)}}:where(.dark,.dark *)${where}{${resolve(schemed, 4)}}` : "";
111
136
  return `${where}{${resolve(list, 3)};--_comark-radius:var(--comark-radius,calc(var(--ui-radius,calc(var(--radius,.625rem)/2))*2));--_comark-font:var(--comark-font,var(--font-sans,ui-sans-serif,system-ui,sans-serif))}@media (prefers-color-scheme:dark){${where}{${resolve(list, 4)}}}` + classes;
112
137
  }
113
138
  //#endregion
@@ -150,12 +175,12 @@ const css = `@layer comark{${[
150
175
  ".cr-card{display:none;box-sizing:border-box;padding:.5rem .75rem;border:1px solid var(--_comark-border);border-radius:var(--_comark-radius);background:var(--_comark-background);color:var(--_comark-foreground);font:400 .8125rem/1.5 var(--_comark-font);text-align:left;text-indent:0;white-space:normal;transition:border-color .12s,box-shadow .12s}",
151
176
  ".cr-entry{display:block}.cr-entry+.cr-entry{margin-top:.5rem;padding-top:.5rem;border-top:1px solid var(--_comark-border)}",
152
177
  ".cr-entry b{margin-right:.375rem;font-weight:600}",
153
- ".cr-av{display:inline-grid;place-items:center;width:1.125rem;height:1.125rem;margin-right:.375rem;border-radius:9999px;background:color-mix(in oklab,oklch(.7 .12 var(--cr-hue)) 30%,var(--_comark-background));color:color-mix(in oklab,oklch(.55 .14 var(--cr-hue)) 60%,var(--_comark-foreground));font:600 .5625rem/1 var(--_comark-font);vertical-align:calc(.722cap - .5625rem)}",
178
+ ".cr-av{display:inline-block;overflow:hidden;width:1.125rem;height:1.125rem;margin-right:.375rem;border-radius:9999px;background:color-mix(in oklab,oklch(.7 .12 var(--cr-hue)) 30%,var(--_comark-background));color:color-mix(in oklab,oklch(.55 .14 var(--cr-hue)) 60%,var(--_comark-foreground));font:600 .5625rem/2 var(--_comark-font);text-align:center;vertical-align:calc(.722cap - .5625rem)}",
154
179
  "img.cr-av{display:inline-block;background:#fff;object-fit:cover;outline:1px solid color-mix(in srgb,var(--_comark-foreground) 12%,transparent);outline-offset:-1px}",
155
180
  ".cr-tg:checked+.cr-bub+.cr-card{display:block;float:left;clear:both;width:100%;margin:.5rem 0}",
156
181
  ".cr{container:cr/inline-size;display:flow-root}",
157
182
  "@container cr (min-width:50rem){.cr>*{margin-right:19.5rem!important}.cr-card,.cr-tg:checked+.cr-bub+.cr-card{display:block;position:relative;float:right;clear:right;width:17.5rem;margin:0 -19.5rem .5rem 0}.cr-tg:checked+.cr-bub+.cr-card,.cr-bub:hover+.cr-card,.cr-card:hover{border-color:var(--_comark-ring);box-shadow:var(--_comark-shadow)}}",
158
- "@media print{.cr>*{margin-right:12.5rem!important}.cr-card{display:block!important;float:right!important;clear:right;width:11.5rem!important;margin:0 -12.5rem .375rem 0!important;font-size:.6875rem;box-shadow:none!important}.cr-bub{display:none}}"
183
+ "@media print{.cr>*{margin-right:12.5rem!important}.cr-card{display:block!important;float:right!important;clear:right;width:11.5rem!important;margin:0 -12.5rem .375rem 0!important;font-size:.6875rem;box-shadow:none!important}.cr-av{vertical-align:calc(.611cap - .5625rem)}.cr-bub{display:none}}"
159
184
  ].join("")}}`;
160
185
  //#endregion
161
186
  //#region ../../shared/html.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comark-comments",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Suggested edits and comment threads in Markdown, drawn as redlines or a hand-drawn pen with notes in the margin, and no script. A Comark plugin.",
5
5
  "keywords": [
6
6
  "comark",
@@ -38,8 +38,8 @@
38
38
  "devDependencies": {
39
39
  "@comark/html": "^0.8.1",
40
40
  "comark": "^0.8.1",
41
- "comark-annotate": "0.8.0",
42
- "comark-zoom": "0.8.0"
41
+ "comark-annotate": "0.8.1",
42
+ "comark-zoom": "0.8.1"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@comark/html": "^0.8.0",