tosijs-ui 1.16.39 → 1.16.40
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/CHANGELOG.md +22 -0
- package/dist/doc-browser.d.ts +5 -0
- package/dist/doc-browser.js +6 -3
- package/dist/doc-system/doc-system-styles.js +1 -1
- package/dist/doc-system/doc-system.js +1 -0
- package/dist/doc-system/site/generate-site.d.ts +2 -0
- package/dist/doc-system/site/generate-site.js +1 -0
- package/dist/doc-system/site/orchestrator.js +1 -0
- package/dist/doc-system/site/site-config.d.ts +5 -0
- package/dist/iife.js +99 -99
- package/dist/iife.js.map +8 -8
- package/dist/live-example/execution.d.ts +11 -0
- package/dist/live-example/execution.js +18 -0
- package/dist/palette.d.ts +7 -0
- package/dist/palette.js +31 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.16.40
|
|
4
|
+
|
|
5
|
+
- **An example with no script runs under a strict CSP (#245, #246).** A pure-HTML example still
|
|
6
|
+
built an `AsyncFunction` from its empty script, and a dialect that runs its own source (`run`)
|
|
7
|
+
had one built before its `run` was called. Under a Content Security Policy without
|
|
8
|
+
`'unsafe-eval'` (`script-src 'self'`) the constructor throws, so each such example showed an
|
|
9
|
+
error and filed a violation report every time it ran. Neither now constructs a function at
|
|
10
|
+
all, so HTML examples, and `run` dialects that only sanitize and bind markup, work on a
|
|
11
|
+
CSP-protected host. Script examples still need `'unsafe-eval'`; a CSP-compatible path for
|
|
12
|
+
them, and an HTML-only example mode, are planned for 1.17.0.
|
|
13
|
+
- **The doc header's search says "Search", and a site can set it.** `searchPlaceholder` in the
|
|
14
|
+
site config (or `createDocBrowser`) sets the hint in the header's search field, and the
|
|
15
|
+
trigger's accessible name; the default was "Search documentation" (set
|
|
16
|
+
`searchPlaceholder: 'Search documentation'` to keep it, and update any test that looks the
|
|
17
|
+
field up by that name). It is localized through the site's strings, and its placeholder
|
|
18
|
+
follows the locale the reader picks. `<tosi-palette>` gained a `localizer` property for this: a function its placeholder
|
|
19
|
+
goes through, such as `localize`. It is a function rather than a `localized` attribute so the
|
|
20
|
+
palette does not import the localization module, and `<tosi-select>` with it, wherever it is
|
|
21
|
+
used.
|
|
22
|
+
- **The ⌘K hint in the search field has no outline.** An outline inside the field's own outline
|
|
23
|
+
read as a second control. The hints inside the open palette keep theirs.
|
|
24
|
+
|
|
3
25
|
## 1.16.39
|
|
4
26
|
|
|
5
27
|
- **The doc-site frame passes WCAG 2.2 AA where an axe scan said it did not (#3520).** An
|
package/dist/doc-browser.d.ts
CHANGED
|
@@ -118,6 +118,11 @@ export interface DocBrowserOptions {
|
|
|
118
118
|
* for a host page that owns that key or embeds more than one browser.
|
|
119
119
|
*/
|
|
120
120
|
searchShortcut?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The hint in the header's search field (default `'Search'`). Localized through the site's
|
|
123
|
+
* strings, like every other piece of the doc system's own text.
|
|
124
|
+
*/
|
|
125
|
+
searchPlaceholder?: string;
|
|
121
126
|
/**
|
|
122
127
|
* Header-bar links. When provided, these replace the legacy `projectLinks` icon
|
|
123
128
|
* set in the header (each renders as an icon if `icon` names a known icon, else
|
package/dist/doc-browser.js
CHANGED
|
@@ -115,7 +115,7 @@ import { tosiSidenav, TosiSidenav } from './side-nav.js';
|
|
|
115
115
|
import { icons } from './icons.js';
|
|
116
116
|
import { tosiPalette } from './palette.js';
|
|
117
117
|
import { buildDocIndex, searchDocs } from './doc-system/doc-search.js';
|
|
118
|
-
import { tosiLocalized } from './localize.js';
|
|
118
|
+
import { tosiLocalized, localize, i18n } from './localize.js';
|
|
119
119
|
import { popMenu } from './menu.js';
|
|
120
120
|
import { codeEditor } from './code-editor.js';
|
|
121
121
|
import { tosiDiff } from './diff.js';
|
|
@@ -395,7 +395,7 @@ let docBrowserSeq = 0;
|
|
|
395
395
|
// Likewise for the nav's aria-controls ids.
|
|
396
396
|
let navIdCounter = 0;
|
|
397
397
|
export function createDocBrowser(options) {
|
|
398
|
-
const { docs, context = {}, projectName = '', projectLinks = {}, logo, navSize = 200, minSize = 600, routing = 'query', initialRoute, aliases = {}, onRouteChange, searchShortcut = 'mod+k', navbarLinks, contentElement, } = options;
|
|
398
|
+
const { docs, context = {}, projectName = '', projectLinks = {}, logo, navSize = 200, minSize = 600, routing = 'query', initialRoute, aliases = {}, onRouteChange, searchShortcut = 'mod+k', searchPlaceholder = 'Search', navbarLinks, contentElement, } = options;
|
|
399
399
|
// Memory routing is fully self-contained: it never reads or writes
|
|
400
400
|
// window.history/location, so an embedded or nested browser can't hijack the
|
|
401
401
|
// host page's URL (or recurse into it).
|
|
@@ -750,11 +750,14 @@ export function createDocBrowser(options) {
|
|
|
750
750
|
// In the header bar (see headerContent); the nav no longer holds a search field.
|
|
751
751
|
const searchBox = tosiPalette({
|
|
752
752
|
class: 'doc-search',
|
|
753
|
-
placeholder:
|
|
753
|
+
placeholder: searchPlaceholder,
|
|
754
|
+
localizer: localize,
|
|
754
755
|
shortcut: searchShortcut,
|
|
755
756
|
sources: [docSearchSource],
|
|
756
757
|
quickLinks,
|
|
757
758
|
});
|
|
759
|
+
// The hint follows the reader's language, like the rest of the doc system's own text.
|
|
760
|
+
i18n.locale.observe(() => searchBox.queueRender());
|
|
758
761
|
// Memory routing is decoupled from the page URL, so it ignores browser
|
|
759
762
|
// back/forward (the host owns history, if any).
|
|
760
763
|
if (!memoryRouting) {
|
|
@@ -66,7 +66,7 @@ export function docSystemColors(theme = {}) {
|
|
|
66
66
|
/*
|
|
67
67
|
Readable, not faint (#3520). This was the brand at 40% opacity, which an axe scan measured
|
|
68
68
|
at 1.88:1 on the input (#eda7c5 on #fdfdfd) where AA asks 4.5:1, and it colours the doc
|
|
69
|
-
header's
|
|
69
|
+
header's search trigger, a real label, not just a hint.
|
|
70
70
|
*/
|
|
71
71
|
_placeholderColor: readableOn(brandColor, Color.fromCss(theme.inputBg ?? '#fdfdfd')),
|
|
72
72
|
/*
|
|
@@ -608,6 +608,7 @@ export class TosiDocSystem extends withAttributes({
|
|
|
608
608
|
projectLinks: config.projectLinks,
|
|
609
609
|
logo: config.logo,
|
|
610
610
|
navbarLinks: navbarLinks.length ? navbarLinks : undefined,
|
|
611
|
+
searchPlaceholder: config.searchPlaceholder,
|
|
611
612
|
contentElement,
|
|
612
613
|
});
|
|
613
614
|
// Add the settings (theme + language) menu — except in a nested demo, where
|
|
@@ -8,6 +8,8 @@ export interface GenerateSiteConfig {
|
|
|
8
8
|
docs: Doc[];
|
|
9
9
|
/** `SiteConfig.aliases`: { alias path -> slug } (board #3513) */
|
|
10
10
|
aliases?: Record<string, string>;
|
|
11
|
+
/** `SiteConfig.searchPlaceholder` */
|
|
12
|
+
searchPlaceholder?: string;
|
|
11
13
|
/**
|
|
12
14
|
* Mirrors `SiteConfig.liveExamples`. The static highlighter needs it so it skips the
|
|
13
15
|
* fences that will become live examples — a highlighted block hands the example markup
|
|
@@ -368,6 +368,7 @@ export async function generateSite(config) {
|
|
|
368
368
|
logo: config.logo,
|
|
369
369
|
bookVolumes: config.bookVolumes,
|
|
370
370
|
ebooks: config.ebooks,
|
|
371
|
+
searchPlaceholder: config.searchPlaceholder,
|
|
371
372
|
}));
|
|
372
373
|
// The theme stylesheet (config.stylesUrl) is written separately by
|
|
373
374
|
// ./generate-css.ts; pages here just <link> to it.
|
|
@@ -1497,6 +1497,7 @@ export async function buildSite(config, opts = {}) {
|
|
|
1497
1497
|
liveExamples: config.liveExamples,
|
|
1498
1498
|
docs,
|
|
1499
1499
|
aliases: config.aliases,
|
|
1500
|
+
searchPlaceholder: config.searchPlaceholder,
|
|
1500
1501
|
outputDir: PUBLIC,
|
|
1501
1502
|
projectName: config.name,
|
|
1502
1503
|
bookVolumes: printCoverManifestUrl(config),
|
|
@@ -71,6 +71,11 @@ export interface SiteConfig {
|
|
|
71
71
|
* on one that is not, that takes a page's own path or a static folder's, or that names no page.
|
|
72
72
|
*/
|
|
73
73
|
aliases?: Record<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* The hint in the header's search field. Default `'Search'`. It is localized like the rest
|
|
76
|
+
* of the doc system's own text, so a site with translations can translate it.
|
|
77
|
+
*/
|
|
78
|
+
searchPlaceholder?: string;
|
|
74
79
|
/**
|
|
75
80
|
* Directories to skip while scanning `docPaths` — by basename (skipped wherever it
|
|
76
81
|
* appears) or by path (skipped only at that location). Added to the built-in
|