@cngx/common 0.1.0-rc.8 → 0.1.0-rc.9
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/command/README.md +29 -0
- package/data/README.md +5 -2
- package/fesm2022/cngx-common-a11y.mjs +403 -84
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +16 -13
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +4 -3
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +55 -36
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +60 -6
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +185 -37
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +86 -48
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +27 -23
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +324 -122
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +129 -26
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +947 -33
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +300 -166
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +251 -80
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +16 -10
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/layout/README.md +16 -0
- package/package.json +20 -7
- package/popover/README.md +40 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +91 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -4
- package/theming/components/cngx-popover-sheet.css +402 -0
- package/theming/components/cngx-popover.css +10 -6
- package/types/cngx-common-a11y.d.ts +167 -14
- package/types/cngx-common-chart.d.ts +8 -7
- package/types/cngx-common-command.d.ts +19 -2
- package/types/cngx-common-data.d.ts +164 -26
- package/types/cngx-common-dialog.d.ts +3 -7
- package/types/cngx-common-interactive.d.ts +52 -17
- package/types/cngx-common-layout.d.ts +37 -5
- package/types/cngx-common-popover.d.ts +353 -13
- package/types/cngx-common-stepper.d.ts +168 -129
- package/types/cngx-common-tabs.d.ts +149 -30
- package/types/cngx-common-timeline.d.ts +27 -7
package/popover/README.md
CHANGED
|
@@ -137,6 +137,46 @@ import { CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive
|
|
|
137
137
|
</cngx-popover-panel>
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
## Mobile sheet
|
|
141
|
+
|
|
142
|
+
Add `cngxPopoverSheet` to a `[cngxPopover]` and the popover opens as a modal bottom sheet on coarse, narrow screens (`(pointer: coarse) and (max-width: 48rem)`, written once in `cngx-popover-sheet.css`) and stays anchored everywhere else.
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<button type="button" [cngxPopoverTrigger]="pop" (click)="pop.show()">Choose city</button>
|
|
146
|
+
<div cngxPopover #pop="cngxPopover" cngxPopoverSheet #sheet="cngxPopoverSheet">
|
|
147
|
+
<header cngxPopoverSheetHeader cngxSwipeDismiss="down">
|
|
148
|
+
<span cngxPopoverSheetHandle></span>
|
|
149
|
+
<h2 cngxPopoverSheetTitle>City</h2>
|
|
150
|
+
<cngx-close-button label="Close" (click)="sheet.requestClose('close')" />
|
|
151
|
+
</header>
|
|
152
|
+
<ul>...</ul>
|
|
153
|
+
</div>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
| Input / output | Purpose |
|
|
157
|
+
|-|-|
|
|
158
|
+
| `[cngxPopoverSheet]` | `'auto'` (default) follows the breakpoint; `'anchored'`, `'sheet'`, `'fullscreen'` force a presentation |
|
|
159
|
+
| `[autoPresentation]` | What `'auto'` resolves to on a phone: `'sheet'` (content-sized, default) or `'fullscreen'` (for panels led by a text input) |
|
|
160
|
+
| `[labelledBy]` | Id that names the dialog; wins over `cngxPopoverSheetTitle` |
|
|
161
|
+
| `[closeOnRequest]` | `false` turns close requests into notifications only |
|
|
162
|
+
| `[restoreFocus]` / `[restoreTarget]` | Focus return on close (default: the element focused before open) |
|
|
163
|
+
| `(closeRequested)` | `'swipe'`, `'backdrop'`, `'back'` or `'close'` |
|
|
164
|
+
| `(closing)` | Synchronous, inside `hide()`, with the page already live; move focus here when you restore it yourself |
|
|
165
|
+
|
|
166
|
+
**Parts.** `cngxPopoverSheetHeader` stays fixed while the rest of the panel scrolls; with `cngxSwipeDismiss="down"` a downward swipe requests a close. `cngxPopoverSheetTitle` names the dialog (put it on the heading, not on the header that also holds buttons). `cngxPopoverSheetHandle` is decorative and always `aria-hidden`; screen-reader users close through the close control because their swipes drive navigation. `cngxPopoverSheetInitialFocus` marks the element that receives focus on open; with several marks the first enabled one in document order wins, and `[cngxPopoverSheetInitialFocus]="false"` takes a mark out of the next open.
|
|
167
|
+
|
|
168
|
+
**Modality.** Sheet and fullscreen are both modal: `role="dialog"` + `aria-modal="true"`, a focus trap, `inert` on every page sibling (live regions stay live), and a pinned scroll lock (`createPinnedScrollLock`). VoiceOver and TalkBack both read content behind a top-layer popover by touch exploration, so `aria-modal` alone does not contain them; `inert` does.
|
|
169
|
+
|
|
170
|
+
**Focus.** Focus moves into the panel inside `show()`, in the same call stack as the tap that opened it, so a tap-opened fullscreen search keeps the iOS keyboard. A programmatic `open()` outside a user gesture moves focus but cannot raise the iOS keyboard. On close, the page is live again and focus is back on the opener before the close transition starts.
|
|
171
|
+
|
|
172
|
+
**Close vectors.** A swipe on the header, a tap outside the panel and the Android back gesture (through `CloseWatcher`) arrive as `closeRequested`. Escape closes through `[closeOnEscape]` on `CngxPopover`. The tap outside does not reach the element underneath it. If your own code also closes the popover on outside clicks, disable that path while the sheet is not anchored, so one tap has one close path. Under VoiceOver a double tap activates the element under the VoiceOver cursor, which stays inside the sheet, so a double tap on the dimmed area does not close it: give every sheet a close control.
|
|
173
|
+
|
|
174
|
+
**Announcements.** While the sheet is modal, announce through `sheet.announce(message, politeness)`. The message is spoken from a live region inside the panel; VoiceOver ignores body-level regions under `aria-modal` and reads them late, after the sheet closes. A message still pending when the sheet closes is handed to `CngxLiveAnnouncer`.
|
|
175
|
+
|
|
176
|
+
**Platform limits.** iOS Safari has no `CloseWatcher`: the edge back-swipe navigates back with the sheet open. For edge-to-edge landscape on notched iPhones, the app opts into `viewport-fit=cover` in its viewport meta tag; the sheet pads with the safe-area insets either way.
|
|
177
|
+
|
|
178
|
+
**Styling.** Tokens are `--cngx-popover-sheet-*` (block size, radius, padding, header gap, handle, surface, colour, shadow, backdrop, duration, easing), documented in `cngx-popover-sheet.css`; the Material bridge is `@cngx/themes/material/popover-sheet-theme`. The sheet rules live in the `cngx.components` layer, so unlayered app CSS on the popover host (padding, border, radius) wins over them; scope such rules to `:not([data-cngx-presentation='sheet'])`.
|
|
179
|
+
|
|
140
180
|
## Configuration
|
|
141
181
|
|
|
142
182
|
### Global Defaults
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var ce=Object.create;var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ye=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),xe=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},M=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fe(e))!me.call(n,o)&&o!==r&&y(n,o,{get:()=>e[o],enumerable:!(t=ue(e,o))||t.enumerable});return n};var be=(n,e,r)=>(r=n!=null?ce(ge(n)):{},M(e||!n||!n.__esModule?y(r,"default",{value:n,enumerable:!0}):r,n)),he=n=>M(y({},"__esModule",{value:!0}),n);var oe=ye((cn,B)=>{"use strict";var O=process||{},re=O.argv||[],C=O.env||{},Fe=!(C.NO_COLOR||re.includes("--no-color"))&&(!!C.FORCE_COLOR||re.includes("--color")||O.platform==="win32"||(O.stdout||{}).isTTY&&C.TERM!=="dumb"||!!C.CI),Be=(n,e,r=n)=>t=>{let o=""+t,i=o.indexOf(e,n.length);return~i?n+_e(o,e,r,i)+e:n+o+e},_e=(n,e,r,t)=>{let o="",i=0;do o+=n.substring(i,t)+r,i=t+e.length,t=n.indexOf(e,i);while(~t);return o+n.substring(i)},te=(n=Fe)=>{let e=n?Be:()=>String;return{isColorSupported:n,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};B.exports=te();B.exports.createColors=te});var Xe={};xe(Xe,{ngAdd:()=>I});module.exports=he(Xe);var R=require("@schematics/angular/utility");var U=require("@angular-devkit/schematics"),H=require("@schematics/angular/utility");function P(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function V(n){return n instanceof Error?n.message:String(n)}function G(n){return n.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`}var g="package.json";function x(...n){return e=>{let r=e.exists(g)?e.readText(g):void 0;return(0,U.chain)([(0,H.addDependency)(...n),t=>{if(r===void 0||!t.exists(g))return;let o=t.readText(g),i=G(r),s=r.endsWith(`
|
|
5
|
+
`)&&!o.endsWith(`
|
|
6
|
+
`)?`${o}
|
|
7
|
+
`:o,d=i===`
|
|
8
|
+
`?s:s.replace(/\r?\n/g,i);d!==o&&t.overwrite(g,d)}])}}var w=require("node:fs"),Y=require("node:path"),v=require("@angular-devkit/schematics");function N(n){return P(n)?Object.fromEntries(Object.entries(n).filter(e=>typeof e[1]=="string")):{}}function Re(n){try{return JSON.parse(n)}catch(e){let r=e instanceof Error?e.message:String(e);throw new v.SchematicsException(`package.json is not valid JSON: ${r.replace(/\.$/,"")}.`)}}function f(n){let e=Re(n);if(!P(e))throw new v.SchematicsException("package.json is not a JSON object.");return{name:typeof e.name=="string"?e.name:void 0,version:typeof e.version=="string"?e.version:void 0,dependencies:N(e.dependencies),devDependencies:N(e.devDependencies),peerDependencies:N(e.peerDependencies)}}function q(n){let{version:e}=f((0,w.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No version in ${b(n)}.`);return e}function W(n){let{name:e}=f((0,w.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No name in ${b(n)}.`);return e}function b(n){return(0,Y.join)(n,"..","..","package.json")}function m(n,e){return n.dependencies[e]??n.devDependencies[e]}var Se=/^[\s^~<>=v]*(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?/;function J(n){let e=Se.exec(n??"");if(e===null)return;let[,r,t="0",o="0",i]=e;return{major:Number(r),minor:Number(t),patch:Number(o),prerelease:i===void 0?[]:i.split(".").map(s=>/^\d+$/.test(s)?Number(s):s)}}function Ee(n,e){return typeof n=="number"&&typeof e=="number"?n-e:typeof n=="number"?-1:typeof e=="number"?1:n===e?0:n<e?-1:1}function X(n,e){let r=J(n),t=J(e);if(r===void 0||t===void 0)return;let o=r.major-t.major||r.minor-t.minor||r.patch-t.patch;if(o!==0)return o;if(r.prerelease.length===0||t.prerelease.length===0)return t.prerelease.length-r.prerelease.length;let i=Math.max(r.prerelease.length,t.prerelease.length);for(let s=0;s<i;s++){let d=r.prerelease[s],p=t.prerelease[s];if(d===void 0||p===void 0)return d===void 0?-1:1;let u=Ee(d,p);if(u!==0)return u}return 0}function h(n,e){let r=n.read(`node_modules/${e}/package.json`);if(r!==null)try{return f(r.toString("utf8")).version}catch{return}}var Te="package.json",Ce=/^[\s\d.^~<>=|xX*v-]+$/;function Oe(n,e){if(n!==void 0&&Ce.test(n)&&/\d/.test(n))return n;let r=/^(\d+)\.(\d+)\.\d+(-.+)?/.exec(e??"");if(r!==null)return r[3]===void 0?`^${r[1]}.${r[2]}.0`:`^${e}`}function Q(n,e){return(r,t)=>{let o=e??t.logger,i=f(r.readText(Te));if(m(i,n)!==void 0)return;let s=Oe(m(i,"@angular/core"),h(r,"@angular/core"));if(s===void 0){o.info(`Add ${n} matching your @angular/core yourself; cngx cannot read an Angular version to match it to.`);return}return o.info(`Adding ${n}@${s} to match @angular/core, so the install does not pick the ${n} of a newer Angular.`),x(n,s,{install:R.InstallBehavior.None,existing:R.ExistingBehavior.Skip})}}var S=require("@schematics/angular/utility"),Z=require("@schematics/angular/utility/json-file");var K="package.json";function L(n,e,r=!1){return(t,o)=>{let i=m(f(t.readText(K)),n);if(i!==void 0&&i!==e){r&&o.logger.info(`Replacing ${n}@${i} with ${e} so every @cngx package stays on one version.`);let s=new Z.JSONFile(t,K);s.remove(["dependencies",n]),s.remove(["devDependencies",n])}return x(n,e,{install:S.InstallBehavior.None,existing:S.ExistingBehavior.Replace})}}var Ae=["minimal","recommended","full"],E=["utils","core","common","interop","forms","data-display","ui"],Pe=["cngx","material","none"],Ne=["en","de"],we=["claude","cursor","vscode"];function T(n,e){return n.some(r=>r===e)}function ve(n,e){return Array.isArray(e)&&e.every(r=>T(n,r))}function Le(n){return typeof n=="boolean"}function k(n){return`--${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function $e(n,e){let r=e.length===1?"is":"are";return new Error(`"${e.join('", "')}" ${r} given more than once for ${k(n)}.`)}function ke(n,e){let r=k(n);return new Error(`${r} has an empty entry. Separate the values with single commas, for example ${r} ${e.slice(0,2).join(",")}.`)}function F(n,e,r){return new Error(`"${e.join('", "')}" is not a valid answer for ${k(n)}. Expected one of: ${r.join(", ")}.`)}var z=["true","false"];function ee(n,e,r){if(r===void 0)return;let t=typeof r=="string"?r.split(",").map(i=>i.trim()):r;if(t.length===0)return;if(t.includes(""))throw ke(n,e);if(!ve(e,t))throw F(n,t.filter(i=>!T(e,i)),e);let o=t.filter((i,s)=>t.indexOf(i)!==s);if(o.length>0)throw $e(n,[...new Set(o)]);return t}function $(n,e,r){if(r!==void 0){if(!T(e,r))throw F(n,[r],e);return r}}function c(n,e){if(e===void 0||Le(e))return e;if(!T(z,e))throw F(n,[e],z);return e==="true"}function ne(n){return{project:n.project,preset:$("preset",Ae,n.preset),libs:ee("libs",E,n.libs),theme:$("theme",Pe,n.theme),i18n:$("i18n",Ne,n.i18n),runtimeSwitch:c("runtimeSwitch",n.runtimeSwitch),lint:c("lint",n.lint),a11yPreferences:c("a11yPreferences",n.a11yPreferences),feedback:c("feedback",n.feedback),floatingFallback:c("floatingFallback",n.floatingFallback),starter:c("starter",n.starter),aiTools:ee("aiTools",we,n.aiTools),yes:c("yes",n.yes),prompts:c("prompts",n.prompts),quiet:c("quiet",n.quiet)}}var l=require("@angular-devkit/schematics"),A=require("@angular-devkit/schematics/tasks");var ie=be(oe());function Ie(n,e){if(n.NO_COLOR!==void 0&&n.NO_COLOR!=="")return!1;let r=n.FORCE_COLOR;return r!==void 0?r!=="0"&&r!=="false":e}function se(n,e){let r=Ie(n,e),t=(0,ie.createColors)(r);return{enabled:r,bold:t.bold,dim:t.dim,green:t.green,yellow:t.yellow,red:t.red}}function ae(n){let e=n?.toLowerCase();return e==="1"||e==="true"?!0:e==="0"||e==="false"?!1:void 0}function je(n){return ae(n.CI)===!0}function De(n,e){return ae(n.NG_FORCE_TTY)??(e.isTTY===!0&&!je(n))}function de(n,e,r,t){let o=De(n,e);return{isTTY:o,color:se(n,o),quiet:t,logger:r,terminal:o?Me(e):void 0}}function Me(n){if(n.write===void 0)return;let e=r=>{n.write?.(`${r}
|
|
9
|
+
`)};return{info:e,warn:e,error:e}}var Ve=["0.0.0","PLACEHOLDER"].join("-");function le(n){return n===Ve}var a="@cngx/core",Ge="@angular/cdk";function Ue(n){return n!=="@cngx/utils"}function He(n){return n instanceof Error&&n.constructor.name==="CollectionCannotBeResolvedException"}function _(n){try{n.engine.createCollection(a)}catch(e){let r=He(e)?"it cannot be resolved":V(e);throw new l.SchematicsException(`${a} is installed but its ng-add collection failed to load: ${r}`)}}function Je(n){return E.find(e=>`@cngx/${e}`===n)}function Ye(n,e){let r=Je(e),t=ne({libs:n.libs}).libs;if(t===void 0||r===void 0)return n;let o=new Set([...t,r]);return{...n,libs:E.filter(i=>o.has(i))}}function qe(n){let e=de(process.env,process.stdout,n.logger,!1);return e.terminal??e.logger}function We(n,e,r,t){return n===void 0?`${a} is not installed yet; installing it before its ng-add runs.`:e===void 0?`${a} ${n} is installed with a version cngx cannot read; installing ${t} before its ng-add runs.`:`${a} ${n} is installed, older than ${r} ${t}; installing ${t} before its ng-add runs.`}function I(n,e=__dirname){return(r,t)=>{let o=q(e),i=W(e),s=Ye(n,i),d=qe(t),p=h(r,a),u=p===void 0?void 0:X(p,o);if(le(o)){if(p===void 0)throw new l.SchematicsException(`${i} is an unstamped local build (${o}) and ${a} is not installed; pack the libs with node scripts/pack-libs.mjs and install the tarballs.`);return d.info(`${i} is an unstamped local build (${o}); pinning nothing and following the installed ${a} ${p}.`),_(t),(0,l.externalSchematic)(a,"ng-add",s)}if(u!==void 0&&u>0)return d.info(`${a} ${p} is installed, newer than ${i} ${o}; following the installed core.`),_(t),(0,l.externalSchematic)(a,"ng-add",s);let j=(0,l.chain)([L(a,o,!0),L(i,o,!0)]);return u===0?(_(t),(0,l.chain)([j,(0,l.externalSchematic)(a,"ng-add",s)])):(d.info(We(p,u,i,o)),(0,l.chain)([j,...Ue(i)?[Q(Ge,d)]:[],(Qe,D)=>{let pe=D.addTask(new A.NodePackageInstallTask);D.addTask(new A.RunSchematicTask(a,"ng-add",{...s}),[pe])}]))}}0&&(module.exports={ngAdd});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "CngxNgAdd",
|
|
4
|
+
"title": "cngx ng-add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The project to add cngx to.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"preset": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "How much of the onboarding to apply. Asked first when a terminal is attached, after the preflight checklist; default recommended.",
|
|
17
|
+
"enum": ["minimal", "recommended", "full"]
|
|
18
|
+
},
|
|
19
|
+
"libs": {
|
|
20
|
+
"description": "The @cngx packages to install, comma-separated (--libs core,forms); their @cngx peers follow. Asked when a terminal is attached, otherwise every package.",
|
|
21
|
+
"oneOf": [
|
|
22
|
+
{ "type": "string" },
|
|
23
|
+
{
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": { "type": "string", "enum": ["utils", "core", "common", "interop", "forms", "data-display", "ui"] },
|
|
26
|
+
"uniqueItems": true
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"theme": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The generated theme file: the cngx default, the Angular Material bridge, or none.",
|
|
33
|
+
"enum": ["cngx", "material", "none"]
|
|
34
|
+
},
|
|
35
|
+
"i18n": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "The built-in copy: English only, or the German pack as well.",
|
|
38
|
+
"enum": ["en", "de"]
|
|
39
|
+
},
|
|
40
|
+
"runtimeSwitch": {
|
|
41
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
42
|
+
"description": "Wire the language pack for switching at runtime instead of a fixed language."
|
|
43
|
+
},
|
|
44
|
+
"lint": {
|
|
45
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
46
|
+
"description": "Add @cngx/eslint-plugin to the eslint flat config when one exists."
|
|
47
|
+
},
|
|
48
|
+
"a11yPreferences": {
|
|
49
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
50
|
+
"description": "Provide the accessibility preference axes (density, text scale, motion, contrast) with persistence."
|
|
51
|
+
},
|
|
52
|
+
"feedback": {
|
|
53
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
54
|
+
"description": "Provide toasts, alerts and banners at the root when @cngx/ui is installed."
|
|
55
|
+
},
|
|
56
|
+
"floatingFallback": {
|
|
57
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
58
|
+
"description": "Install @floating-ui/dom and provide the popover positioning fallback for browsers without CSS anchor positioning."
|
|
59
|
+
},
|
|
60
|
+
"starter": {
|
|
61
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
62
|
+
"description": "Replace the Angular welcome page of an untouched ng new standalone app with a cngx starter page that shows what was installed. Default true for --preset=full, false otherwise; --no-starter keeps the welcome page."
|
|
63
|
+
},
|
|
64
|
+
"aiTools": {
|
|
65
|
+
"description": "The editors to set up the cngx MCP server for, comma-separated (--ai-tools claude,vscode): the server entry in their project MCP config, a marked cngx block in the agent instructions (AGENTS.md, or CLAUDE.md for Claude Code) and .cngx/README.md. Asked when a terminal is attached. --preset=full preselects the detected editors (CLAUDE.md or .claude, .cursorrules or .cursor, .vscode) and sets them up without a terminal too; the other presets preselect none.",
|
|
66
|
+
"oneOf": [
|
|
67
|
+
{ "type": "string" },
|
|
68
|
+
{
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": { "type": "string", "enum": ["claude", "cursor", "vscode"] },
|
|
71
|
+
"uniqueItems": true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"yes": {
|
|
76
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
77
|
+
"description": "Apply the plan to an existing app without asking for confirmation first."
|
|
78
|
+
},
|
|
79
|
+
"prompts": {
|
|
80
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
81
|
+
"description": "Ask the detection-dependent questions when a terminal is attached. Pass false in CI runs under a pseudo-terminal; flags, the recorded answers of a re-run and the preset defaults answer instead.",
|
|
82
|
+
"default": true
|
|
83
|
+
},
|
|
84
|
+
"quiet": {
|
|
85
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
86
|
+
"description": "Print only the summary, not the planned changes.",
|
|
87
|
+
"default": false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"required": []
|
|
91
|
+
}
|
package/stepper/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The presenter is a pure-derivation host directive - every visible piece of state
|
|
|
30
30
|
| `CNGX_STEP_PANEL_HOST` | Rendering-surface contract for organisms. Provides `flatSteps` / `activeStepIndex` / `activeStepId` Signals plus `labelTemplateFor(id)` / `contentTemplateFor(id)` template lookups. |
|
|
31
31
|
| `CNGX_STEPPER_CONFIG` | App-wide stepper configuration token (defaults, ARIA labels, fallback labels, router-sync mode). |
|
|
32
32
|
| `CNGX_STEPPER_I18N` | I18n bundle token, a `Signal` (default English; consumers override via `provideStepperI18n`). |
|
|
33
|
-
| `CNGX_STEPPER_COMMIT_HANDLER_FACTORY` | Pluggable async-commit handler factory. Default: `createStepperCommitHandler`. Override for telemetry / retry / offline-queue without forking. |
|
|
33
|
+
| `CNGX_STEPPER_COMMIT_HANDLER_FACTORY` | Pluggable async-commit handler factory. Default: `createStepperCommitHandler`. Override for telemetry / retry / offline-queue without forking. A handler calls `onResolve('accepted' \| 'refused' \| 'failed')`: `true` accepts, `false` refuses, a throw / rejection / error fails. |
|
|
34
34
|
|
|
35
35
|
### Configuration cascade
|
|
36
36
|
|
|
@@ -62,7 +62,8 @@ To translate the whole app, set a language pack with `provideCngxI18n(withPack(.
|
|
|
62
62
|
|
|
63
63
|
| Export | Description |
|
|
64
64
|
|-|-|
|
|
65
|
-
| `createStepperCommitHandler({ controller })` | Factory for the async-commit state-machine adapter. Default `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`. |
|
|
65
|
+
| `createStepperCommitHandler({ controller })` | Factory for the async-commit state-machine adapter. Default `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`. Routes a `false` answer to the controller's refusal path, so the commit state goes `'idle'` and keeps its data. |
|
|
66
|
+
| `CngxStepperCommitResolution` | `'accepted' \| 'refused' \| 'failed'`, the outcome a commit handler reports. |
|
|
66
67
|
|
|
67
68
|
## Usage
|
|
68
69
|
|
|
@@ -98,7 +99,7 @@ class WizardCmp {
|
|
|
98
99
|
| `withStepperMobileCollapse(mode)` | Choose the auto-collapse target for a narrow **container** (below `30rem` of the stepper's own width, not the viewport): `'text'` (default, renders `<cngx-text-stepper>`) / `'dots'` (renders `<cngx-dot-stepper>`) / `'off'` (keep the classic strip at every width). The threshold itself is a `@container` rule in `stepper-base.css`, overridable in consumer CSS - see the `@cngx/ui/stepper` README. The Material twin ignores this setting. |
|
|
99
100
|
| `withStepperHeaderNavigation(mode)` | Set the header-navigation policy: `'none'` (inert label headers, footer-only navigation) / `'visited'` (default - focusable header buttons gated by `linear`). Per-instance `[headerNavigation]` wins. |
|
|
100
101
|
| `withStepErrorTemplate(tpl)` | App-wide default for the `*cngxStepError` slot - the per-step validation message rendered in a row below the strip. Per-instance `*cngxStepError` directive wins. |
|
|
101
|
-
| `withStepperI18nLabels({ statusLabels })` | Override the per-state pill labels
|
|
102
|
+
| `withStepperI18nLabels({ statusLabels })` | Override the per-state status words: `{ done, inProgress, upNext, errored, refused }`. The first four are the pill labels of the `stripe-status-rich` skin; `refused` names a refused step in its accessible name and in the minimal skins' error line. Partial overrides keep unset keys at the English default. |
|
|
102
103
|
| `withStepperI18nLabels({ textStepperFormat })` | Override the short format used by `CngxProgressBarStepper`'s caption and by `CngxTextStepper`. Signature: `(current: number, total: number) => string`; default `(c, t) => 'Step ' + c + ' of ' + t`. |
|
|
103
104
|
|
|
104
105
|
```ts
|
|
@@ -147,6 +148,6 @@ bootstrapApplication(AppComponent, {
|
|
|
147
148
|
A step carries an error through two independent channels:
|
|
148
149
|
|
|
149
150
|
- **Validation** - a direct `[error]` input on `cngxStep` (`true` or a message string), or an `[errorAggregator]` for genuine multi-source forms. Both fold into the step's `state` (`'error'`) with no async machine. The state shows on every skin via the indicator / badge; the reason text surfaces in a row below the strip via the `*cngxStepError` slot (or the aggregate line on the text / dot / progress variants), but only for a real message - a bare `[error]="true"` shows state only. `[error]="'message'"` wins over the first aggregator label, which wins over the i18n `errored` word.
|
|
150
|
-
- **Commit / async** - a `commitAction` that rejects
|
|
151
|
+
- **Commit / async** - a `commitAction` that answers `false` refuses the step change, one that throws, rejects or errors fails it. Both roll the step back, set `lastFailedIndex` and decorate the step via `*cngxStepRejection` (its context carries `reason: 'refused' | 'failed'`); `lastOutcome()` tells them apart. A failure leaves `commitState` at `'error'` and reaches the `CngxToastOn` / `CngxBannerOn` bridges. A refusal is not a failure: `commitState` goes `'idle'` and keeps its data, the bridges stay silent, and the stepper speaks `commitRefused` once. An app that wants a toast for a refusal shows it from its own `commitAction` (for example `severity: 'warning'`) before it returns `false`. The stepper keeps only the outcome of the most recent commit, not a history: `lastOutcome()` and the rejection marker describe the latest attempt, and the next attempt replaces them. When that attempt lands or refuses, the commit state leaves `'error'`, so the earlier error and its `CngxBannerOn` banner clear as well; when it fails, the new failure takes their place. `reset()` clears the outcome, `clearLastFailed()` clears only the marker. A state that must stay on a step until it is fixed is a validation error (`[error]` or an `[errorAggregator]`), which every step holds independently.
|
|
151
152
|
|
|
152
153
|
The two never collide: validation owns `*cngxStepError`, commit owns `*cngxStepRejection`. The `[error]` input replaces the old `<fieldset cngxErrorAggregator><input cngxErrorSource>` boilerplate for the common "this step is invalid" case; the aggregator stays the power path. See `@cngx/ui/stepper` for the per-skin text-surface table.
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview
|
|
3
|
+
* Sheet and fullscreen presentation for `[cngxPopoverSheet]` popovers.
|
|
4
|
+
*
|
|
5
|
+
* **Breakpoint**
|
|
6
|
+
*
|
|
7
|
+
* Written once, here: `(pointer: coarse) and (max-width: 48rem)` sets
|
|
8
|
+
* `--cngx-popover-sheet-breakpoint` to `1` on the root, otherwise `0`.
|
|
9
|
+
* `CngxPopoverSheet` reads that property to resolve its `'auto'` request;
|
|
10
|
+
* no TypeScript length constant exists. A viewport query is admitted here
|
|
11
|
+
* because it decides overlay modality, not in-flow layout
|
|
12
|
+
* (responsive-by-default rule 2).
|
|
13
|
+
*
|
|
14
|
+
* **Presentations**
|
|
15
|
+
*
|
|
16
|
+
* Visuals key only on `data-cngx-presentation`, which the directive writes:
|
|
17
|
+
*
|
|
18
|
+
* - `sheet` - bottom-flush, full inline size, content-sized up to
|
|
19
|
+
* `--cngx-popover-sheet-max-block-size`, dimmed `::backdrop`
|
|
20
|
+
* - `fullscreen` - fills the dynamic viewport (`100dvh`)
|
|
21
|
+
* - `anchored` - untouched; the popover keeps its anchored layout
|
|
22
|
+
*
|
|
23
|
+
* In both non-anchored presentations the host is a non-scrolling flex
|
|
24
|
+
* column: the `cngxPopoverSheetHeader` part stays put and every other
|
|
25
|
+
* direct child scrolls. A swipe region inside a scrolling panel never
|
|
26
|
+
* fires, so only the content below the header may scroll.
|
|
27
|
+
*
|
|
28
|
+
* **Settling**
|
|
29
|
+
*
|
|
30
|
+
* While `data-cngx-sheet-settling` is present (the first frames after open,
|
|
31
|
+
* until the panel rect is stable) the host is transparent and holds the
|
|
32
|
+
* slide start state without a transition, so the one-frame offset of the
|
|
33
|
+
* pinned scroll lock on iOS is never visible. The slide starts when the
|
|
34
|
+
* attribute is removed. Opacity keeps the initial focus target focusable.
|
|
35
|
+
*
|
|
36
|
+
* **Safe area**
|
|
37
|
+
*
|
|
38
|
+
* Inline padding is the larger of the token and both horizontal safe-area
|
|
39
|
+
* insets, on both edges, so it stays correct in RTL and in either landscape
|
|
40
|
+
* rotation; the block end pads `env(safe-area-inset-bottom)`. Edge-to-edge
|
|
41
|
+
* landscape on iOS needs the app to opt into `viewport-fit=cover`.
|
|
42
|
+
*
|
|
43
|
+
* **Defaults**
|
|
44
|
+
*
|
|
45
|
+
* The defaults match `CngxBottomSheet` and `CngxDialog` (16px top corners,
|
|
46
|
+
* 80dvh cap, a 40 x 4px handle pill centred on its own row, the dialog
|
|
47
|
+
* shadow, a 50% black backdrop), with phone-sized padding: 16px from
|
|
48
|
+
* `--cngx-space-md`.
|
|
49
|
+
*
|
|
50
|
+
* **Dark mode**
|
|
51
|
+
*
|
|
52
|
+
* Three hooks (`prefers-color-scheme: dark`, `[data-color-scheme="dark"]`,
|
|
53
|
+
* `.dark`) deepen the shadow and dim the handle.
|
|
54
|
+
*
|
|
55
|
+
* **Pair with**
|
|
56
|
+
*
|
|
57
|
+
* - `@cngx/themes/material/popover-sheet-theme` - Material 3 surface
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
@layer cngx.tokens {
|
|
61
|
+
/**
|
|
62
|
+
* Maximum block size of the `sheet` presentation. Room above it keeps
|
|
63
|
+
* the page visible behind the backdrop.
|
|
64
|
+
* @group Layout
|
|
65
|
+
*/
|
|
66
|
+
@property --cngx-popover-sheet-max-block-size {
|
|
67
|
+
syntax: '*';
|
|
68
|
+
inherits: false;
|
|
69
|
+
initial-value: 80dvh;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Corner radius shorthand of the `sheet` presentation. Rounded top
|
|
74
|
+
* corners only, matching the bottom-anchored anatomy.
|
|
75
|
+
* @group Layout
|
|
76
|
+
*/
|
|
77
|
+
@property --cngx-popover-sheet-radius {
|
|
78
|
+
syntax: '*';
|
|
79
|
+
inherits: false;
|
|
80
|
+
initial-value: 16px 16px 0 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Padding inside the panel. SET from `--cngx-space-md` on the host, so
|
|
85
|
+
* density reaches it; the safe-area insets win where they are larger.
|
|
86
|
+
* @group Layout
|
|
87
|
+
*/
|
|
88
|
+
@property --cngx-popover-sheet-padding {
|
|
89
|
+
syntax: '<length>';
|
|
90
|
+
inherits: true;
|
|
91
|
+
initial-value: 16px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Gap between the items of the header row and below it. SET from
|
|
96
|
+
* `--cngx-space-sm`.
|
|
97
|
+
* @group Layout
|
|
98
|
+
*/
|
|
99
|
+
@property --cngx-popover-sheet-header-gap {
|
|
100
|
+
syntax: '<length>';
|
|
101
|
+
inherits: true;
|
|
102
|
+
initial-value: 8px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Inline size of the decorative handle pill.
|
|
107
|
+
* @group Handle
|
|
108
|
+
*/
|
|
109
|
+
@property --cngx-popover-sheet-handle-inline-size {
|
|
110
|
+
syntax: '<length>';
|
|
111
|
+
inherits: true;
|
|
112
|
+
initial-value: 40px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Block size of the decorative handle pill.
|
|
117
|
+
* @group Handle
|
|
118
|
+
*/
|
|
119
|
+
@property --cngx-popover-sheet-handle-block-size {
|
|
120
|
+
syntax: '<length>';
|
|
121
|
+
inherits: true;
|
|
122
|
+
initial-value: 4px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Corner radius of the decorative handle pill.
|
|
127
|
+
* @group Handle
|
|
128
|
+
*/
|
|
129
|
+
@property --cngx-popover-sheet-handle-radius {
|
|
130
|
+
syntax: '<length>';
|
|
131
|
+
inherits: true;
|
|
132
|
+
initial-value: 2px;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Margin shorthand around the handle pill: centres it and pushes the
|
|
137
|
+
* header row down. SET from `--cngx-space-md` on the host.
|
|
138
|
+
* @group Handle
|
|
139
|
+
*/
|
|
140
|
+
@property --cngx-popover-sheet-handle-margin {
|
|
141
|
+
syntax: '*';
|
|
142
|
+
inherits: true;
|
|
143
|
+
initial-value: 0 auto 16px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Fill of the decorative handle pill. `inherits: true` so the root
|
|
148
|
+
* dark-mode value reaches the handle part.
|
|
149
|
+
* @group Handle
|
|
150
|
+
*/
|
|
151
|
+
@property --cngx-popover-sheet-handle-color {
|
|
152
|
+
syntax: '<color>';
|
|
153
|
+
inherits: true;
|
|
154
|
+
initial-value: oklch(0.8 0.005 250);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Panel surface. SET from `--cngx-color-surface` on the host.
|
|
159
|
+
* @group Surface
|
|
160
|
+
*/
|
|
161
|
+
@property --cngx-popover-sheet-surface {
|
|
162
|
+
syntax: '<color>';
|
|
163
|
+
inherits: false;
|
|
164
|
+
initial-value: oklch(1 0 0);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Panel text colour. SET from `--cngx-color-text` on the host.
|
|
169
|
+
* @group Surface
|
|
170
|
+
*/
|
|
171
|
+
@property --cngx-popover-sheet-color {
|
|
172
|
+
syntax: '<color>';
|
|
173
|
+
inherits: false;
|
|
174
|
+
initial-value: oklch(0.2 0 0);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Drop shadow of the `sheet` presentation, the `CngxDialog` elevation.
|
|
179
|
+
* `inherits: true` so the dark-mode value set on the root reaches the host.
|
|
180
|
+
* @group Surface
|
|
181
|
+
*/
|
|
182
|
+
@property --cngx-popover-sheet-shadow {
|
|
183
|
+
syntax: '*';
|
|
184
|
+
inherits: true;
|
|
185
|
+
initial-value: 0 8px 32px oklch(0 0 0 / 0.12);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Dimming paint of the `sheet` `::backdrop`. Paint only: taps outside
|
|
190
|
+
* the panel are handled by the directive, not by the backdrop.
|
|
191
|
+
* `inherits: true` so the host value reaches the pseudo-element.
|
|
192
|
+
* @group Surface
|
|
193
|
+
*/
|
|
194
|
+
@property --cngx-popover-sheet-backdrop {
|
|
195
|
+
syntax: '<color>';
|
|
196
|
+
inherits: true;
|
|
197
|
+
initial-value: oklch(0 0 0 / 0.5);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Duration of the slide in and out. SET from `--cngx-duration-base`.
|
|
202
|
+
* @group Motion
|
|
203
|
+
* @relatedTo provideMotion, CngxMotionScope, injectMotion
|
|
204
|
+
*/
|
|
205
|
+
@property --cngx-popover-sheet-duration {
|
|
206
|
+
syntax: '<time>';
|
|
207
|
+
inherits: false;
|
|
208
|
+
initial-value: 200ms;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Easing curve of the slide in and out.
|
|
213
|
+
* @group Motion
|
|
214
|
+
*/
|
|
215
|
+
@property --cngx-popover-sheet-easing {
|
|
216
|
+
syntax: '*';
|
|
217
|
+
inherits: false;
|
|
218
|
+
initial-value: ease;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* SET-from-scale: the registered initial values above win over a read-site
|
|
222
|
+
* var() fallback, so density, motion and foundation colour reach the sheet
|
|
223
|
+
* only through these host SETs. */
|
|
224
|
+
:where(.cngx-popover-sheet) {
|
|
225
|
+
--cngx-popover-sheet-padding: var(--cngx-space-md);
|
|
226
|
+
--cngx-popover-sheet-header-gap: var(--cngx-space-sm);
|
|
227
|
+
--cngx-popover-sheet-handle-margin: 0 auto var(--cngx-space-md);
|
|
228
|
+
--cngx-popover-sheet-duration: var(--cngx-duration-base);
|
|
229
|
+
--cngx-popover-sheet-surface: var(--cngx-color-surface);
|
|
230
|
+
--cngx-popover-sheet-color: var(--cngx-color-text);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media (prefers-color-scheme: dark) {
|
|
234
|
+
:root:not([data-color-scheme='light']):not(.light) {
|
|
235
|
+
--cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.5);
|
|
236
|
+
--cngx-popover-sheet-handle-color: oklch(0.5 0.005 250);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
[data-color-scheme='dark'],
|
|
240
|
+
.dark {
|
|
241
|
+
--cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.5);
|
|
242
|
+
--cngx-popover-sheet-handle-color: oklch(0.5 0.005 250);
|
|
243
|
+
}
|
|
244
|
+
[data-color-scheme='light'],
|
|
245
|
+
.light {
|
|
246
|
+
--cngx-popover-sheet-shadow: 0 8px 32px oklch(0 0 0 / 0.12);
|
|
247
|
+
--cngx-popover-sheet-handle-color: oklch(0.8 0.005 250);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@layer cngx.components {
|
|
252
|
+
/* The breakpoint, written once, on the root: every sheet shares one
|
|
253
|
+
* observer that reads it there. Unregistered on purpose: the directive
|
|
254
|
+
* reads the raw value. */
|
|
255
|
+
:root {
|
|
256
|
+
--cngx-popover-sheet-breakpoint: 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@media (pointer: coarse) and (max-width: 48rem) {
|
|
260
|
+
:root {
|
|
261
|
+
--cngx-popover-sheet-breakpoint: 1;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
|
|
266
|
+
position: fixed;
|
|
267
|
+
inset: auto 0 0 0;
|
|
268
|
+
margin: 0;
|
|
269
|
+
box-sizing: border-box;
|
|
270
|
+
inline-size: 100%;
|
|
271
|
+
max-inline-size: 100%;
|
|
272
|
+
min-inline-size: 0;
|
|
273
|
+
max-block-size: var(--cngx-popover-sheet-max-block-size, 80dvh);
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
border: 0;
|
|
277
|
+
border-radius: var(--cngx-popover-sheet-radius, 16px 16px 0 0);
|
|
278
|
+
padding-block: var(--cngx-popover-sheet-padding, 16px)
|
|
279
|
+
max(var(--cngx-popover-sheet-padding, 16px), env(safe-area-inset-bottom, 0px));
|
|
280
|
+
/* Symmetric on purpose: the notch side flips with the device rotation,
|
|
281
|
+
* and the larger inset on both edges stays correct in RTL. */
|
|
282
|
+
padding-inline: max(
|
|
283
|
+
var(--cngx-popover-sheet-padding, 16px),
|
|
284
|
+
env(safe-area-inset-left, 0px),
|
|
285
|
+
env(safe-area-inset-right, 0px)
|
|
286
|
+
);
|
|
287
|
+
background: var(--cngx-popover-sheet-surface, oklch(1 0 0));
|
|
288
|
+
color: var(--cngx-popover-sheet-color, oklch(0.2 0 0));
|
|
289
|
+
box-shadow: var(--cngx-popover-sheet-shadow, 0 8px 32px oklch(0 0 0 / 0.12));
|
|
290
|
+
translate: 0 0;
|
|
291
|
+
transition:
|
|
292
|
+
translate var(--cngx-popover-sheet-duration, 200ms) var(--cngx-popover-sheet-easing, ease),
|
|
293
|
+
opacity var(--cngx-popover-sheet-duration, 200ms) var(--cngx-popover-sheet-easing, ease);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Open only: a display value on the closed host would override the UA
|
|
297
|
+
* `[popover]:not(:popover-open) { display: none }` and keep it rendered. */
|
|
298
|
+
.cngx-popover-sheet:is(
|
|
299
|
+
[data-cngx-presentation='sheet'],
|
|
300
|
+
[data-cngx-presentation='fullscreen']
|
|
301
|
+
):popover-open {
|
|
302
|
+
display: flex;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.cngx-popover-sheet[data-cngx-presentation='fullscreen'] {
|
|
306
|
+
inset: 0;
|
|
307
|
+
block-size: 100dvh;
|
|
308
|
+
max-block-size: 100dvh;
|
|
309
|
+
border-radius: 0;
|
|
310
|
+
padding-block-start: max(
|
|
311
|
+
var(--cngx-popover-sheet-padding, 16px),
|
|
312
|
+
env(safe-area-inset-top, 0px)
|
|
313
|
+
);
|
|
314
|
+
box-shadow: none;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.cngx-popover-sheet[data-cngx-presentation='sheet']::backdrop {
|
|
318
|
+
background: var(--cngx-popover-sheet-backdrop, oklch(0 0 0 / 0.5));
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/* Slide start and end state. Opening holds it until the popover flips to
|
|
322
|
+
* open on the next frame; closing returns to it, and CngxPopover waits
|
|
323
|
+
* for the transition before hiding. */
|
|
324
|
+
.cngx-popover-sheet:is(
|
|
325
|
+
[data-cngx-presentation='sheet'],
|
|
326
|
+
[data-cngx-presentation='fullscreen']
|
|
327
|
+
):is(.cngx-popover--opening, .cngx-popover--closing) {
|
|
328
|
+
translate: 0 100%;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.cngx-popover-sheet:is(
|
|
332
|
+
[data-cngx-presentation='sheet'],
|
|
333
|
+
[data-cngx-presentation='fullscreen']
|
|
334
|
+
)[data-cngx-sheet-settling] {
|
|
335
|
+
opacity: 0;
|
|
336
|
+
translate: 0 100%;
|
|
337
|
+
transition: none;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* Only the content below the header scrolls: a swipe region inside a
|
|
341
|
+
* scrolling panel never fires. */
|
|
342
|
+
.cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen'])
|
|
343
|
+
> * {
|
|
344
|
+
flex: 1 1 auto;
|
|
345
|
+
min-block-size: 0;
|
|
346
|
+
overflow: auto;
|
|
347
|
+
overscroll-behavior: contain;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* Handle on its own row, title and controls on the next one. */
|
|
351
|
+
.cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen'])
|
|
352
|
+
> .cngx-popover-sheet-header {
|
|
353
|
+
flex: none;
|
|
354
|
+
overflow: visible;
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-wrap: wrap;
|
|
357
|
+
align-items: center;
|
|
358
|
+
gap: var(--cngx-popover-sheet-header-gap, 8px);
|
|
359
|
+
padding-block-end: var(--cngx-popover-sheet-header-gap, 8px);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.cngx-popover-sheet-handle {
|
|
363
|
+
display: none;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
.cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle {
|
|
367
|
+
display: block;
|
|
368
|
+
flex: 0 0 100%;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle::before {
|
|
372
|
+
content: '';
|
|
373
|
+
display: block;
|
|
374
|
+
inline-size: var(--cngx-popover-sheet-handle-inline-size, 40px);
|
|
375
|
+
block-size: var(--cngx-popover-sheet-handle-block-size, 4px);
|
|
376
|
+
margin: var(--cngx-popover-sheet-handle-margin, 0 auto 16px);
|
|
377
|
+
border-radius: var(--cngx-popover-sheet-handle-radius, 2px);
|
|
378
|
+
background: var(--cngx-popover-sheet-handle-color, oklch(0.8 0.005 250));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@media (prefers-reduced-motion: reduce) {
|
|
383
|
+
.cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
|
|
384
|
+
transition: none;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* forced-colors (WHCM): the sheet surface is bounded by a box-shadow only,
|
|
389
|
+
* which the forced palette strips, and the handle is a background bar that
|
|
390
|
+
* flattens to Canvas. Re-draw the top edge and the handle with CanvasText.
|
|
391
|
+
* Unlayered to beat the layered component rules. */
|
|
392
|
+
@media (forced-colors: active) {
|
|
393
|
+
.cngx-popover-sheet:is([data-cngx-presentation='sheet'], [data-cngx-presentation='fullscreen']) {
|
|
394
|
+
background: Canvas;
|
|
395
|
+
color: CanvasText;
|
|
396
|
+
border-block-start: 1px solid CanvasText;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.cngx-popover-sheet[data-cngx-presentation='sheet'] .cngx-popover-sheet-handle::before {
|
|
400
|
+
background: CanvasText;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
*
|
|
5
5
|
* A `CngxPopover` host is a native popover element (`[attr.popover]`), so the
|
|
6
6
|
* browser paints its UA chrome - a `3px solid` border, a `Canvas` background
|
|
7
|
-
* and `0.25em` padding. `CngxPopoverPanel
|
|
8
|
-
* own surface, but a *bare* popover (a menu placed
|
|
9
|
-
* e.g. a headless context menu) inherits that UA
|
|
10
|
-
* unstyled black-bordered box.
|
|
7
|
+
* and `0.25em` padding. `CngxPopoverPanel`, the select panels and the tabs
|
|
8
|
+
* overflow menu paint their own surface, but a *bare* popover (a menu placed
|
|
9
|
+
* directly in `[cngxPopover]`, e.g. a headless context menu) inherits that UA
|
|
10
|
+
* chrome and reads as an unstyled black-bordered box.
|
|
11
11
|
*
|
|
12
12
|
* Neutralise the chrome on hosts that carry no surface of their own; the
|
|
13
13
|
* styled surfaces are excluded by class so they keep their own paint. Only the
|
|
14
14
|
* chrome is reset - positioning (`inset`, `position-anchor`, the host's inline
|
|
15
|
-
* `margin`) is owned by `CngxPopover` and left untouched.
|
|
15
|
+
* `margin`) is owned by `CngxPopover` and left untouched. A `cngxPopoverSheet`
|
|
16
|
+
* in its sheet or fullscreen presentation paints its own surface
|
|
17
|
+
* (`cngx-popover-sheet.css`), so it is excluded too.
|
|
16
18
|
*/
|
|
17
19
|
@layer cngx.components {
|
|
18
|
-
[cngxPopover]:not(.cngx-popover-panel):not(.cngx-select__panel)
|
|
20
|
+
[cngxPopover]:not(.cngx-popover-panel):not(.cngx-select__panel):not(
|
|
21
|
+
.cngx-tab-overflow__panel
|
|
22
|
+
):not([data-cngx-presentation='sheet']):not([data-cngx-presentation='fullscreen']) {
|
|
19
23
|
border: 0;
|
|
20
24
|
padding: 0;
|
|
21
25
|
background: transparent;
|