@bitcobblers/wod-wiki-core 0.50.2188 → 0.50.2190
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.cjs +192 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -7
- package/dist/index.d.ts +52 -7
- package/dist/index.mjs +182 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1904,18 +1904,63 @@ type FrontmatterPatchValue = string | number | readonly string[] | null;
|
|
|
1904
1904
|
* parent block. Unpatchable input (empty path, invalid key) returns `raw`.
|
|
1905
1905
|
*/
|
|
1906
1906
|
declare function patchFrontmatterProperty(raw: string, path: readonly string[], value: FrontmatterPatchValue): string;
|
|
1907
|
+
interface ParsedFrontmatter {
|
|
1908
|
+
meta: Record<string, string | number | string[]>;
|
|
1909
|
+
body: string;
|
|
1910
|
+
}
|
|
1911
|
+
interface TypedTagItem {
|
|
1912
|
+
label: string;
|
|
1913
|
+
type?: string;
|
|
1914
|
+
}
|
|
1915
|
+
interface LinkWidget {
|
|
1916
|
+
kind: 'youtube' | 'amazon' | 'strava' | 'source' | 'website' | 'book';
|
|
1917
|
+
url?: string;
|
|
1918
|
+
label: string;
|
|
1919
|
+
videoId?: string;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Parse the leading YAML frontmatter block of a markdown string.
|
|
1923
|
+
*/
|
|
1924
|
+
declare function parseFrontmatter(raw: string): ParsedFrontmatter;
|
|
1925
|
+
/**
|
|
1926
|
+
* Parse frontmatter body content (the lines between the `---` delimiters).
|
|
1927
|
+
*/
|
|
1928
|
+
declare function parseFrontmatterBody(innerContent: string): ParsedFrontmatter['meta'];
|
|
1929
|
+
/**
|
|
1930
|
+
* Serialize frontmatter metadata back to YAML body lines (no `---` delimiters).
|
|
1931
|
+
*/
|
|
1932
|
+
declare function serializeFrontmatter(meta: ParsedFrontmatter['meta']): string;
|
|
1933
|
+
/** Body of `raw` with the leading frontmatter block removed. */
|
|
1934
|
+
declare function stripFrontmatter(raw: string): string;
|
|
1935
|
+
/** Scalar value at `key`, or `undefined` when absent or a list. */
|
|
1936
|
+
declare function getScalar(meta: ParsedFrontmatter['meta'], key: string): string | number | undefined;
|
|
1937
|
+
/** List value at `key`, or `[]` when absent or a scalar. */
|
|
1938
|
+
declare function getList(meta: ParsedFrontmatter['meta'], key: string): string[];
|
|
1939
|
+
/** Parse the `category` YAML array from a full markdown string's frontmatter. */
|
|
1940
|
+
declare function parseFrontmatterCategories(raw: string): string[];
|
|
1941
|
+
/** Extract the `tags` (or fallback `category`) list from frontmatter raw content. */
|
|
1942
|
+
declare function extractFrontmatterTags(raw: string): string[];
|
|
1943
|
+
/**
|
|
1944
|
+
* Extract both general tags (`tags:` / `category:`) and typed tags
|
|
1945
|
+
* whose frontmatter keys match any known registered tag type name.
|
|
1946
|
+
*/
|
|
1947
|
+
declare function extractTypedFrontmatterTags(raw: string, knownTypeNames?: string[]): TypedTagItem[];
|
|
1948
|
+
/** Parse flat scalar key-value pairs from raw inner content (no delimiters). */
|
|
1949
|
+
declare function parseFlatProperties(innerContent: string): Record<string, string>;
|
|
1950
|
+
/** Parse scalar key-value pairs from an array of lines. */
|
|
1951
|
+
declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
1907
1952
|
|
|
1908
1953
|
/**
|
|
1909
1954
|
* Auto-generated build version metadata.
|
|
1910
1955
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
1911
1956
|
*/
|
|
1912
|
-
declare const VERSION = "0.50.
|
|
1913
|
-
declare const GIT_SHA = "
|
|
1914
|
-
declare const BUILD_TIME = "2026-11-
|
|
1957
|
+
declare const VERSION = "0.50.2190";
|
|
1958
|
+
declare const GIT_SHA = "9ee7872";
|
|
1959
|
+
declare const BUILD_TIME = "2026-11-01T23:32:46.829Z";
|
|
1915
1960
|
declare const SEMVER: {
|
|
1916
|
-
readonly version: "0.50.
|
|
1917
|
-
readonly gitSha: "
|
|
1918
|
-
readonly buildTime: "2026-11-
|
|
1961
|
+
readonly version: "0.50.2190";
|
|
1962
|
+
readonly gitSha: "9ee7872";
|
|
1963
|
+
readonly buildTime: "2026-11-01T23:32:46.829Z";
|
|
1919
1964
|
};
|
|
1920
1965
|
|
|
1921
|
-
export { type AnalyticsDataPoint, type AnalyticsGraphConfig, type AnalyticsGroup, type Attachment, BUILD_TIME, BUILTIN_NOTEBOOKS, type BlockEffort, type BlockEquipment, type BlockIndexRow, BlockKey, type BlockRevision, type BuiltinNotebookSpec, type CatalogBackfillState, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, type DefaultNotebookSlug, type DialectAnalysis, type DimensionKey, type DisplayStatus, type EventGrain, type EventRecord, type FeedId, type FeedOrigin, type FenceDialect, type FieldCatalogEntry, type FieldContribution, type FieldLeaf, type FieldRef, type FieldSourceRecord, type FieldValueKind, type FieldValueRecord, type FrontMatterSubtype, type FrontmatterPatchValue, GIT_SHA, type IBlockKey, type ICodeMetadata, type ICodeStatement, type IDialect, type IDialectTagDescriptor, type IMetric, type IMetricOwnershipResolver, type IMetricSource, type IOutputStatement, type IScript, type ITagSource, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, METRIC_OWNERSHIP_LAYER_CHAIN, type Membership, Metric, type MetricAction, MetricContainer, type MetricFilter, type MetricOrigin, type MetricOwnershipLayer, type MetricOwnershipLedger, type MetricOwnershipOutcome, type MetricOwnershipPromotionCandidate, type MetricOwnershipQuery, type MetricOwnershipResolvedContribution, type MetricOwnershipTypeExplanation, type MetricTemporal, MetricType, type MetricWithOptionalOwnershipLayer, NOTEBOOK_TAG_PREFIX, type Note, type NoteBlock, type NoteBlockChange, type NoteBlockKind, type NoteKind, type NotePlacement, type NoteTag, type Notebook, type NotebookId, type NotebookOrigin, type NullValueKind, type Origin, OutputStatement, type OutputStatementOptions, type OutputStatementType, OwnershipResolver, type Page, type PageNote, type PageTarget, type ParseError, ParsedCodeStatement, type PlacementProjection, REFERENCE_METADATA_KEY, type ReconcileNoteBlocksOptions, type ReducerStats, type ReferenceDiagnostic, type ReferenceDiagnosticReason, type ReferenceKind, type ReferenceMatchKind, type ReferenceMetadata, type ReferenceRef, type ResultOrigin, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, type ScriptBlock, type ScriptBlockState, type Section, type SectionDocument, type SectionRecognitionOptions, type SectionType, type Segment, type Session, type StoredOutputStatement, type SummaryCoverage, TAG_REFERENCE_METADATA_KEY, type Tag, type TagContribution, type TagDefinition, type TagFunctionContribution, type TagIndex, type TagMetricContribution, type TagReferenceMetadata, type TagTagContribution, type TagType, type TagTypeRecord, type TimeSpan, UNIT_CATALOG, UnitConversionError, type UnitDefinition, type UnitErrorCode, VALID_FENCE_DIALECTS, VERSION, type VisualizerFilter, type VisualizerSize, type WorkoutResults, type WorkoutSectionType, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getMetricOwnershipLayer, getReferenceMetadata, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
|
1966
|
+
export { type AnalyticsDataPoint, type AnalyticsGraphConfig, type AnalyticsGroup, type Attachment, BUILD_TIME, BUILTIN_NOTEBOOKS, type BlockEffort, type BlockEquipment, type BlockIndexRow, BlockKey, type BlockRevision, type BuiltinNotebookSpec, type CatalogBackfillState, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, type DefaultNotebookSlug, type DialectAnalysis, type DimensionKey, type DisplayStatus, type EventGrain, type EventRecord, type FeedId, type FeedOrigin, type FenceDialect, type FieldCatalogEntry, type FieldContribution, type FieldLeaf, type FieldRef, type FieldSourceRecord, type FieldValueKind, type FieldValueRecord, type FrontMatterSubtype, type FrontmatterPatchValue, GIT_SHA, type IBlockKey, type ICodeMetadata, type ICodeStatement, type IDialect, type IDialectTagDescriptor, type IMetric, type IMetricOwnershipResolver, type IMetricSource, type IOutputStatement, type IScript, type ITagSource, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, type LinkWidget, METRIC_OWNERSHIP_LAYER_CHAIN, type Membership, Metric, type MetricAction, MetricContainer, type MetricFilter, type MetricOrigin, type MetricOwnershipLayer, type MetricOwnershipLedger, type MetricOwnershipOutcome, type MetricOwnershipPromotionCandidate, type MetricOwnershipQuery, type MetricOwnershipResolvedContribution, type MetricOwnershipTypeExplanation, type MetricTemporal, MetricType, type MetricWithOptionalOwnershipLayer, NOTEBOOK_TAG_PREFIX, type Note, type NoteBlock, type NoteBlockChange, type NoteBlockKind, type NoteKind, type NotePlacement, type NoteTag, type Notebook, type NotebookId, type NotebookOrigin, type NullValueKind, type Origin, OutputStatement, type OutputStatementOptions, type OutputStatementType, OwnershipResolver, type Page, type PageNote, type PageTarget, type ParseError, ParsedCodeStatement, type ParsedFrontmatter, type PlacementProjection, REFERENCE_METADATA_KEY, type ReconcileNoteBlocksOptions, type ReducerStats, type ReferenceDiagnostic, type ReferenceDiagnosticReason, type ReferenceKind, type ReferenceMatchKind, type ReferenceMetadata, type ReferenceRef, type ResultOrigin, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, type ScriptBlock, type ScriptBlockState, type Section, type SectionDocument, type SectionRecognitionOptions, type SectionType, type Segment, type Session, type StoredOutputStatement, type SummaryCoverage, TAG_REFERENCE_METADATA_KEY, type Tag, type TagContribution, type TagDefinition, type TagFunctionContribution, type TagIndex, type TagMetricContribution, type TagReferenceMetadata, type TagTagContribution, type TagType, type TagTypeRecord, type TimeSpan, type TypedTagItem, UNIT_CATALOG, UnitConversionError, type UnitDefinition, type UnitErrorCode, VALID_FENCE_DIALECTS, VERSION, type VisualizerFilter, type VisualizerSize, type WorkoutResults, type WorkoutSectionType, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, extractFrontmatterTags, extractTypedFrontmatterTags, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getList, getMetricOwnershipLayer, getReferenceMetadata, getScalar, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, serializeFrontmatter, stripFrontmatter, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
package/dist/index.d.ts
CHANGED
|
@@ -1904,18 +1904,63 @@ type FrontmatterPatchValue = string | number | readonly string[] | null;
|
|
|
1904
1904
|
* parent block. Unpatchable input (empty path, invalid key) returns `raw`.
|
|
1905
1905
|
*/
|
|
1906
1906
|
declare function patchFrontmatterProperty(raw: string, path: readonly string[], value: FrontmatterPatchValue): string;
|
|
1907
|
+
interface ParsedFrontmatter {
|
|
1908
|
+
meta: Record<string, string | number | string[]>;
|
|
1909
|
+
body: string;
|
|
1910
|
+
}
|
|
1911
|
+
interface TypedTagItem {
|
|
1912
|
+
label: string;
|
|
1913
|
+
type?: string;
|
|
1914
|
+
}
|
|
1915
|
+
interface LinkWidget {
|
|
1916
|
+
kind: 'youtube' | 'amazon' | 'strava' | 'source' | 'website' | 'book';
|
|
1917
|
+
url?: string;
|
|
1918
|
+
label: string;
|
|
1919
|
+
videoId?: string;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Parse the leading YAML frontmatter block of a markdown string.
|
|
1923
|
+
*/
|
|
1924
|
+
declare function parseFrontmatter(raw: string): ParsedFrontmatter;
|
|
1925
|
+
/**
|
|
1926
|
+
* Parse frontmatter body content (the lines between the `---` delimiters).
|
|
1927
|
+
*/
|
|
1928
|
+
declare function parseFrontmatterBody(innerContent: string): ParsedFrontmatter['meta'];
|
|
1929
|
+
/**
|
|
1930
|
+
* Serialize frontmatter metadata back to YAML body lines (no `---` delimiters).
|
|
1931
|
+
*/
|
|
1932
|
+
declare function serializeFrontmatter(meta: ParsedFrontmatter['meta']): string;
|
|
1933
|
+
/** Body of `raw` with the leading frontmatter block removed. */
|
|
1934
|
+
declare function stripFrontmatter(raw: string): string;
|
|
1935
|
+
/** Scalar value at `key`, or `undefined` when absent or a list. */
|
|
1936
|
+
declare function getScalar(meta: ParsedFrontmatter['meta'], key: string): string | number | undefined;
|
|
1937
|
+
/** List value at `key`, or `[]` when absent or a scalar. */
|
|
1938
|
+
declare function getList(meta: ParsedFrontmatter['meta'], key: string): string[];
|
|
1939
|
+
/** Parse the `category` YAML array from a full markdown string's frontmatter. */
|
|
1940
|
+
declare function parseFrontmatterCategories(raw: string): string[];
|
|
1941
|
+
/** Extract the `tags` (or fallback `category`) list from frontmatter raw content. */
|
|
1942
|
+
declare function extractFrontmatterTags(raw: string): string[];
|
|
1943
|
+
/**
|
|
1944
|
+
* Extract both general tags (`tags:` / `category:`) and typed tags
|
|
1945
|
+
* whose frontmatter keys match any known registered tag type name.
|
|
1946
|
+
*/
|
|
1947
|
+
declare function extractTypedFrontmatterTags(raw: string, knownTypeNames?: string[]): TypedTagItem[];
|
|
1948
|
+
/** Parse flat scalar key-value pairs from raw inner content (no delimiters). */
|
|
1949
|
+
declare function parseFlatProperties(innerContent: string): Record<string, string>;
|
|
1950
|
+
/** Parse scalar key-value pairs from an array of lines. */
|
|
1951
|
+
declare function parseFrontmatterProps(lines: string[]): Record<string, string>;
|
|
1907
1952
|
|
|
1908
1953
|
/**
|
|
1909
1954
|
* Auto-generated build version metadata.
|
|
1910
1955
|
* Do not edit directly; updated by scripts/stamp-version.ts
|
|
1911
1956
|
*/
|
|
1912
|
-
declare const VERSION = "0.50.
|
|
1913
|
-
declare const GIT_SHA = "
|
|
1914
|
-
declare const BUILD_TIME = "2026-11-
|
|
1957
|
+
declare const VERSION = "0.50.2190";
|
|
1958
|
+
declare const GIT_SHA = "9ee7872";
|
|
1959
|
+
declare const BUILD_TIME = "2026-11-01T23:32:46.829Z";
|
|
1915
1960
|
declare const SEMVER: {
|
|
1916
|
-
readonly version: "0.50.
|
|
1917
|
-
readonly gitSha: "
|
|
1918
|
-
readonly buildTime: "2026-11-
|
|
1961
|
+
readonly version: "0.50.2190";
|
|
1962
|
+
readonly gitSha: "9ee7872";
|
|
1963
|
+
readonly buildTime: "2026-11-01T23:32:46.829Z";
|
|
1919
1964
|
};
|
|
1920
1965
|
|
|
1921
|
-
export { type AnalyticsDataPoint, type AnalyticsGraphConfig, type AnalyticsGroup, type Attachment, BUILD_TIME, BUILTIN_NOTEBOOKS, type BlockEffort, type BlockEquipment, type BlockIndexRow, BlockKey, type BlockRevision, type BuiltinNotebookSpec, type CatalogBackfillState, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, type DefaultNotebookSlug, type DialectAnalysis, type DimensionKey, type DisplayStatus, type EventGrain, type EventRecord, type FeedId, type FeedOrigin, type FenceDialect, type FieldCatalogEntry, type FieldContribution, type FieldLeaf, type FieldRef, type FieldSourceRecord, type FieldValueKind, type FieldValueRecord, type FrontMatterSubtype, type FrontmatterPatchValue, GIT_SHA, type IBlockKey, type ICodeMetadata, type ICodeStatement, type IDialect, type IDialectTagDescriptor, type IMetric, type IMetricOwnershipResolver, type IMetricSource, type IOutputStatement, type IScript, type ITagSource, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, METRIC_OWNERSHIP_LAYER_CHAIN, type Membership, Metric, type MetricAction, MetricContainer, type MetricFilter, type MetricOrigin, type MetricOwnershipLayer, type MetricOwnershipLedger, type MetricOwnershipOutcome, type MetricOwnershipPromotionCandidate, type MetricOwnershipQuery, type MetricOwnershipResolvedContribution, type MetricOwnershipTypeExplanation, type MetricTemporal, MetricType, type MetricWithOptionalOwnershipLayer, NOTEBOOK_TAG_PREFIX, type Note, type NoteBlock, type NoteBlockChange, type NoteBlockKind, type NoteKind, type NotePlacement, type NoteTag, type Notebook, type NotebookId, type NotebookOrigin, type NullValueKind, type Origin, OutputStatement, type OutputStatementOptions, type OutputStatementType, OwnershipResolver, type Page, type PageNote, type PageTarget, type ParseError, ParsedCodeStatement, type PlacementProjection, REFERENCE_METADATA_KEY, type ReconcileNoteBlocksOptions, type ReducerStats, type ReferenceDiagnostic, type ReferenceDiagnosticReason, type ReferenceKind, type ReferenceMatchKind, type ReferenceMetadata, type ReferenceRef, type ResultOrigin, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, type ScriptBlock, type ScriptBlockState, type Section, type SectionDocument, type SectionRecognitionOptions, type SectionType, type Segment, type Session, type StoredOutputStatement, type SummaryCoverage, TAG_REFERENCE_METADATA_KEY, type Tag, type TagContribution, type TagDefinition, type TagFunctionContribution, type TagIndex, type TagMetricContribution, type TagReferenceMetadata, type TagTagContribution, type TagType, type TagTypeRecord, type TimeSpan, UNIT_CATALOG, UnitConversionError, type UnitDefinition, type UnitErrorCode, VALID_FENCE_DIALECTS, VERSION, type VisualizerFilter, type VisualizerSize, type WorkoutResults, type WorkoutSectionType, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getMetricOwnershipLayer, getReferenceMetadata, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
|
1966
|
+
export { type AnalyticsDataPoint, type AnalyticsGraphConfig, type AnalyticsGroup, type Attachment, BUILD_TIME, BUILTIN_NOTEBOOKS, type BlockEffort, type BlockEquipment, type BlockIndexRow, BlockKey, type BlockRevision, type BuiltinNotebookSpec, type CatalogBackfillState, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, type DefaultNotebookSlug, type DialectAnalysis, type DimensionKey, type DisplayStatus, type EventGrain, type EventRecord, type FeedId, type FeedOrigin, type FenceDialect, type FieldCatalogEntry, type FieldContribution, type FieldLeaf, type FieldRef, type FieldSourceRecord, type FieldValueKind, type FieldValueRecord, type FrontMatterSubtype, type FrontmatterPatchValue, GIT_SHA, type IBlockKey, type ICodeMetadata, type ICodeStatement, type IDialect, type IDialectTagDescriptor, type IMetric, type IMetricOwnershipResolver, type IMetricSource, type IOutputStatement, type IScript, type ITagSource, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, type LinkWidget, METRIC_OWNERSHIP_LAYER_CHAIN, type Membership, Metric, type MetricAction, MetricContainer, type MetricFilter, type MetricOrigin, type MetricOwnershipLayer, type MetricOwnershipLedger, type MetricOwnershipOutcome, type MetricOwnershipPromotionCandidate, type MetricOwnershipQuery, type MetricOwnershipResolvedContribution, type MetricOwnershipTypeExplanation, type MetricTemporal, MetricType, type MetricWithOptionalOwnershipLayer, NOTEBOOK_TAG_PREFIX, type Note, type NoteBlock, type NoteBlockChange, type NoteBlockKind, type NoteKind, type NotePlacement, type NoteTag, type Notebook, type NotebookId, type NotebookOrigin, type NullValueKind, type Origin, OutputStatement, type OutputStatementOptions, type OutputStatementType, OwnershipResolver, type Page, type PageNote, type PageTarget, type ParseError, ParsedCodeStatement, type ParsedFrontmatter, type PlacementProjection, REFERENCE_METADATA_KEY, type ReconcileNoteBlocksOptions, type ReducerStats, type ReferenceDiagnostic, type ReferenceDiagnosticReason, type ReferenceKind, type ReferenceMatchKind, type ReferenceMetadata, type ReferenceRef, type ResultOrigin, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, type ScriptBlock, type ScriptBlockState, type Section, type SectionDocument, type SectionRecognitionOptions, type SectionType, type Segment, type Session, type StoredOutputStatement, type SummaryCoverage, TAG_REFERENCE_METADATA_KEY, type Tag, type TagContribution, type TagDefinition, type TagFunctionContribution, type TagIndex, type TagMetricContribution, type TagReferenceMetadata, type TagTagContribution, type TagType, type TagTypeRecord, type TimeSpan, type TypedTagItem, UNIT_CATALOG, UnitConversionError, type UnitDefinition, type UnitErrorCode, VALID_FENCE_DIALECTS, VERSION, type VisualizerFilter, type VisualizerSize, type WorkoutResults, type WorkoutSectionType, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, extractFrontmatterTags, extractTypedFrontmatterTags, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getList, getMetricOwnershipLayer, getReferenceMetadata, getScalar, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, serializeFrontmatter, stripFrontmatter, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
package/dist/index.mjs
CHANGED
|
@@ -1149,6 +1149,18 @@ var isNotebookTag = (tag) => tag.startsWith(NOTEBOOK_TAG_PREFIX);
|
|
|
1149
1149
|
|
|
1150
1150
|
// src/sections/sectionParser.ts
|
|
1151
1151
|
var KNOWN_SECTION_WIDGETS = ["playground-run-tip", "attention", "code-example", "syntax-group"];
|
|
1152
|
+
var KNOWN_QUERY_WIDGET_TYPES = {
|
|
1153
|
+
table: true,
|
|
1154
|
+
list: true,
|
|
1155
|
+
value: true,
|
|
1156
|
+
timeseries: true,
|
|
1157
|
+
bar: true,
|
|
1158
|
+
donut: true,
|
|
1159
|
+
toplist: true,
|
|
1160
|
+
"stacked-bar": true,
|
|
1161
|
+
"goal-rings": true,
|
|
1162
|
+
"zone-distribution": true
|
|
1163
|
+
};
|
|
1152
1164
|
function matchDialectFence(trimmedLine) {
|
|
1153
1165
|
const match = trimmedLine.match(/^`{3,}(time|log)(?::([\w-]+))?\s*$/i);
|
|
1154
1166
|
if (!match) return null;
|
|
@@ -1221,9 +1233,11 @@ function parseDocumentSections(content, options = {}) {
|
|
|
1221
1233
|
const tag = fence[2].trim();
|
|
1222
1234
|
const dialect = marker[0] === "`" ? matchDialectFence(`\`\`\`${tag}`) : null;
|
|
1223
1235
|
const widget = marker[0] === "`" ? tag.match(/^widget:([\w-]+)$/) : null;
|
|
1224
|
-
const query = marker[0] === "`" ? tag.match(/^query(?:[:\s](.*))?$/i) : null;
|
|
1225
1236
|
const names = options.registeredWidgets ?? KNOWN_SECTION_WIDGETS;
|
|
1226
1237
|
const knownWidget = widget && ("has" in names ? names.has(widget[1]) : names.includes(widget[1]));
|
|
1238
|
+
const widgetChartMatch = marker[0] === "`" && !knownWidget ? tag.match(/^widget:([a-zA-Z-]+)(?:-(?:full|\d+))?(?:\s+.*)?$/i) : null;
|
|
1239
|
+
const isWidgetChart = Boolean(widgetChartMatch && KNOWN_QUERY_WIDGET_TYPES[widgetChartMatch[1].toLowerCase()]);
|
|
1240
|
+
const query = marker[0] === "`" ? tag.match(/^query(?:[:\s](.*))?$/i) ?? (isWidgetChart ? tag.match(/^widget:?(.*)$/i) : null) : null;
|
|
1227
1241
|
const type = closed && dialect ? dialect.dialect : closed && knownWidget ? "widget" : closed && query ? "query" : "code";
|
|
1228
1242
|
const section2 = make(type, line, end2);
|
|
1229
1243
|
section2.contentFrom = offsets[line] + lines[line].length + separators[line].length;
|
|
@@ -1546,17 +1560,177 @@ function patchFrontmatterProperty(raw, path, value) {
|
|
|
1546
1560
|
next.splice(spliceIndex, removeCount, ...replacement);
|
|
1547
1561
|
return `---${eol}${next.length ? next.join(eol) + eol : ""}---` + raw.slice(m[0].length);
|
|
1548
1562
|
}
|
|
1563
|
+
var FRONTMATTER_BODY_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
1564
|
+
function unquoteScalar(value) {
|
|
1565
|
+
return value.replace(
|
|
1566
|
+
/^(['"])(.*)\1$/,
|
|
1567
|
+
(_match, quote, inner) => quote === '"' ? inner.replace(
|
|
1568
|
+
/\\(["\\nrt])/g,
|
|
1569
|
+
(_all, c) => c === "n" ? "\n" : c === "r" ? "\r" : c === "t" ? " " : c
|
|
1570
|
+
) : inner
|
|
1571
|
+
);
|
|
1572
|
+
}
|
|
1573
|
+
function parseMetaLines(lines) {
|
|
1574
|
+
const meta = {};
|
|
1575
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1576
|
+
const keyMatch = lines[i].match(/^([A-Za-z][\w.-]*)\s*:(.*)$/);
|
|
1577
|
+
if (!keyMatch) continue;
|
|
1578
|
+
const key = keyMatch[1];
|
|
1579
|
+
const rawVal = keyMatch[2].trim();
|
|
1580
|
+
if (rawVal === "") {
|
|
1581
|
+
const items = [];
|
|
1582
|
+
while (i + 1 < lines.length) {
|
|
1583
|
+
const itemMatch = lines[i + 1].match(/^\s+-\s+(.+)$/);
|
|
1584
|
+
if (!itemMatch) break;
|
|
1585
|
+
items.push(unquoteScalar(itemMatch[1].trim()));
|
|
1586
|
+
i++;
|
|
1587
|
+
}
|
|
1588
|
+
if (items.length > 0) {
|
|
1589
|
+
meta[key] = items;
|
|
1590
|
+
} else if (key === "metrics" || key === "summaries" || key === "widgets") {
|
|
1591
|
+
while (i + 1 < lines.length) {
|
|
1592
|
+
const childLine = lines[i + 1];
|
|
1593
|
+
if (/^\s*(?:#.*)?$/.test(childLine)) {
|
|
1594
|
+
i++;
|
|
1595
|
+
continue;
|
|
1596
|
+
}
|
|
1597
|
+
const childMatch = childLine.match(/^\s{2,}([A-Za-z][\w.-]*)\s*:(.*)$/);
|
|
1598
|
+
if (!childMatch) break;
|
|
1599
|
+
i++;
|
|
1600
|
+
const childKey = `${key}.${childMatch[1]}`;
|
|
1601
|
+
const childRaw = childMatch[2].trim();
|
|
1602
|
+
if (childRaw === "") {
|
|
1603
|
+
const childItems = [];
|
|
1604
|
+
while (i + 1 < lines.length) {
|
|
1605
|
+
const listMatch = lines[i + 1].match(/^\s{4,}-\s+(.+)$/);
|
|
1606
|
+
if (!listMatch) break;
|
|
1607
|
+
childItems.push(unquoteScalar(listMatch[1].trim()));
|
|
1608
|
+
i++;
|
|
1609
|
+
}
|
|
1610
|
+
meta[childKey] = childItems.length > 0 ? childItems : "";
|
|
1611
|
+
} else {
|
|
1612
|
+
const wasQuoted = /^(['"])(.*)\1$/.test(childRaw);
|
|
1613
|
+
const value = unquoteScalar(childRaw);
|
|
1614
|
+
const num = Number(value);
|
|
1615
|
+
meta[childKey] = !wasQuoted && value !== "" && !isNaN(num) ? num : value;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
} else {
|
|
1619
|
+
meta[key] = "";
|
|
1620
|
+
}
|
|
1621
|
+
} else {
|
|
1622
|
+
const wasQuoted = /^(['"])(.*)\1$/.test(rawVal);
|
|
1623
|
+
const value = unquoteScalar(rawVal);
|
|
1624
|
+
const num = Number(value);
|
|
1625
|
+
meta[key] = !wasQuoted && value !== "" && !isNaN(num) ? num : value;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
return meta;
|
|
1629
|
+
}
|
|
1630
|
+
function parseFrontmatter(raw) {
|
|
1631
|
+
const match = raw.match(FRONTMATTER_BODY_RE);
|
|
1632
|
+
if (!match) return { meta: {}, body: raw };
|
|
1633
|
+
return { meta: parseMetaLines(match[1].split(/\r?\n/)), body: raw.slice(match[0].length) };
|
|
1634
|
+
}
|
|
1635
|
+
function parseFrontmatterBody(innerContent) {
|
|
1636
|
+
return parseMetaLines(innerContent.split(/\r?\n/));
|
|
1637
|
+
}
|
|
1638
|
+
function serializeFrontmatter(meta) {
|
|
1639
|
+
const lines = [];
|
|
1640
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
1641
|
+
if (Array.isArray(value)) {
|
|
1642
|
+
if (value.length === 0) {
|
|
1643
|
+
lines.push(`${key}: ""`);
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1646
|
+
lines.push(`${key}:`);
|
|
1647
|
+
for (const item of value) {
|
|
1648
|
+
lines.push(` - ${quoteYamlScalar(item)}`);
|
|
1649
|
+
}
|
|
1650
|
+
} else if (typeof value === "number") {
|
|
1651
|
+
lines.push(`${key}: ${value}`);
|
|
1652
|
+
} else {
|
|
1653
|
+
lines.push(`${key}: ${quoteYamlScalar(value)}`);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
return lines.join("\n");
|
|
1657
|
+
}
|
|
1658
|
+
function stripFrontmatter(raw) {
|
|
1659
|
+
return parseFrontmatter(raw).body;
|
|
1660
|
+
}
|
|
1661
|
+
function getScalar(meta, key) {
|
|
1662
|
+
const value = meta[key];
|
|
1663
|
+
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
1664
|
+
}
|
|
1665
|
+
function getList(meta, key) {
|
|
1666
|
+
const value = meta[key];
|
|
1667
|
+
return Array.isArray(value) ? value : [];
|
|
1668
|
+
}
|
|
1669
|
+
function parseFrontmatterCategories(raw) {
|
|
1670
|
+
return getList(parseFrontmatter(raw).meta, "category").map((c) => c.toLowerCase());
|
|
1671
|
+
}
|
|
1672
|
+
function extractFrontmatterTags(raw) {
|
|
1673
|
+
const meta = FRONTMATTER_BODY_RE.test(raw) ? parseFrontmatter(raw).meta : parseFrontmatterBody(raw);
|
|
1674
|
+
const tags = meta["tags"] ?? meta["category"];
|
|
1675
|
+
const list = Array.isArray(tags) ? tags : typeof tags === "string" && tags.trim() ? tags.trim().startsWith("[") && tags.trim().endsWith("]") ? tags.trim().slice(1, -1).split(",") : [tags] : [];
|
|
1676
|
+
return [...new Set(list.map((tag) => tag.trim()).filter(Boolean))];
|
|
1677
|
+
}
|
|
1678
|
+
function extractTypedFrontmatterTags(raw, knownTypeNames = []) {
|
|
1679
|
+
const meta = FRONTMATTER_BODY_RE.test(raw) ? parseFrontmatter(raw).meta : parseFrontmatterBody(raw);
|
|
1680
|
+
const results = [];
|
|
1681
|
+
for (const tag of extractFrontmatterTags(raw)) {
|
|
1682
|
+
results.push({ label: tag });
|
|
1683
|
+
}
|
|
1684
|
+
const metaKeys = Object.keys(meta);
|
|
1685
|
+
for (const typeName of knownTypeNames) {
|
|
1686
|
+
if (typeName === "tags" || typeName === "category") continue;
|
|
1687
|
+
const matchedKey = metaKeys.find((k) => k.toLowerCase() === typeName.toLowerCase());
|
|
1688
|
+
if (!matchedKey) continue;
|
|
1689
|
+
const val = meta[matchedKey];
|
|
1690
|
+
if (val === void 0 || val === null || val === "") continue;
|
|
1691
|
+
let items = [];
|
|
1692
|
+
if (Array.isArray(val)) {
|
|
1693
|
+
items = val.map(String);
|
|
1694
|
+
} else if (typeof val === "string" && val.trim()) {
|
|
1695
|
+
const trimmed = val.trim();
|
|
1696
|
+
items = trimmed.startsWith("[") && trimmed.endsWith("]") ? trimmed.slice(1, -1).split(",") : [trimmed];
|
|
1697
|
+
}
|
|
1698
|
+
for (const item of items) {
|
|
1699
|
+
const label = item.trim();
|
|
1700
|
+
if (label) results.push({ label, type: typeName });
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
const map = /* @__PURE__ */ new Map();
|
|
1704
|
+
for (const item of results) {
|
|
1705
|
+
const existing = map.get(item.label);
|
|
1706
|
+
if (!existing || !existing.type && item.type) {
|
|
1707
|
+
map.set(item.label, item);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return Array.from(map.values());
|
|
1711
|
+
}
|
|
1712
|
+
function parseFlatProperties(innerContent) {
|
|
1713
|
+
return parseFrontmatterProps(innerContent.split(/\r?\n/));
|
|
1714
|
+
}
|
|
1715
|
+
function parseFrontmatterProps(lines) {
|
|
1716
|
+
const props = {};
|
|
1717
|
+
for (const line of lines) {
|
|
1718
|
+
const match = line.match(/^([^:]+):\s*(.*)$/);
|
|
1719
|
+
if (match) props[match[1].trim()] = match[2].trim();
|
|
1720
|
+
}
|
|
1721
|
+
return props;
|
|
1722
|
+
}
|
|
1549
1723
|
|
|
1550
1724
|
// src/version.ts
|
|
1551
|
-
var VERSION = "0.50.
|
|
1552
|
-
var GIT_SHA = "
|
|
1553
|
-
var BUILD_TIME = "2026-11-
|
|
1725
|
+
var VERSION = "0.50.2190";
|
|
1726
|
+
var GIT_SHA = "9ee7872";
|
|
1727
|
+
var BUILD_TIME = "2026-11-01T23:32:46.829Z";
|
|
1554
1728
|
var SEMVER = {
|
|
1555
|
-
version: "0.50.
|
|
1556
|
-
gitSha: "
|
|
1557
|
-
buildTime: "2026-11-
|
|
1729
|
+
version: "0.50.2190",
|
|
1730
|
+
gitSha: "9ee7872",
|
|
1731
|
+
buildTime: "2026-11-01T23:32:46.829Z"
|
|
1558
1732
|
};
|
|
1559
1733
|
|
|
1560
|
-
export { BUILD_TIME, BUILTIN_NOTEBOOKS, BlockKey, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, GIT_SHA, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, METRIC_OWNERSHIP_LAYER_CHAIN, Metric, MetricContainer, MetricType, NOTEBOOK_TAG_PREFIX, OutputStatement, OwnershipResolver, ParsedCodeStatement, REFERENCE_METADATA_KEY, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, TAG_REFERENCE_METADATA_KEY, UNIT_CATALOG, UnitConversionError, VALID_FENCE_DIALECTS, VERSION, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getMetricOwnershipLayer, getReferenceMetadata, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
|
1734
|
+
export { BUILD_TIME, BUILTIN_NOTEBOOKS, BlockKey, CodeMetadata, CodeStatement, DEFAULT_NOTEBOOK_SLUGS, GIT_SHA, KNOWN_OUTPUT_TYPES, KNOWN_SECTION_WIDGETS, LEGACY_ORIGIN_TO_OWNERSHIP_LAYER, METRIC_OWNERSHIP_LAYER_CHAIN, Metric, MetricContainer, MetricType, NOTEBOOK_TAG_PREFIX, OutputStatement, OwnershipResolver, ParsedCodeStatement, REFERENCE_METADATA_KEY, SEMVER, SYSTEM_DEFAULT_OUTPUT_UNIT, TAG_REFERENCE_METADATA_KEY, UNIT_CATALOG, UnitConversionError, VALID_FENCE_DIALECTS, VERSION, actionableSectionKind, blockContentId, buildRawContent, calculateTotalLines, comparePlacements, convertViaCatalog, createMetricOwnershipLedger, createTagIndex, detectScriptBlocks, dimensionKeyOf, extractBlockContent, extractFrontmatterTags, extractTypedFrontmatterTags, fieldRefFromKey, fieldRefKey, findBlockAtLine, flattenFieldLeaves, fromNotebookTag, getList, getMetricOwnershipLayer, getReferenceMetadata, getScalar, getTagReference, isNoteEditable, isNotebookTag, isWorkoutSectionType, lookupUnit, mapNoteBlockChanges, matchDialectFence, normalizeFieldComponent, normalizeFieldPath, notebookSlugFromId, orderPlacements, ownershipRank, parseDocumentSections, parseFlatProperties, parseFrontmatter, parseFrontmatterBody, parseFrontmatterCategories, parseFrontmatterProps, patchFrontmatterProperty, projectPlacements, reconcileNoteBlocks, resolveLayer, resolvePlacements, runAffordance, serializeFrontmatter, stripFrontmatter, systemDefaultUnit, toNotebookId, toNotebookTag, validateNoteBlocks, valueKindOf };
|
|
1561
1735
|
//# sourceMappingURL=index.mjs.map
|
|
1562
1736
|
//# sourceMappingURL=index.mjs.map
|