@bluepic/embed 0.6.51 → 0.7.0-layouts.2
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/bluepic-embed.iife.js +110 -110
- package/dist/bluepic-embed.umd.js +110 -110
- package/dist/components/BxCarousel.vue.d.ts +55 -0
- package/dist/components/BxChips.vue.d.ts +35 -0
- package/dist/components/BxDrawer.vue.d.ts +27 -1
- package/dist/components/BxDrawerSheetBody.vue.d.ts +18 -0
- package/dist/components/BxNavMenu.vue.d.ts +35 -0
- package/dist/components/BxThemeScope.vue.d.ts +32 -0
- package/dist/components/BxTreeNav.vue.d.ts +47 -0
- package/dist/components/BxTreeNavBranch.vue.d.ts +7 -0
- package/dist/components/Tabs.vue.d.ts +10 -0
- package/dist/components/TemplateEditor/BxTemplateEditor.vue.d.ts +21 -0
- package/dist/components/TemplateEditor/editorArrangement.d.ts +20 -0
- package/dist/components/treeNav.d.ts +32 -0
- package/dist/embed/embed.d.ts +28 -2
- package/dist/main.cjs +41 -41
- package/dist/main.d.ts +11 -0
- package/dist/main.mjs +12662 -11285
- package/dist/style.css +1 -1
- package/dist/theme/index.d.ts +1 -0
- package/dist/theme/scope.d.ts +27 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.mjs +516 -473
- package/dist/util/a11y/reducedMotion.d.ts +5 -0
- package/dist/util/layout/scrollLock.d.ts +1 -0
- package/dist/util/layout/useScrollSpy.d.ts +24 -0
- package/dist/util/pageView.d.ts +127 -0
- package/package.json +6 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
/** Whether the visitor asked for reduced motion, right now. False without `matchMedia` (SSR, tests). */
|
|
3
|
+
export declare function prefersReducedMotion(): boolean;
|
|
4
|
+
/** `prefers-reduced-motion: reduce` as a live ref. Call in `setup`. */
|
|
5
|
+
export declare function useReducedMotion(): Readonly<Ref<boolean>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lockScroll(target?: HTMLElement | null): () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
2
|
+
export type ScrollSpyOptions = {
|
|
3
|
+
/** The scroll container. Default: the window. */
|
|
4
|
+
root?: MaybeRefOrGetter<HTMLElement | null | undefined>;
|
|
5
|
+
/** Height of sticky chrome above the content (px). A target counts as reached when its top passes this line. */
|
|
6
|
+
offset?: MaybeRefOrGetter<number>;
|
|
7
|
+
/** Element of a target id. Default `document.getElementById(id)`. */
|
|
8
|
+
getElement?: (id: string) => HTMLElement | null | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type ScrollSpy = {
|
|
11
|
+
/** The target whose top last passed the offset line; the last one at the very bottom; else the first. */
|
|
12
|
+
activeId: Ref<string | null>;
|
|
13
|
+
/** Scroll so the target's top sits at the offset line. Smooth unless reduced motion. `activeId` follows at once. */
|
|
14
|
+
scrollTo: (id: string, options?: {
|
|
15
|
+
behavior?: ScrollBehavior;
|
|
16
|
+
}) => void;
|
|
17
|
+
/** Recompute now (after the content changed). */
|
|
18
|
+
refresh: () => void;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Scroll spy for chapter bars and anchor lists. Owns no scroll container: the
|
|
22
|
+
* host passes it in. Call in `setup`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useScrollSpy(targets: MaybeRefOrGetter<readonly string[]>, options?: ScrollSpyOptions): ScrollSpy;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { V4 } from '@bluepic/types';
|
|
2
|
+
import { type PageGalleryCard, type PageGalleryOptions, type PortalAsset } from './gallery';
|
|
3
|
+
type BaseTemplateDescriptor = {
|
|
4
|
+
name: string;
|
|
5
|
+
canvases?: readonly unknown[] | null;
|
|
6
|
+
};
|
|
7
|
+
/** What a layout shows. Structurally a superset of `V4.PageLayoutCapabilities`. */
|
|
8
|
+
export type PageViewCapabilities = {
|
|
9
|
+
/** `'active'` (or `true`): only the active subpage. `'all'`: every subpage, in order (chapters). `false`: merged. */
|
|
10
|
+
subpages: 'active' | 'all' | boolean;
|
|
11
|
+
/** `true`: sections as blocks. `'by-label'`: blocks merged by label (trimmed, case-insensitive). `false`: one block. */
|
|
12
|
+
sections: boolean | 'by-label';
|
|
13
|
+
/** `'inline'`: group members replace the group card, in member order, recursively. Default `'cards'`. */
|
|
14
|
+
groups?: 'cards' | 'inline';
|
|
15
|
+
};
|
|
16
|
+
export type PageViewAspect = 'square' | 'portrait' | 'landscape';
|
|
17
|
+
export type PageViewFilter = {
|
|
18
|
+
/** Matches template name and asset title / filename / description. Case and diacritics are ignored; every word must match. */
|
|
19
|
+
query?: string | null;
|
|
20
|
+
/** Keep only blocks holding one of these section ids (a merged block matches through any of its `sectionIds`). Empty = all. */
|
|
21
|
+
sectionIds?: readonly string[] | null;
|
|
22
|
+
/** Keep only items of this aspect. Items without a known size drop out. */
|
|
23
|
+
aspect?: PageViewAspect | null;
|
|
24
|
+
};
|
|
25
|
+
export type PageViewOptions<T> = Omit<PageGalleryOptions, 'layout'> & {
|
|
26
|
+
layout: PageViewCapabilities;
|
|
27
|
+
filter?: PageViewFilter | null;
|
|
28
|
+
/** Searchable text of a template. Default: its `name`. */
|
|
29
|
+
templateText?: (template: T, id: string) => string;
|
|
30
|
+
/** Size of a template for the aspect filter. Default: first canvas, else `width` / `height` on the descriptor. */
|
|
31
|
+
templateSize?: (template: T, id: string) => {
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
} | null | undefined;
|
|
35
|
+
};
|
|
36
|
+
export type PageViewSection<T> = {
|
|
37
|
+
/** The block's id: the section id, for a merged block the id of its first section. */
|
|
38
|
+
id: string;
|
|
39
|
+
subpageId: string;
|
|
40
|
+
label: string;
|
|
41
|
+
/** Render the label as a heading. */
|
|
42
|
+
heading: boolean;
|
|
43
|
+
items: V4.PageItemRef[];
|
|
44
|
+
/** Every section this block stands for (one, or several when merged). */
|
|
45
|
+
sectionIds: string[];
|
|
46
|
+
cards: PageGalleryCard<T>[];
|
|
47
|
+
/** Visible templates and assets in the block (a group counts its visible members). */
|
|
48
|
+
count: number;
|
|
49
|
+
};
|
|
50
|
+
export type PageViewSubpage = {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
slug: string;
|
|
54
|
+
description?: string;
|
|
55
|
+
};
|
|
56
|
+
export type PageViewChapter<T> = {
|
|
57
|
+
subpage: PageViewSubpage;
|
|
58
|
+
sections: PageViewSection<T>[];
|
|
59
|
+
count: number;
|
|
60
|
+
};
|
|
61
|
+
/** A filter facet: the blocks of the current scope merged by label, counted without the `sectionIds` filter. */
|
|
62
|
+
export type PageViewLabel = {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
sectionIds: string[];
|
|
66
|
+
count: number;
|
|
67
|
+
};
|
|
68
|
+
export type PageViewTreeNode = {
|
|
69
|
+
id: string;
|
|
70
|
+
kind: 'subpage' | 'section' | 'group';
|
|
71
|
+
label: string;
|
|
72
|
+
/** Visible templates and assets below this node. */
|
|
73
|
+
count: number;
|
|
74
|
+
subpageId: string;
|
|
75
|
+
/** Null for a subpage node. */
|
|
76
|
+
sectionId: string | null;
|
|
77
|
+
children: PageViewTreeNode[];
|
|
78
|
+
};
|
|
79
|
+
export type PageView<T> = {
|
|
80
|
+
/** Subpage tabs. Empty when fewer than two subpages are shown, and always with `subpages: 'all'` (use `chapters`). */
|
|
81
|
+
tabs: {
|
|
82
|
+
id: string;
|
|
83
|
+
label: string;
|
|
84
|
+
slug: string;
|
|
85
|
+
}[];
|
|
86
|
+
/** `'active'`: the shown subpage. `'all'`: the one `activeSubpage` names (the scroll target), else the first. `false`: null. */
|
|
87
|
+
activeSubpageId: string | null;
|
|
88
|
+
/** Scroll anchors: only without tabs, when two or more labelled blocks are shown, never with `subpages: 'all'`. */
|
|
89
|
+
anchors: {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
}[];
|
|
93
|
+
/** Every shown subpage with its blocks (same section rules, filters applied). */
|
|
94
|
+
chapters: PageViewChapter<T>[];
|
|
95
|
+
/** The blocks to render: the active subpage, or every shown subpage in order. */
|
|
96
|
+
sections: PageViewSection<T>[];
|
|
97
|
+
/** Every card of `sections`, in document order (strip, carousel, wall). */
|
|
98
|
+
cards: PageGalleryCard<T>[];
|
|
99
|
+
/** Label facets of the scope (chips). */
|
|
100
|
+
labels: PageViewLabel[];
|
|
101
|
+
/** Visible items in `sections` (filters applied). */
|
|
102
|
+
count: number;
|
|
103
|
+
/** Visible items in the scope without any filter. */
|
|
104
|
+
total: number;
|
|
105
|
+
/** Subpages › labelled sections › groups, without filters. An unlabelled section is not a node: its groups sit under the subpage. */
|
|
106
|
+
tree: PageViewTreeNode[];
|
|
107
|
+
/** Where a template, asset or group id sits, for deep links. */
|
|
108
|
+
locate(id: string): {
|
|
109
|
+
subpageId: string;
|
|
110
|
+
sectionId: string;
|
|
111
|
+
} | null;
|
|
112
|
+
};
|
|
113
|
+
/** Lower case, diacritics removed (`NFD`), whitespace collapsed. */
|
|
114
|
+
export declare function foldSearchText(text: string | null | undefined): string;
|
|
115
|
+
/** `square` within ±10 % of 1:1, else `portrait` or `landscape`. Null for a missing or invalid size. */
|
|
116
|
+
export declare function pageViewAspect(width: number | null | undefined, height: number | null | undefined): PageViewAspect | null;
|
|
117
|
+
/**
|
|
118
|
+
* The page as a layout shows it. Pure: same input, same output.
|
|
119
|
+
*
|
|
120
|
+
* Visibility is counted over what has data (a template missing from `templates`
|
|
121
|
+
* or an asset missing from `assets` is not shown; a group shows when one of its
|
|
122
|
+
* members does), then the filter applies on top.
|
|
123
|
+
*/
|
|
124
|
+
export declare function buildPageView<T extends BaseTemplateDescriptor>(structure: V4.PageStructure, templates: {
|
|
125
|
+
[k: string]: T;
|
|
126
|
+
}, assets: readonly PortalAsset[] | undefined, options: PageViewOptions<T>): PageView<T>;
|
|
127
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluepic/embed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-layouts.2",
|
|
4
4
|
"description": "Bluepic embed sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -47,7 +47,11 @@
|
|
|
47
47
|
"test:imageaspect": "tsx src/util/imageAspect/imageAspect.test.ts",
|
|
48
48
|
"test:blankdata": "tsx src/util/blankData.test.ts",
|
|
49
49
|
"test:fieldstatus": "tsx src/util/fieldStatus.test.ts",
|
|
50
|
-
"test:slotvnodes": "tsx src/util/slotVNodes.test.ts"
|
|
50
|
+
"test:slotvnodes": "tsx src/util/slotVNodes.test.ts",
|
|
51
|
+
"test:themescope": "tsx src/theme/scope.test.ts",
|
|
52
|
+
"test:arrangement": "tsx src/components/TemplateEditor/editorArrangement.test.ts",
|
|
53
|
+
"test:pageview": "tsx src/util/pageView.test.ts",
|
|
54
|
+
"test:treenav": "tsx src/components/treeNav.test.ts"
|
|
51
55
|
},
|
|
52
56
|
"peerDependencies": {
|
|
53
57
|
"vue": "^3.5.23"
|