@riebeckite/plugin-dataview 0.0.5 → 0.0.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/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { DataviewOptions } from "./src/types.js";
2
- export { parseDataview, DataviewParseError } from "./src/parse.js";
3
- export { selectDataviewEntries, evaluateDataviewExpression, matchesDataviewFrom, readDataviewField, toDataviewTime, isTruthy, DataviewEvaluationError, type DataviewGroup, type DataviewScope, type DataviewSelection, } from "./src/evaluate.js";
2
+ export { DataviewEvaluationError, type DataviewGroup, type DataviewScope, type DataviewSelection, evaluateDataviewExpression, isTruthy, matchesDataviewFrom, readDataviewField, selectDataviewEntries, toDataviewTime, } from "./src/evaluate.js";
3
+ export { DataviewParseError, parseDataview } from "./src/parse.js";
4
+ export { createDataviewPlaceholder, createDataviewPlaceholderPattern, DATAVIEW_ATTRIBUTE, } from "./src/placeholder.js";
5
+ export { type RemarkDataviewOptions, remarkDataview } from "./src/remark.js";
4
6
  export { renderDataview, renderDataviewError } from "./src/render.js";
5
- export { remarkDataview, type RemarkDataviewOptions } from "./src/remark.js";
6
- export { DATAVIEW_ATTRIBUTE, createDataviewPlaceholder, createDataviewPlaceholderPattern, } from "./src/placeholder.js";
7
- export { DEFAULT_DATAVIEW_CLASS_NAME, DEFAULT_DATAVIEW_LANGUAGE, resolveDataviewOptions, type DataviewColumn, type DataviewComparisonOperator, type DataviewExpression, type DataviewFrom, type DataviewOptions, type DataviewParseResult, type DataviewQueryType, type DataviewSort, type DataviewSortOrder, type DataviewSource, type DataviewSpec, type ResolvedDataviewOptions, } from "./src/types.js";
7
+ export { type DataviewColumn, type DataviewComparisonOperator, type DataviewExpression, type DataviewFrom, type DataviewOptions, type DataviewParseResult, type DataviewQueryType, type DataviewSort, type DataviewSortOrder, type DataviewSource, type DataviewSpec, DEFAULT_DATAVIEW_CLASS_NAME, DEFAULT_DATAVIEW_LANGUAGE, type ResolvedDataviewOptions, resolveDataviewOptions, } from "./src/types.js";
8
8
  export declare function dataviewPlugin(options?: DataviewOptions): import("@riebeckite/core").RiebeckitePlugin<DataviewOptions>;
9
9
  export declare const dataview: typeof dataviewPlugin;
package/dist/index.js CHANGED
@@ -37,7 +37,9 @@ function parseSpec(source) {
37
37
  const first = lines[firstIndex].trim();
38
38
  const typeMatch = /^([A-Za-z]+)\b(.*)$/.exec(first);
39
39
  if (!typeMatch) {
40
- throw new DataviewParseError("a dataview block must start with a query type.");
40
+ throw new DataviewParseError(
41
+ "a dataview block must start with a query type."
42
+ );
41
43
  }
42
44
  const type = typeMatch[1].toLowerCase();
43
45
  if (!QUERY_TYPES.has(type)) {
@@ -54,7 +56,9 @@ function parseSpec(source) {
54
56
  } else if (type === "list" || type === "calendar") {
55
57
  expression = headText.length > 0 ? headText : null;
56
58
  } else if (headText.length > 0) {
57
- throw new DataviewParseError("TASK does not accept a column or expression list.");
59
+ throw new DataviewParseError(
60
+ "TASK does not accept a column or expression list."
61
+ );
58
62
  }
59
63
  const fromText = takeClause(clauses, "from");
60
64
  const whereText = takeClause(clauses, "where");
@@ -97,11 +101,15 @@ function takeClause(clauses, key) {
97
101
  const matches = clauses.filter((clause) => clause.key === key);
98
102
  if (matches.length === 0) return null;
99
103
  if (matches.length > 1) {
100
- throw new DataviewParseError(`the \`${key.toUpperCase()}\` clause appears more than once.`);
104
+ throw new DataviewParseError(
105
+ `the \`${key.toUpperCase()}\` clause appears more than once.`
106
+ );
101
107
  }
102
108
  const text = matches[0].lines.join(" ").trim();
103
109
  if (text.length === 0) {
104
- throw new DataviewParseError(`the \`${key.toUpperCase()}\` clause is empty.`);
110
+ throw new DataviewParseError(
111
+ `the \`${key.toUpperCase()}\` clause is empty.`
112
+ );
105
113
  }
106
114
  return text;
107
115
  }
@@ -139,7 +147,9 @@ function parseSort(text) {
139
147
  function parseLimit(text) {
140
148
  const match = /^(\d+)$/.exec(text.trim());
141
149
  if (!match) {
142
- throw new DataviewParseError(`LIMIT expects a non-negative integer, received \`${text}\`.`);
150
+ throw new DataviewParseError(
151
+ `LIMIT expects a non-negative integer, received \`${text}\`.`
152
+ );
143
153
  }
144
154
  return Number(match[1]);
145
155
  }
@@ -981,7 +991,8 @@ function renderCalendar(selection, spec, options) {
981
991
  const byDay = /* @__PURE__ */ new Map();
982
992
  for (const item of dated) {
983
993
  const date = new Date(item.time);
984
- if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month) continue;
994
+ if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month)
995
+ continue;
985
996
  const day = date.getUTCDate();
986
997
  const bucket = byDay.get(day) ?? [];
987
998
  bucket.push(item.entry);
@@ -1129,7 +1140,12 @@ function createDataviewRuntime(options = {}) {
1129
1140
  if (!entry.html.includes(DATAVIEW_ATTRIBUTE) && !entry.html.includes(DATAVIEWJS_MARKER)) {
1130
1141
  continue;
1131
1142
  }
1132
- const html = replacePlaceholders(entry, manifest, resolved, diagnostics);
1143
+ const html = replacePlaceholders(
1144
+ entry,
1145
+ manifest,
1146
+ resolved,
1147
+ diagnostics
1148
+ );
1133
1149
  if (html === entry.html) continue;
1134
1150
  entry.html = html;
1135
1151
  const content = tracked.get(entry.slug);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-dataview",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "@types/mdast": "^4.0.4",
19
19
  "unist-util-visit": "^5.1.0",
20
- "@riebeckite/core": "0.0.5"
20
+ "@riebeckite/core": "0.0.7"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public"
package/style.css CHANGED
@@ -1,192 +1,192 @@
1
- .rb-dataview {
2
- --rb-dataview-ink: var(--rb-color-ink, #000000);
3
- --rb-dataview-paper: var(--rb-color-paper, #ffffff);
4
- --rb-dataview-muted: var(--rb-color-muted, #69645c);
5
- --rb-dataview-accent: var(--rb-color-accent, #686868);
6
- --rb-dataview-rule: var(
7
- --rb-color-border,
8
- color-mix(in srgb, var(--rb-dataview-ink) 18%, transparent)
9
- );
10
- --rb-dataview-surface: color-mix(
11
- in srgb,
12
- var(--rb-dataview-paper) 94%,
13
- var(--rb-dataview-ink)
14
- );
15
-
16
- margin: 1.5rem 0;
17
- color: var(--rb-dataview-ink);
18
- }
19
-
20
- .rb-dataview__table,
21
- .rb-dataview__calendar {
22
- width: 100%;
23
- border-collapse: collapse;
24
- font-size: 0.9375rem;
25
- }
26
-
27
- .rb-dataview__heading,
28
- .rb-dataview__calendar-weekday {
29
- padding: 0.5rem 0.75rem;
30
- border-bottom: 1px solid var(--rb-dataview-ink);
31
- text-align: left;
32
- font-weight: 700;
33
- }
34
-
35
- .rb-dataview__cell,
36
- .rb-dataview__calendar-cell {
37
- padding: 0.5rem 0.75rem;
38
- vertical-align: top;
39
- }
40
-
41
- .rb-dataview__row:not(:last-child) .rb-dataview__cell {
42
- border-bottom: 1px solid var(--rb-dataview-rule);
43
- }
44
-
45
- .rb-dataview__group {
46
- margin: 1rem 0 0.25rem;
47
- font-size: 0.8125rem;
48
- font-weight: 700;
49
- letter-spacing: 0.04em;
50
- text-transform: uppercase;
51
- color: var(--rb-dataview-muted);
52
- }
53
-
54
- .rb-dataview__group-cell {
55
- padding: 0.5rem 0.75rem;
56
- border-bottom: 1px solid var(--rb-dataview-ink);
57
- text-align: left;
58
- font-weight: 700;
59
- }
60
-
61
- .rb-dataview__link {
62
- color: inherit;
63
- text-decoration: underline;
64
- text-decoration-color: var(--rb-dataview-rule);
65
- text-underline-offset: 0.2em;
66
- }
67
-
68
- .rb-dataview__link:hover,
69
- .rb-dataview__link:focus-visible {
70
- text-decoration-color: var(--rb-dataview-accent);
71
- }
72
-
73
- .rb-dataview__tag {
74
- display: inline-block;
75
- margin-right: 0.25rem;
76
- color: var(--rb-dataview-muted);
77
- font-size: 0.8125em;
78
- white-space: nowrap;
79
- }
80
-
81
- .rb-dataview__list,
82
- .rb-dataview__tasks {
83
- margin: 0;
84
- padding: 0;
85
- list-style: none;
86
- }
87
-
88
- .rb-dataview__item,
89
- .rb-dataview__task {
90
- display: flex;
91
- flex-wrap: wrap;
92
- gap: 0.5rem;
93
- align-items: baseline;
94
- padding: 0.5rem 0;
95
- border-bottom: 1px solid var(--rb-dataview-rule);
96
- }
97
-
98
- .rb-dataview__item:last-child,
99
- .rb-dataview__task:last-child {
100
- border-bottom: 0;
101
- }
102
-
103
- .rb-dataview__meta {
104
- color: var(--rb-dataview-muted);
105
- font-size: 0.8125em;
106
- }
107
-
108
- .rb-dataview__task[data-task="x"] .rb-dataview__task-text {
109
- color: var(--rb-dataview-muted);
110
- text-decoration: line-through;
111
- }
112
-
113
- .rb-dataview__task::before {
114
- content: "☐";
115
- color: var(--rb-dataview-muted);
116
- }
117
-
118
- .rb-dataview__task[data-task="x"]::before {
119
- content: "☑";
120
- }
121
-
122
- .rb-dataview__task-link {
123
- color: var(--rb-dataview-muted);
124
- font-size: 0.8125em;
125
- text-decoration: underline;
126
- text-underline-offset: 0.2em;
127
- }
128
-
129
- .rb-dataview__calendar-caption {
130
- padding-bottom: 0.5rem;
131
- text-align: left;
132
- font-weight: 700;
133
- }
134
-
135
- .rb-dataview__calendar-cell {
136
- border: 1px solid var(--rb-dataview-rule);
137
- min-width: 4rem;
138
- height: 4rem;
139
- }
140
-
141
- .rb-dataview__calendar-cell--empty {
142
- background: var(--rb-dataview-surface);
143
- }
144
-
145
- .rb-dataview__calendar-day {
146
- display: block;
147
- font-size: 0.75rem;
148
- color: var(--rb-dataview-muted);
149
- }
150
-
151
- .rb-dataview__calendar-links {
152
- display: block;
153
- font-size: 0.8125rem;
154
- }
155
-
156
- .rb-dataview__empty {
157
- margin: 1.5rem 0;
158
- color: var(--rb-dataview-muted);
159
- font-style: italic;
160
- }
161
-
162
- .rb-dataview__fallback {
163
- margin-top: 0.75rem;
164
- color: var(--rb-dataview-muted);
165
- font-size: 0.8125rem;
166
- }
167
-
168
- .rb-dataview__fallback-summary {
169
- cursor: pointer;
170
- }
171
-
172
- .rb-dataview__fallback-code {
173
- overflow-x: auto;
174
- margin: 0.5rem 0 0;
175
- padding: 0.75rem 1rem;
176
- border: 1px solid var(--rb-dataview-rule);
177
- background: var(--rb-dataview-surface);
178
- }
179
-
180
- .rb-dataview--error {
181
- margin: 1.5rem 0;
182
- padding: 0.75rem 1rem;
183
- border: 1px solid var(--rb-dataview-ink);
184
- background: var(--rb-dataview-surface);
185
- font-size: 0.875rem;
186
- }
187
-
188
- html[data-theme="dark"] .rb-dataview,
189
- html.dark .rb-dataview {
190
- --rb-dataview-ink: var(--rb-color-paper, #ffffff);
191
- --rb-dataview-paper: var(--rb-color-ink, #000000);
192
- }
1
+ .rb-dataview {
2
+ --rb-dataview-ink: var(--rb-color-ink, #000000);
3
+ --rb-dataview-paper: var(--rb-color-paper, #ffffff);
4
+ --rb-dataview-muted: var(--rb-color-muted, #69645c);
5
+ --rb-dataview-accent: var(--rb-color-accent, #686868);
6
+ --rb-dataview-rule: var(
7
+ --rb-color-border,
8
+ color-mix(in srgb, var(--rb-dataview-ink) 18%, transparent)
9
+ );
10
+ --rb-dataview-surface: color-mix(
11
+ in srgb,
12
+ var(--rb-dataview-paper) 94%,
13
+ var(--rb-dataview-ink)
14
+ );
15
+
16
+ margin: 1.5rem 0;
17
+ color: var(--rb-dataview-ink);
18
+ }
19
+
20
+ .rb-dataview__table,
21
+ .rb-dataview__calendar {
22
+ width: 100%;
23
+ border-collapse: collapse;
24
+ font-size: 0.9375rem;
25
+ }
26
+
27
+ .rb-dataview__heading,
28
+ .rb-dataview__calendar-weekday {
29
+ padding: 0.5rem 0.75rem;
30
+ border-bottom: 1px solid var(--rb-dataview-ink);
31
+ text-align: left;
32
+ font-weight: 700;
33
+ }
34
+
35
+ .rb-dataview__cell,
36
+ .rb-dataview__calendar-cell {
37
+ padding: 0.5rem 0.75rem;
38
+ vertical-align: top;
39
+ }
40
+
41
+ .rb-dataview__row:not(:last-child) .rb-dataview__cell {
42
+ border-bottom: 1px solid var(--rb-dataview-rule);
43
+ }
44
+
45
+ .rb-dataview__group {
46
+ margin: 1rem 0 0.25rem;
47
+ font-size: 0.8125rem;
48
+ font-weight: 700;
49
+ letter-spacing: 0.04em;
50
+ text-transform: uppercase;
51
+ color: var(--rb-dataview-muted);
52
+ }
53
+
54
+ .rb-dataview__group-cell {
55
+ padding: 0.5rem 0.75rem;
56
+ border-bottom: 1px solid var(--rb-dataview-ink);
57
+ text-align: left;
58
+ font-weight: 700;
59
+ }
60
+
61
+ .rb-dataview__link {
62
+ color: inherit;
63
+ text-decoration: underline;
64
+ text-decoration-color: var(--rb-dataview-rule);
65
+ text-underline-offset: 0.2em;
66
+ }
67
+
68
+ .rb-dataview__link:hover,
69
+ .rb-dataview__link:focus-visible {
70
+ text-decoration-color: var(--rb-dataview-accent);
71
+ }
72
+
73
+ .rb-dataview__tag {
74
+ display: inline-block;
75
+ margin-right: 0.25rem;
76
+ color: var(--rb-dataview-muted);
77
+ font-size: 0.8125em;
78
+ white-space: nowrap;
79
+ }
80
+
81
+ .rb-dataview__list,
82
+ .rb-dataview__tasks {
83
+ margin: 0;
84
+ padding: 0;
85
+ list-style: none;
86
+ }
87
+
88
+ .rb-dataview__item,
89
+ .rb-dataview__task {
90
+ display: flex;
91
+ flex-wrap: wrap;
92
+ gap: 0.5rem;
93
+ align-items: baseline;
94
+ padding: 0.5rem 0;
95
+ border-bottom: 1px solid var(--rb-dataview-rule);
96
+ }
97
+
98
+ .rb-dataview__item:last-child,
99
+ .rb-dataview__task:last-child {
100
+ border-bottom: 0;
101
+ }
102
+
103
+ .rb-dataview__meta {
104
+ color: var(--rb-dataview-muted);
105
+ font-size: 0.8125em;
106
+ }
107
+
108
+ .rb-dataview__task[data-task="x"] .rb-dataview__task-text {
109
+ color: var(--rb-dataview-muted);
110
+ text-decoration: line-through;
111
+ }
112
+
113
+ .rb-dataview__task::before {
114
+ content: "☐";
115
+ color: var(--rb-dataview-muted);
116
+ }
117
+
118
+ .rb-dataview__task[data-task="x"]::before {
119
+ content: "☑";
120
+ }
121
+
122
+ .rb-dataview__task-link {
123
+ color: var(--rb-dataview-muted);
124
+ font-size: 0.8125em;
125
+ text-decoration: underline;
126
+ text-underline-offset: 0.2em;
127
+ }
128
+
129
+ .rb-dataview__calendar-caption {
130
+ padding-bottom: 0.5rem;
131
+ text-align: left;
132
+ font-weight: 700;
133
+ }
134
+
135
+ .rb-dataview__calendar-cell {
136
+ border: 1px solid var(--rb-dataview-rule);
137
+ min-width: 4rem;
138
+ height: 4rem;
139
+ }
140
+
141
+ .rb-dataview__calendar-cell--empty {
142
+ background: var(--rb-dataview-surface);
143
+ }
144
+
145
+ .rb-dataview__calendar-day {
146
+ display: block;
147
+ font-size: 0.75rem;
148
+ color: var(--rb-dataview-muted);
149
+ }
150
+
151
+ .rb-dataview__calendar-links {
152
+ display: block;
153
+ font-size: 0.8125rem;
154
+ }
155
+
156
+ .rb-dataview__empty {
157
+ margin: 1.5rem 0;
158
+ color: var(--rb-dataview-muted);
159
+ font-style: italic;
160
+ }
161
+
162
+ .rb-dataview__fallback {
163
+ margin-top: 0.75rem;
164
+ color: var(--rb-dataview-muted);
165
+ font-size: 0.8125rem;
166
+ }
167
+
168
+ .rb-dataview__fallback-summary {
169
+ cursor: pointer;
170
+ }
171
+
172
+ .rb-dataview__fallback-code {
173
+ overflow-x: auto;
174
+ margin: 0.5rem 0 0;
175
+ padding: 0.75rem 1rem;
176
+ border: 1px solid var(--rb-dataview-rule);
177
+ background: var(--rb-dataview-surface);
178
+ }
179
+
180
+ .rb-dataview--error {
181
+ margin: 1.5rem 0;
182
+ padding: 0.75rem 1rem;
183
+ border: 1px solid var(--rb-dataview-ink);
184
+ background: var(--rb-dataview-surface);
185
+ font-size: 0.875rem;
186
+ }
187
+
188
+ html[data-theme="dark"] .rb-dataview,
189
+ html.dark .rb-dataview {
190
+ --rb-dataview-ink: var(--rb-color-paper, #ffffff);
191
+ --rb-dataview-paper: var(--rb-color-ink, #000000);
192
+ }