@quartz-community/bases-page 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,146 @@
1
+ import { FilterNode } from '../types.js';
2
+ import 'preact';
3
+ import '@quartz-community/types';
4
+
5
+ type Span = {
6
+ start: number;
7
+ end: number;
8
+ };
9
+
10
+ type LiteralValue = string | number | boolean | null;
11
+ type UnaryOperator = "!" | "-";
12
+ type BinaryOperator = "+" | "-" | "*" | "/" | "%" | "==" | "!=" | ">" | "<" | ">=" | "<=" | "&&" | "||";
13
+ type BaseNode = {
14
+ type: string;
15
+ span: Span;
16
+ };
17
+ type LiteralExpression = BaseNode & {
18
+ type: "Literal";
19
+ value: LiteralValue;
20
+ };
21
+ type IdentifierExpression = BaseNode & {
22
+ type: "Identifier";
23
+ name: string;
24
+ };
25
+ type UnaryExpression = BaseNode & {
26
+ type: "Unary";
27
+ operator: UnaryOperator;
28
+ argument: Expression;
29
+ };
30
+ type BinaryExpression = BaseNode & {
31
+ type: "Binary";
32
+ operator: BinaryOperator;
33
+ left: Expression;
34
+ right: Expression;
35
+ };
36
+ type CallExpression = BaseNode & {
37
+ type: "Call";
38
+ callee: Expression;
39
+ args: Expression[];
40
+ };
41
+ type MemberExpression = BaseNode & {
42
+ type: "Member";
43
+ object: Expression;
44
+ property: string;
45
+ };
46
+ type IndexExpression = BaseNode & {
47
+ type: "Index";
48
+ object: Expression;
49
+ index: Expression;
50
+ };
51
+ type ListExpression = BaseNode & {
52
+ type: "List";
53
+ elements: Expression[];
54
+ };
55
+ type Expression = LiteralExpression | IdentifierExpression | UnaryExpression | BinaryExpression | CallExpression | MemberExpression | IndexExpression | ListExpression;
56
+
57
+ type Instruction = {
58
+ type: "Const";
59
+ value: LiteralValue | undefined;
60
+ } | {
61
+ type: "Ident";
62
+ name: string;
63
+ } | {
64
+ type: "LoadFormula";
65
+ name: string;
66
+ } | {
67
+ type: "Member";
68
+ name: string;
69
+ } | {
70
+ type: "Index";
71
+ } | {
72
+ type: "List";
73
+ count: number;
74
+ } | {
75
+ type: "Unary";
76
+ operator: UnaryOperator;
77
+ } | {
78
+ type: "Binary";
79
+ operator: BinaryOperator;
80
+ } | {
81
+ type: "ToBool";
82
+ } | {
83
+ type: "CallGlobal";
84
+ name: string;
85
+ argc: number;
86
+ } | {
87
+ type: "CallMethod";
88
+ name: string;
89
+ argc: number;
90
+ } | {
91
+ type: "CallMethodLazy";
92
+ name: string;
93
+ argPrograms: Instruction[][];
94
+ } | {
95
+ type: "Jump";
96
+ offset: number;
97
+ } | {
98
+ type: "JumpIfFalse";
99
+ offset: number;
100
+ } | {
101
+ type: "JumpIfTrue";
102
+ offset: number;
103
+ };
104
+
105
+ type EvalContext = {
106
+ note: Record<string, unknown>;
107
+ file: {
108
+ name: string;
109
+ basename: string;
110
+ path: string;
111
+ folder: string;
112
+ ext: string;
113
+ tags: string[];
114
+ links: string[];
115
+ embeds?: string[];
116
+ properties?: Record<string, unknown>;
117
+ created?: string | Date;
118
+ modified?: string | Date;
119
+ ctime?: Date;
120
+ mtime?: Date;
121
+ size?: number;
122
+ };
123
+ formula: Record<string, unknown>;
124
+ self?: {
125
+ file: {
126
+ name: string;
127
+ path: string;
128
+ folder: string;
129
+ ext: string;
130
+ };
131
+ };
132
+ _lambdaValue?: unknown;
133
+ _fileLookup?: Map<string, EvalContext["file"]>;
134
+ };
135
+ declare function resolvePropertyValue(path: string, context: EvalContext): unknown;
136
+
137
+ type CompiledExpression = {
138
+ ast: Expression;
139
+ instructions: Instruction[];
140
+ };
141
+
142
+ declare function compile(expression: string): CompiledExpression;
143
+ declare function evaluate(expression: string, context: EvalContext): unknown;
144
+ declare function evaluateFilter(node: FilterNode | undefined, context: EvalContext): boolean;
145
+
146
+ export { type CompiledExpression, type EvalContext, compile, evaluate, evaluateFilter, resolvePropertyValue };
@@ -0,0 +1,7 @@
1
+ import { createRequire } from 'module';
2
+ export { compile, evaluate, evaluateFilter, resolvePropertyValue } from '../chunk-X2AZ5GOJ.js';
3
+ import '../chunk-TDUJOYTU.js';
4
+
5
+ createRequire(import.meta.url);
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,13 @@
1
+ export { _ as BasesBody } from '../BasesBody-B4CEJjEp.js';
2
+ import { ComponentChild } from 'preact';
3
+ import { BasesView } from '../types.js';
4
+ import '@quartz-community/types';
5
+
6
+ interface ViewSelectorProps {
7
+ views: BasesView[];
8
+ activeIndex: number;
9
+ locale: string;
10
+ }
11
+ declare function ViewSelector({ views, activeIndex }: ViewSelectorProps): ComponentChild;
12
+
13
+ export { ViewSelector };
@@ -0,0 +1,9 @@
1
+ import { createRequire } from 'module';
2
+ export { BasesBody_default as BasesBody, ViewSelector } from '../chunk-4HXXKSJ4.js';
3
+ import '../chunk-2AUMER56.js';
4
+ import '../chunk-X2AZ5GOJ.js';
5
+ import '../chunk-TDUJOYTU.js';
6
+
7
+ createRequire(import.meta.url);
8
+ //# sourceMappingURL=index.js.map
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,33 @@
1
+ import { QuartzPageTypePlugin, QuartzTransformerPlugin } from '@quartz-community/types';
2
+ export { PageGenerator, PageMatcher, QuartzComponent, QuartzComponentConstructor, QuartzComponentProps, QuartzPageTypePlugin, QuartzPageTypePluginInstance, QuartzTransformerPlugin, QuartzTransformerPluginInstance, TreeTransform, VirtualPage } from '@quartz-community/types';
3
+ import { BasesPageOptions, BasesData } from './types.js';
4
+ export { BasesEntry, BasesView, FilterNode, GroupBy, PropertyConfig, SortDirection, SummaryType, ViewRenderer, ViewRendererProps, ViewTypeRegistration } from './types.js';
5
+ export { _ as BasesBody } from './BasesBody-B4CEJjEp.js';
6
+ export { registerCustomViews, viewRegistry } from './registry.js';
7
+ export { compile, evaluate, evaluateFilter, resolvePropertyValue } from './compiler/index.js';
8
+ export { FullSlug, RelativeURL, TransformOptions, slugifyPath, transformLink } from '@quartz-community/utils';
9
+ import 'preact';
10
+
11
+ declare const BasesPage: QuartzPageTypePlugin<BasesPageOptions>;
12
+
13
+ /**
14
+ * Rehype plugin that finds ` ```base ` codeblocks in the HAST tree and replaces
15
+ * them with placeholder `<div>` elements. The parsed BasesData for each block is
16
+ * stored on `vfile.data.basesBlocks` so it can be resolved at render time by the
17
+ * tree-transform hook (when `allFiles` is available).
18
+ *
19
+ * Markdown parsers convert fenced code blocks to `<pre><code class="language-base">`.
20
+ * Syntax highlighters (e.g. rehype-pretty-code) may transform this further to
21
+ * `<figure><pre><code data-language="base">` with text wrapped in `<span data-line>`.
22
+ * This plugin detects both patterns, extracts the text content, parses it as YAML
23
+ * via `parseBasesData()`, and replaces the top-level node with a placeholder div.
24
+ */
25
+ declare const BasesTransformer: QuartzTransformerPlugin<Partial<BasesPageOptions>>;
26
+ declare module "vfile" {
27
+ interface DataMap {
28
+ basesBlocks?: BasesData[];
29
+ embeds?: string[];
30
+ }
31
+ }
32
+
33
+ export { BasesData, BasesPage, BasesPageOptions, BasesTransformer };