Keep your coding agent up to date with the latest web best practices
Release v0.0.65
github-actions[bot]bddaf788697d
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 129fcb2..97dba4d 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -8,7 +8,7 @@"name": "modern-web-guidance","source": "./","description": "Google Chrome's agent skills collection",- "version": "0.0.64"+ "version": "0.0.65"}]}diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex e301404..581aa9b 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Google Chrome's agent skills collection",- "version": "0.0.64",+ "version": "0.0.65","author": {"name": "Google Chrome"}diff --git a/README.md b/README.mdindex 787bfeb..693e804 100644--- a/README.md+++ b/README.md@@ -2,10 +2,10 @@This curated collection of skills, tools, and AI-ready documentation injects Chrome's web platform knowledge directly into your workflow, ensuring your coding agent builds apps that are modern, fast, and secure by default.-#### Skill Coverage in `v0.0.64`+#### Skill Coverage in `v0.0.65`<details>-<summary><strong>74 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `<details>`, `<dialog closedby>`, `<dialog>`, `<link rel="expect">`, `<link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `content-visibility`, `Cross-document view transitions`, `Customizable <select>`, `Email, telephone, and URL <input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive <details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>+<summary><strong>75 web features with implementation guidance from Chrome's experts</strong>: `::backdrop`, `:autofill`, `:has()`, `:not()`, `:user-valid and :user-invalid`, `@starting-style`, `<details>`, `<dialog closedby>`, `<dialog>`, `<link rel="expect">`, `<link rel="preload">`, `AbortController and AbortSignal`, `accent-color`, `Active view transition`, `Anchor positioning`, `blocking="render"`, `calc-size()`, `color-scheme`, `Container queries`, `content-visibility`, `Cross-document view transitions`, `Customizable <select>`, `Email, telephone, and URL <input> types`, `enterkeyhint`, `Fetch`, `Fetch priority`, `fetchLater`, `field-sizing`, `font-size-adjust`, `Form-associated WebMCP attributes`, `hidden="until-found"`, `image-set()`, `Individual transform properties`, `inert`, `inputmode`, `Interest invokers`, `interpolate-size`, `Intl.DurationFormat`, `Invoker commands`, `Language detector`, `light-dark()`, `linear() easing`, `Long animation frames`, `Masks`, `moveBefore()`, `Mutually exclusive <details> elements`, `Navigation API`, `navigator.modelContext`, `overlay`, `Page visibility state`, `Popover`, `popover="hint"`, `prefers-color-scheme media query`, `prefers-contrast media query`, `prefers-reduced-motion media query`, `Registered custom properties`, `Scheduler API`, `Scroll snap`, `Scroll-driven animations`, `scroll-initial-target`, `scrollbar-color`, `scrollbar-width`, `scrollIntoView()`, `sibling-count() and sibling-index()`, `sin(), cos(), tan(), asin(), acos(), atan(), and atan2() (CSS)`, `Speculation rules`, `Temporal`, `text-box`, `text-wrap`, `text-wrap: balance`, `text-wrap: pretty`, `Top-level await`, `transition-behavior`, `View transitions`, `view-transition-class`</summary>- **[::backdrop](https://webstatus.dev/features/backdrop), [<dialog>](https://webstatus.dev/features/dialog), [overlay](https://webstatus.dev/features/overlay), [Popover](https://webstatus.dev/features/popover), [@starting-style](https://webstatus.dev/features/starting-style), [transition-behavior](https://webstatus.dev/features/transition-behavior)**- **animate-to-from-top-layer**: Animate elements such as dialogs, popovers, and tooltips as they're entering/exiting the top layer.@@ -102,6 +102,8 @@ This curated collection of skills, tools, and AI-ready documentation injects Chr- **format-human-readable-durations**: Present elapsed time or durations to users in a readable, localized format, with the flexibility to display either detailed unit breakdowns (e.g., "1 hour and 30 minutes") or total unit counts (e.g., "90 minutes") depending on context.- **[Invoker commands](https://webstatus.dev/features/invoker-commands)**- **declarative-button-actions**: Declaratively connect a button to any element to trigger custom, application-specific actions.+- **[Language detector](https://webstatus.dev/features/languagedetector)**+ - **language-detection**: Detect the language of user-generated content or already present site content.- **[linear() easing](https://webstatus.dev/features/linear-easing)**- **physics-based-easing**: Create custom, physics-based animation and transition effects, like bounce and spring, that feel more natural and engaging than traditional easing curves.- **[Long animation frames](https://webstatus.dev/features/long-animation-frames)**diff --git a/gemini-extension.json b/gemini-extension.jsonindex 3319083..b9c327b 100644--- a/gemini-extension.json+++ b/gemini-extension.json@@ -1,7 +1,7 @@{"name": "modern-web-guidance","description": "Google Chrome's web development agent skills.",- "version": "0.0.64",+ "version": "0.0.65","author": {"name": "Google Chrome"}diff --git a/package.json b/package.jsonindex 32f3913..b2ee766 100644--- a/package.json+++ b/package.json@@ -2,7 +2,7 @@"name": "modern-web-guidance","displayName": "Modern Web Guidance","description": "Curated collection of agent skills for modern web development.",- "version": "0.0.64",+ "version": "0.0.65","publisher": "GoogleChrome","engines": {"vscode": "^1.90.0",diff --git a/skills/modern-web/guides/built-in-ai/language-detection.md b/skills/modern-web/guides/built-in-ai/language-detection.mdnew file mode 100644index 0000000..e9456f6--- /dev/null+++ b/skills/modern-web/guides/built-in-ai/language-detection.md@@ -0,0 +1,87 @@+The **Language Detector API** is a client-side web API designed to identify the language of a given text string. By performing detection locally in the browser, it enhances user privacy and reduces the need for heavy external libraries or costly server-side calls.++## Key Use Cases++- **Translation Prep:** Identifying the source language before sending text to a translator.+- **Safety & Filtering:** Loading specific models for tasks like toxicity detection.+- **Accessibility:** Labeling content with the correct `lang` attribute for screen readers.+- **UI Localization:** Adjusting application interfaces based on the user's input language.++## Hardware & System Requirements++- **OS:** Windows 10/11, macOS 13+, Linux, or Chromebook Plus.+- **Storage:** 22 GB free space (model is removed if space drops below 10 GB).+- **RAM/CPU:** 16 GB RAM and 4+ CPU cores.+- **VRAM:** 4 GB+ if using a GPU.++## Implementation Guide++### 1. Model Management & User Activation++Check model availability before attempting to instantiate the detector or trigger download.++**MANDATORY:** Instantiating the language detector or triggering a model download with `LanguageDetector.create()` **MUST** be initiated by a user gesture (such as a button click) to prevent a `NotAllowedError` when the model is in a `downloadable` or `downloading` state.++```javascript+// Check if the model is available or downloadable+const availability = await LanguageDetector.availability();++if (availability !== 'unavailable') {+ button.addEventListener('click', async () => {+ const detector = await LanguageDetector.create({+ monitor(m) {+ m.addEventListener('downloadprogress', (e) => {+ console.log(`Downloaded ${e.loaded * 100}%`);+ });+ },+ });+ });+}+```++### 2. Running Detection++The API returns a ranked list of potential languages with a confidence score between `0.0` and `1.0`.++```javascript+const someUserText = 'Hallo und herzlich willkommen!';+const results = await detector.detect(someUserText);++for (const result of results) {+ // result.detectedLanguage (e.g., 'de')+ // result.confidence (e.g., 0.999)+ console.log(result.detectedLanguage, result.confidence);+}+```++Avoid using the detector on very short phrases or single words, as accuracy drops significantly.++## Security and Environment++- **Iframes:** Cross-origin iframes require an explicit Permissions Policy to access the API.+ ```html+ <iframe+ src="https://cross-origin.example.com/"+ allow="language-detector"+ ></iframe>+ ```+- **Web Workers:** The API is **not** currently available in Web Workers due to Permission Policy complexities.+- **Privacy:** No data is sent to Google or third parties during the detection process.++## Fallback Strategy++Language detector has limited availability.++Before use, check if the `LanguageDetector` object is available in the global scope:++```javascript+if ('LanguageDetector' in self) {+ // The Language Detector API is supported.+} else {+ // Execute fallback strategy+}+```++If the `LanguageDetector` API is unsupported or availability checks return `'unavailable'`, you must gracefully fall back:+1. **Remote API Fallback**: Redirect the detection request to a server endpoint or a cloud API (such as the Vertex AI Gemini API) to identify the language.+2. **Graceful Degradation**: Disable language detection elements/buttons and inform the user that client-side detection is currently unsupported in this browser, preventing any unhandled exceptions or crashes.