rikiki-deck 0.6.0 → 0.7.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/.claude/skills/rikiki-debug/SKILL.md +17 -7
- package/.claude/skills/rikiki-deck/SKILL.md +362 -77
- package/.claude/skills/rikiki-theme/SKILL.md +1 -1
- package/README.md +69 -50
- package/bin/lib/assemble.mjs +154 -0
- package/bin/lib/box-geometry.mjs +66 -0
- package/bin/lib/browser.mjs +302 -0
- package/bin/lib/check-api.d.ts +28 -0
- package/bin/lib/check-api.mjs +6 -0
- package/bin/lib/check-plugins.mjs +228 -0
- package/bin/lib/check.mjs +1347 -0
- package/bin/lib/cli-error.mjs +26 -0
- package/bin/lib/component-deps.mjs +69 -0
- package/bin/lib/diff.mjs +275 -0
- package/bin/lib/export-pdf.mjs +65 -0
- package/bin/lib/graph-hit.mjs +86 -0
- package/bin/lib/inline.mjs +137 -39
- package/bin/lib/narrative.mjs +77 -0
- package/bin/lib/prune-icons.mjs +104 -0
- package/bin/lib/render.mjs +195 -0
- package/bin/lib/scan-external.mjs +126 -0
- package/bin/lib/starter.mjs +27 -14
- package/bin/lib/visual.mjs +120 -0
- package/bin/rikiki.mjs +420 -35
- package/dist/annotation-marks.d.ts +60 -0
- package/dist/annotation-marks.js +1 -0
- package/dist/bar-segments.d.ts +28 -0
- package/dist/bar-segments.js +1 -0
- package/dist/browser-location.d.ts +3 -0
- package/dist/browser-location.js +1 -0
- package/dist/cards-syntax.d.ts +31 -0
- package/dist/cards-syntax.js +6 -0
- package/dist/{plugins/click-stages.d.ts → click-stages.d.ts} +1 -1
- package/dist/deck-agenda.d.ts +25 -0
- package/dist/deck-agenda.js +6 -0
- package/dist/deck-annotate.d.ts +108 -0
- package/dist/deck-annotate.js +18 -0
- package/dist/deck-bar.d.ts +32 -0
- package/dist/deck-bar.js +19 -0
- package/dist/deck-bento.d.ts +38 -0
- package/dist/deck-bento.js +4 -0
- package/dist/{molecules/deck-callout.d.ts → deck-callout.d.ts} +2 -0
- package/dist/deck-callout.js +1 -1
- package/dist/deck-cell.d.ts +19 -0
- package/dist/deck-cell.js +1 -0
- package/dist/deck-checklist.d.ts +20 -0
- package/dist/deck-checklist.js +1 -0
- package/dist/{layouts/deck-cover.d.ts → deck-cover.d.ts} +8 -0
- package/dist/deck-cover.js +9 -6
- package/dist/deck-csv.d.ts +38 -0
- package/dist/deck-csv.js +15 -0
- package/dist/deck-feature-cards.js +2 -2
- package/dist/deck-feature.d.ts +18 -0
- package/dist/deck-feature.js +2 -2
- package/dist/deck-figure.d.ts +26 -0
- package/dist/deck-figure.js +8 -0
- package/dist/deck-fit.d.ts +14 -0
- package/dist/deck-fit.js +1 -0
- package/dist/deck-flow.d.ts +41 -0
- package/dist/deck-flow.js +7 -0
- package/dist/deck-graph.d.ts +92 -0
- package/dist/deck-graph.js +25 -0
- package/dist/deck-grid.js +1 -1
- package/dist/deck-icon.d.ts +20 -0
- package/dist/deck-icon.js +1 -0
- package/dist/{atoms/deck-kicker.d.ts → deck-kicker.d.ts} +5 -0
- package/dist/deck-kicker.js +1 -1
- package/dist/deck-kpi-grid.d.ts +26 -0
- package/dist/deck-kpi-grid.js +4 -0
- package/dist/deck-link.d.ts +21 -0
- package/dist/deck-link.js +1 -0
- package/dist/{molecules/deck-md.d.ts → deck-md.d.ts} +3 -0
- package/dist/deck-md.js +8 -3
- package/dist/deck-mermaid.js +15 -3
- package/dist/deck-outline.d.ts +50 -0
- package/dist/deck-outline.js +1 -0
- package/dist/deck-overview.js +53 -39
- package/dist/deck-persona.d.ts +31 -0
- package/dist/deck-persona.js +6 -0
- package/dist/deck-photo.js +1 -1
- package/dist/deck-point.d.ts +22 -0
- package/dist/deck-point.js +1 -0
- package/dist/deck-presenter.js +120 -48
- package/dist/deck-pull.d.ts +13 -0
- package/dist/deck-pull.js +1 -0
- package/dist/{atoms/deck-punch.d.ts → deck-punch.d.ts} +6 -0
- package/dist/deck-punch.js +1 -1
- package/dist/deck-quote.d.ts +28 -0
- package/dist/deck-quote.js +6 -0
- package/dist/{runtime/deck-root.d.ts → deck-root.d.ts} +88 -8
- package/dist/deck-root.js +17 -13
- package/dist/deck-section.js +2 -2
- package/dist/deck-source.d.ts +12 -0
- package/dist/deck-source.js +2 -0
- package/dist/deck-split.d.ts +30 -0
- package/dist/deck-split.js +5 -3
- package/dist/{molecules/deck-stat.d.ts → deck-stat.d.ts} +2 -0
- package/dist/deck-stat.js +2 -2
- package/dist/{molecules/deck-step-list.d.ts → deck-step-list.d.ts} +8 -0
- package/dist/deck-step-list.js +4 -2
- package/dist/deck-table.d.ts +26 -0
- package/dist/deck-table.js +1 -0
- package/dist/deck-takeaway.d.ts +18 -0
- package/dist/deck-takeaway.js +2 -2
- package/dist/deck-timeline.d.ts +37 -0
- package/dist/deck-timeline.js +5 -0
- package/dist/deck-transition.js +3 -3
- package/dist/deck-versus.d.ts +18 -0
- package/dist/deck-versus.js +9 -0
- package/dist/deep-link.d.ts +29 -0
- package/dist/deep-link.js +1 -0
- package/dist/escape-html.d.ts +3 -0
- package/dist/escape-html.js +1 -0
- package/dist/fit-controller.d.ts +27 -0
- package/dist/fit-controller.js +1 -0
- package/dist/graph-layout.d.ts +35 -0
- package/dist/graph-layout.js +1 -0
- package/dist/grid-tracks.d.ts +17 -0
- package/dist/grid-tracks.js +1 -0
- package/dist/icon-set.d.ts +6 -0
- package/dist/icon-set.js +1 -0
- package/dist/index.d.ts +37 -31
- package/dist/index.js +95 -49
- package/dist/keymap.d.ts +40 -0
- package/dist/keymap.js +1 -0
- package/dist/mouse-nav.d.ts +12 -0
- package/dist/mouse-nav.js +1 -0
- package/dist/navigation.d.ts +25 -0
- package/dist/navigation.js +1 -0
- package/dist/parse-csv.d.ts +9 -0
- package/dist/parse-csv.js +3 -0
- package/dist/shared-styles.js +1 -1
- package/dist/shiki.d.ts +8 -0
- package/dist/signature.d.ts +2 -0
- package/dist/signature.js +1 -0
- package/dist/slide-fill.d.ts +8 -0
- package/dist/slide-fill.js +1 -0
- package/dist/standalone.js +301 -169
- package/dist/vendor/THIRD-PARTY-NOTICES.txt +4347 -0
- package/dist/vendor/inventory.json +3029 -0
- package/dist/vendor/lit.js +62 -2
- package/dist/vendor/mermaid.min.js +95 -95
- package/dist/vendor/shiki.js +1 -57
- package/dist/viewport.d.ts +42 -0
- package/dist/viewport.js +1 -0
- package/docs/llms/rikiki-reference.md +955 -64
- package/docs/llms/rikiki-workflow.md +536 -0
- package/llms.txt +39 -12
- package/package.json +33 -12
- package/themes/rikiki.css +173 -47
- package/themes/siliceum.css +171 -51
- package/dist/layouts/deck-feature.d.ts +0 -11
- package/dist/layouts/deck-split.d.ts +0 -18
- package/dist/layouts/deck-takeaway.d.ts +0 -11
- package/dist/plugins/shiki.d.ts +0 -8
- /package/dist/{runtime/color.d.ts → color.d.ts} +0 -0
- /package/dist/{atoms/deck-badge.d.ts → deck-badge.d.ts} +0 -0
- /package/dist/{molecules/deck-card.d.ts → deck-card.d.ts} +0 -0
- /package/dist/{atoms/deck-code-highlighter.d.ts → deck-code-highlighter.d.ts} +0 -0
- /package/dist/{atoms/deck-code.d.ts → deck-code.d.ts} +0 -0
- /package/dist/{layouts/deck-feature-cards.d.ts → deck-feature-cards.d.ts} +0 -0
- /package/dist/{molecules/deck-grid.d.ts → deck-grid.d.ts} +0 -0
- /package/dist/{runtime/deck-help.d.ts → deck-help.d.ts} +0 -0
- /package/dist/{molecules/deck-mermaid.d.ts → deck-mermaid.d.ts} +0 -0
- /package/dist/{molecules/deck-metric.d.ts → deck-metric.d.ts} +0 -0
- /package/dist/{runtime/deck-notes.d.ts → deck-notes.d.ts} +0 -0
- /package/dist/{runtime/deck-overview.d.ts → deck-overview.d.ts} +0 -0
- /package/dist/{layouts/deck-photo.d.ts → deck-photo.d.ts} +0 -0
- /package/dist/{runtime/deck-presenter.d.ts → deck-presenter.d.ts} +0 -0
- /package/dist/{layouts/deck-section.d.ts → deck-section.d.ts} +0 -0
- /package/dist/{molecules/deck-shortcut.d.ts → deck-shortcut.d.ts} +0 -0
- /package/dist/{molecules/deck-stack.d.ts → deck-stack.d.ts} +0 -0
- /package/dist/{molecules/deck-tier-list.d.ts → deck-tier-list.d.ts} +0 -0
- /package/dist/{runtime/deck-transition.d.ts → deck-transition.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o={read(){return typeof location>"u"?"":location.hash},write(t){if(!(typeof history>"u"))try{history.replaceState(null,"",t)}catch{}}};export{o as browserLocation};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface CardOpts {
|
|
2
|
+
cols?: number;
|
|
3
|
+
gap?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Card {
|
|
6
|
+
tone?: string;
|
|
7
|
+
span?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
body: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CardRender {
|
|
12
|
+
/** Render a card title (inline markdown). */
|
|
13
|
+
inline: (s: string) => string;
|
|
14
|
+
/** Render a card body (block markdown). */
|
|
15
|
+
block: (s: string) => string;
|
|
16
|
+
}
|
|
17
|
+
/** Parse the `::: cards <opts>` option string · `cols=N gap=N`. */
|
|
18
|
+
export declare function parseCardOpts(raw: string): CardOpts;
|
|
19
|
+
/** Lint `::: cards` fences in a markdown source · returns an error message for
|
|
20
|
+
* an unclosed block, or null when balanced. */
|
|
21
|
+
export declare function lintCards(md: string): string | null;
|
|
22
|
+
/** Parse the inner text of a cards block into card records. */
|
|
23
|
+
export declare function parseCards(inner: string): Card[];
|
|
24
|
+
/** Replace every `::: cards … :::` block with an HTML-comment placeholder and
|
|
25
|
+
* return the pre-rendered grid HTML for each · the caller runs marked on the
|
|
26
|
+
* returned text, then swaps each `<!--cards:i-->` for its block. Placeholders
|
|
27
|
+
* are HTML comments so marked passes them through untouched. */
|
|
28
|
+
export declare function expandCards(src: string, render: CardRender): {
|
|
29
|
+
text: string;
|
|
30
|
+
blocks: string[];
|
|
31
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function a(t){if(!t)return"auto";let n=t.trim();return/^\d+$/.test(n)?`span ${n}`:n}function p(t){if(!t)return{col:"auto",row:"auto"};let[n,r]=t.toLowerCase().split("x");return{col:a(n),row:a(r)}}var d=new Set(["info","warn","ok","danger"]),f=/^\d+(x\d+)?$/;function u(t){let n={};for(let r of t.trim().split(/\s+/).filter(Boolean)){let[i,e]=r.split("="),s=parseInt(e??"",10);i==="cols"&&s>=1&&(n.cols=s),i==="gap"&&s>=1&&s<=6&&(n.gap=s)}return n}function h(t){let n=0;for(let r of t.split(/\r?\n/))/^:::\s*cards\b/.test(r)?n++:/^:::\s*$/.test(r)&&n>0&&n--;return n>0?"Unclosed ::: cards block":null}function g(t){let n=[],r=null;for(let i of t.split(`
|
|
2
|
+
`)){let e=i.match(/^::\s?(.*)$/);e?(r&&n.push(r),r=m(e[1])):r&&(r.body+=(r.body?`
|
|
3
|
+
`:"")+i)}return r&&n.push(r),n}function m(t){let n=t.indexOf("|");if(n<0)return{title:t.trim(),body:""};let r={title:t.slice(n+1).trim(),body:""};for(let i of t.slice(0,n).trim().split(/\s+/).filter(Boolean))f.test(i)?r.span=i:d.has(i)&&(r.tone=i);return r}function C(t,n){let r=t.tone?` data-tone="${t.tone}"`:"",i="";if(t.span){let{col:o,row:c}=p(t.span);i=` style="grid-column:${o};grid-row:${c}"`}let e=t.title?`<h3>${n.inline(t.title)}</h3>`:"",s=t.body.trim()?n.block(t.body.trim()):"";return`<div class="md-card"${r}${i}>${e}${s}</div>`}function x(t,n,r){let i=n.cols??t.length,e=n.gap??3,s=t.map(o=>C(o,r)).join("");return`<div class="md-cards" style="--cards-cols:${i};--cards-gap:var(--rik-space-${e})">${s}</div>`}function k(t,n){let r=t.split(`
|
|
4
|
+
`),i=[],e=[],s=0;for(;s<r.length;){let o=r[s].match(/^:::\s*cards\b(.*)$/);if(!o){i.push(r[s]),s++;continue}let c=u(o[1]),l=[];for(s++;s<r.length&&!/^:::\s*$/.test(r[s]);)l.push(r[s]),s++;s++,e.push(x(g(l.join(`
|
|
5
|
+
`)),c,n)),i.push("",`<!--cards:${e.length-1}-->`,"")}return{text:i.join(`
|
|
6
|
+
`),blocks:e}}export{k as expandCards,h as lintCards,u as parseCardOpts,g as parseCards};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeckPlugin } from '
|
|
1
|
+
import type { DeckPlugin } from './deck-root.js';
|
|
2
2
|
export declare function clickStagesPlugin(): DeckPlugin;
|
|
3
3
|
/** Back-compat shim · attach the click-stages plugin to every <deck-root> on the
|
|
4
4
|
* page. Existing decks keep calling this; new code can call
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class DeckAgenda extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
/** Hide the entry numbers. */
|
|
5
|
+
noNumbers: boolean;
|
|
6
|
+
/** Do not let a click jump to the chapter · for a printed running order. */
|
|
7
|
+
noJump: boolean;
|
|
8
|
+
private _entries;
|
|
9
|
+
private _current;
|
|
10
|
+
private get _deck();
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
private _onSlideChange;
|
|
14
|
+
/** Chapter titles and the current position, from the deck itself. */
|
|
15
|
+
private _read;
|
|
16
|
+
private _titleOf;
|
|
17
|
+
private _state;
|
|
18
|
+
private _go;
|
|
19
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'deck-agenda': DeckAgenda;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var s=(o,r,e,t)=>{for(var n=t>1?void 0:t?m(r,e):r,a=o.length-1,c;a>=0;a--)(c=o[a])&&(n=(t?c(r,e,n):c(n))||n);return t&&n&&f(r,e,n),n};import{LitElement as g,css as b,html as l}from"./vendor/lit.js";import{customElement as k,property as p,state as h}from"./vendor/lit.js";function d(o){let r=[];return o.forEach((e,t)=>{if(e.toLowerCase()==="deck-section"||r.length===0)r.push({start:t,length:1});else{let a=r[r.length-1];r[r.length-1]={start:a.start,length:a.length+1}}}),{slideCount:o.length,chapters:r}}function u(o,r){for(let e=0;e<o.chapters.length;e++){let t=o.chapters[e],n=r-t.start;if(n>=0&&n<t.length)return{chapter:e,index:n}}return{chapter:0,index:0}}var i=class extends g{constructor(){super(...arguments);this.noNumbers=!1;this.noJump=!1;this._entries=[];this._current=0;this._onSlideChange=()=>this._read()}get _deck(){return this.closest("deck-root")}connectedCallback(){super.connectedCallback(),this._read(),this._deck?.addEventListener("slide-change",this._onSlideChange)}disconnectedCallback(){super.disconnectedCallback(),this._deck?.removeEventListener("slide-change",this._onSlideChange)}_read(){let e=this._deck;if(!e)return;let t=[...e.children].filter(a=>a.tagName.toLowerCase().startsWith("deck-")),n=d(t.map(a=>a.tagName.toLowerCase()));this._entries=n.chapters.map(a=>({title:this._titleOf(t[a.start]),slide:a.start})),this._current=u(n,e.current??0).chapter}_titleOf(e){return e?(e.querySelector('[slot="title"], h1, h2')?.textContent??e.getAttribute("title")??"").trim():""}_state(e){return e===this._current?"current":e<this._current?"done":"todo"}_go(e){if(this.noJump)return;this._deck&&(location.hash=`#${e.slide+1}`)}render(){return this._entries.length===0?l``:l`<ol part="list"> ${this._entries.map((e,t)=>l`<li data-state=${this._state(t)} part="entry">
|
|
2
|
+
${this.noNumbers?"":l`<span class="n">${t+1}</span>`}
|
|
3
|
+
${this.noJump?l`<span>${e.title}</span>`:l`<button type="button" aria-current=${this._state(t)==="current"?"step":"false"} @click=${()=>this._go(e)} > ${e.title} </button>`}
|
|
4
|
+
</li>`)}
|
|
5
|
+
</ol>
|
|
6
|
+
`}};i.styles=b`:host{display:block;font-family:var(--rik-font-sans)}ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--deck-agenda-gap,var(--rik-space-2))}li{display:flex;align-items:baseline;gap:var(--rik-space-3);font-size:var(--deck-agenda-size,var(--rik-font-size-lead));line-height:1.3;color:var(--deck-agenda-color,var(--rik-text-default--faint));padding-left:var(--rik-space-3);border-left:3px solid transparent;transition:color 0.2s ease,border-color 0.2s ease}@media (prefers-reduced-motion:reduce){li{transition:none}}li[data-state='done']{color:var(--deck-agenda-done-color,var(--rik-text-default--faint));opacity:0.55}li[data-state='current']{color:var(--deck-agenda-current-color,var(--rik-text-default));border-left-color:var(--deck-agenda-rule,var(--rik-accent));font-weight:700}.n{flex:none;min-width:2ch;font-variant-numeric:tabular-nums;color:var(--deck-agenda-num-color,var(--rik-text-default--faint))}li[data-state='current'] .n{color:var(--deck-agenda-marker,var(--rik-accent))}button{appearance:none;background:none;border:0;padding:0;margin:0;font:inherit;color:inherit;text-align:left;cursor:pointer}button:focus-visible{outline:var(--rik-focus-ring--width,2px) solid var(--rik-focus-ring,currentColor);outline-offset:var(--rik-focus-ring--offset,2px)}@media print{li[data-state='current']{-webkit-print-color-adjust:exact;print-color-adjust:exact}}`,s([p({type:Boolean,attribute:"no-numbers"})],i.prototype,"noNumbers",2),s([p({type:Boolean,attribute:"no-jump"})],i.prototype,"noJump",2),s([h()],i.prototype,"_entries",2),s([h()],i.prototype,"_current",2),i=s([k("deck-agenda")],i);export{i as DeckAgenda};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
export declare class DeckAnnotate extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
/** The image to annotate. */
|
|
5
|
+
src?: string;
|
|
6
|
+
/** Alternative text · required for anything a reader must understand. */
|
|
7
|
+
alt: string;
|
|
8
|
+
/** `x,y,label` triples separated by `|`, coordinates in percent. */
|
|
9
|
+
marks?: string;
|
|
10
|
+
/** Show every mark at once instead of revealing them one per step. */
|
|
11
|
+
allAtOnce: boolean;
|
|
12
|
+
/** Drop the legend list under the image. */
|
|
13
|
+
noLegend: boolean;
|
|
14
|
+
/** Draw a line from the precise target coordinate to the displaced badge. */
|
|
15
|
+
leader: boolean;
|
|
16
|
+
/** Default badge displacement as `x,y` CSS pixels, for example `28,-24`. */
|
|
17
|
+
offset: string;
|
|
18
|
+
/** Per-mark displacements separated by `|`; missing entries use `offset`. */
|
|
19
|
+
offsets?: string;
|
|
20
|
+
/** Concise explanation displayed under the legend, in a real figcaption. */
|
|
21
|
+
caption?: string;
|
|
22
|
+
/** Source or credit displayed beside the caption. */
|
|
23
|
+
source?: string;
|
|
24
|
+
/** Optional URL for the source or credit. */
|
|
25
|
+
sourceHref?: string;
|
|
26
|
+
private get _hasCaption();
|
|
27
|
+
private get _hasSource();
|
|
28
|
+
/** Current step, mirrored from the slide by deck-root's step machinery. */
|
|
29
|
+
private _step;
|
|
30
|
+
/** Rendered badge diameter, measured from `.mark` · 0 until `_measure()`
|
|
31
|
+
* has run once, so a keyword offset sits on the target for one frame
|
|
32
|
+
* rather than guessing a size. */
|
|
33
|
+
private _markSize;
|
|
34
|
+
/** Rendered `--deck-annotate-anchor-gap`, measured the same way. */
|
|
35
|
+
private _anchorGap;
|
|
36
|
+
private get _marks();
|
|
37
|
+
/** Turn a parsed offset into a pixel displacement · a keyword resolves to
|
|
38
|
+
* the badge radius plus the gap, in the named direction, and always
|
|
39
|
+
* forces the leader on since a badge moved on the author's say-so, not a
|
|
40
|
+
* measured pixel value, needs the line back to what it annotates. */
|
|
41
|
+
private _displacementFor;
|
|
42
|
+
private _offsetFor;
|
|
43
|
+
/** The engine reads the step count off the SLIDE (`steps` / `data-steps`), so
|
|
44
|
+
* the component publishes what it needs onto its own slide · one step per
|
|
45
|
+
* mark. It only ever raises the count, never lowers one the author set. */
|
|
46
|
+
private _publishSteps;
|
|
47
|
+
connectedCallback(): void;
|
|
48
|
+
/** Called by deck-root on every step change · it walks the active slide and
|
|
49
|
+
* invokes this on each descendant that has it. No listener to clean up. */
|
|
50
|
+
applyStep(step: number): void;
|
|
51
|
+
private _ro?;
|
|
52
|
+
/** Pending settle frame, so the loop is never started twice over. */
|
|
53
|
+
private _frame;
|
|
54
|
+
/** Geometry the last SUCCESSFUL measurement was taken from · empty while
|
|
55
|
+
* nothing could be measured yet, which keeps the settle loop retrying. */
|
|
56
|
+
private _measuredFrom;
|
|
57
|
+
firstUpdated(): void;
|
|
58
|
+
updated(changed: PropertyValues): void;
|
|
59
|
+
disconnectedCallback(): void;
|
|
60
|
+
/** Watch everything whose size decides the painted rectangle.
|
|
61
|
+
*
|
|
62
|
+
* The frame is what the picture is measured against, but its height is
|
|
63
|
+
* decided by its siblings inside the figure : the legend and the caption.
|
|
64
|
+
* Observing the host and the image as well means a reflow whose frame
|
|
65
|
+
* notification never arrives is still caught by another one. */
|
|
66
|
+
private _observe;
|
|
67
|
+
/** Observe the image and hear its decode · both are no-ops when already
|
|
68
|
+
* registered, so this is safe to call on every render. The image element
|
|
69
|
+
* itself is recreated whenever `src` goes from unset to set. */
|
|
70
|
+
private _watchImage;
|
|
71
|
+
private _onLoad;
|
|
72
|
+
/** The measurement contract, in one place : measure SYNCHRONOUSLY first,
|
|
73
|
+
* then let the settle loop retry.
|
|
74
|
+
*
|
|
75
|
+
* The synchronous half is what a one-shot consumer reads · a print or PDF
|
|
76
|
+
* capture, or any renderer that snapshots without pumping an animation
|
|
77
|
+
* frame, sees the published rectangle immediately rather than one frame
|
|
78
|
+
* late. The loop is the retry for everything a single measurement cannot
|
|
79
|
+
* know yet (an image with no natural size, a box still collapsed, a reflow
|
|
80
|
+
* whose notification never arrives). */
|
|
81
|
+
private _remeasure;
|
|
82
|
+
/** Re-measure once per animation frame until the geometry has stopped
|
|
83
|
+
* moving, then stop.
|
|
84
|
+
*
|
|
85
|
+
* A ResizeObserver notification is the normal trigger, and on a loaded page
|
|
86
|
+
* this loop ends after three frames. It exists because a notification is
|
|
87
|
+
* not a guarantee : a slow engine can deliver the frame's growth while the
|
|
88
|
+
* image still has no natural size (the measurement then bails and nothing
|
|
89
|
+
* re-triggers it), and a dropped or coalesced notification leaves the last
|
|
90
|
+
* published rectangle stale forever, which puts every marker in the wrong
|
|
91
|
+
* place with no way back. */
|
|
92
|
+
private _settle;
|
|
93
|
+
private _scheduleSettle;
|
|
94
|
+
/** Publish the letterboxed picture rectangle as percentages of the frame,
|
|
95
|
+
* and the measured badge size and anchor gap a keyword offset needs.
|
|
96
|
+
*
|
|
97
|
+
* Synchronous and idempotent · it forces layout by design, and it is always
|
|
98
|
+
* called directly (never only from an animation frame) so that a consumer
|
|
99
|
+
* capturing the page without pumping a frame still reads a current
|
|
100
|
+
* rectangle. See _remeasure(). */
|
|
101
|
+
private _measure;
|
|
102
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
103
|
+
}
|
|
104
|
+
declare global {
|
|
105
|
+
interface HTMLElementTagNameMap {
|
|
106
|
+
'deck-annotate': DeckAnnotate;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var M=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var d=(o,a,e,r)=>{for(var t=r>1?void 0:r?F(a,e):a,n=o.length-1,i;n>=0;n--)(i=o[n])&&(t=(r?i(a,e,t):i(t))||t);return r&&t&&M(a,e,t),t};import{LitElement as z,css as L,html as c,nothing as g}from"./vendor/lit.js";import{customElement as R,property as l,state as f}from"./vendor/lit.js";var y=o=>Number.isFinite(o)?Math.max(0,Math.min(100,o)):0;function x(o){return o?o.split("|").map(a=>a.trim()).filter(Boolean).map(a=>{let[e="",r="",...t]=a.split(","),n=i=>i.trim()===""?Number.NaN:Number(i.trim());return{x:n(e),y:n(r),label:t.join(",").trim()}}).filter(a=>Number.isFinite(a.x)&&Number.isFinite(a.y)).map(a=>({x:y(a.x),y:y(a.y),label:a.label})):[]}function _(o){return o.map((a,e)=>({...a,n:e+1}))}function S(o,a){return o<=0?0:Math.max(0,Math.min(o,Math.floor(a)))}var w=o=>Math.max(0,o),E=["above","below","left","right"],k={kind:"px",dx:0,dy:0};function $(o){let a=o?.trim();if(!a)return k;if(E.includes(a))return{kind:"anchor",side:a};let[e,r]=a.split(","),t=Number(e?.trim()),n=Number(r?.trim());return Number.isFinite(t)&&Number.isFinite(n)?{kind:"px",dx:t,dy:n}:k}var N=3,O=60,s=class extends z{constructor(){super(...arguments);this.alt="";this.allAtOnce=!1;this.noLegend=!1;this.leader=!1;this.offset="0,0";this._step=0;this._markSize=0;this._anchorGap=0;this._frame=0;this._measuredFrom="";this._onLoad=()=>{this._remeasure()};this._measure=()=>{let e=this.renderRoot.querySelector(".frame"),r=this.renderRoot.querySelector("img"),t=this.renderRoot.querySelector(".mark-size-probe"),n=this.renderRoot.querySelector(".anchor-gap-probe");if(t&&(this._markSize=t.getBoundingClientRect().width),n&&(this._anchorGap=n.getBoundingClientRect().width),e&&e.style.setProperty("--mark-size",`${this._markSize}px`),this._measuredFrom="",!e||!r?.naturalWidth||!r.naturalHeight)return;let i=e.getBoundingClientRect();if(!i.width||!i.height)return;this._measuredFrom=`${i.width}x${i.height}/${r.naturalWidth}x${r.naturalHeight}`;let p=r.naturalWidth/r.naturalHeight,h=i.width/i.height,m=p>h?1:i.height*p/i.width,u=p>h?i.width/p/i.height:1;e.style.setProperty("--img-w",String(m)),e.style.setProperty("--img-h",String(u)),e.style.setProperty("--img-x",`${(1-m)/2*100}%`),e.style.setProperty("--img-y",`${(1-u)/2*100}%`)}}get _hasCaption(){return!!(this.caption||this.source||this.querySelector('[slot="caption"], [slot="source"]'))}get _hasSource(){return!!(this.source||this.querySelector('[slot="source"]'))}get _marks(){return _(x(this.marks))}_displacementFor(e){if(e.kind==="px")return{dx:e.dx,dy:e.dy,forceLeader:!1};let r=this._markSize/2+this._anchorGap,t={above:[0,-r],below:[0,r],left:[-r,0],right:[r,0]},[n,i]=t[e.side];return{dx:n,dy:i,forceLeader:!0}}_offsetFor(e){let r=this.offsets?.split("|")[e]?.trim(),t=r||this.offset;return this._displacementFor($(t))}_publishSteps(){let e=this.allAtOnce?0:w(this._marks.length);if(e===0)return;let r=this;for(;r?.parentElement&&r.parentElement.tagName.toLowerCase()!=="deck-root";)r=r.parentElement;if(!r?.parentElement)return;Number(r.getAttribute("steps")??r.getAttribute("data-steps")??"0")<e&&r.setAttribute("data-steps",String(e))}connectedCallback(){super.connectedCallback(),this._publishSteps(),this.hasUpdated&&(this._observe(),this._remeasure())}applyStep(e){this._step=e}firstUpdated(){this._observe(),document.fonts?.ready?.then(()=>{this.isConnected&&this._remeasure()}),this._remeasure()}updated(e){this._watchImage(),[...e.keys()].every(t=>t==="_markSize"||t==="_anchorGap")?this._settle():this._remeasure()}disconnectedCallback(){super.disconnectedCallback(),this._ro?.disconnect(),this._ro=void 0,this._frame&&cancelAnimationFrame(this._frame),this._frame=0}_observe(){this._ro?.disconnect(),this._ro=new ResizeObserver(()=>this._remeasure());for(let e of["figure",".frame"]){let r=this.renderRoot.querySelector(e);r&&this._ro.observe(r)}this._ro.observe(this),this._watchImage()}_watchImage(){let e=this.renderRoot.querySelector("img");e&&(e.addEventListener("load",this._onLoad),this._ro?.observe(e))}_remeasure(){this._measure(),this._settle()}_settle(){this._frame&&cancelAnimationFrame(this._frame),this._frame=this._scheduleSettle(0,0)}_scheduleSettle(e,r){return requestAnimationFrame(()=>{this._frame=0;let t=this._measuredFrom;this._measure();let n=this._measuredFrom!==""&&this._measuredFrom===t?r+1:0;n>=N||e+1>=O||(this._frame=this._scheduleSettle(e+1,n))})}render(){let e=this._marks,r=this.allAtOnce?e.length:S(e.length,this._step);return c`<figure part="figure"> <div class="frame" part="frame"> ${this.src?c`<img src=${this.src} alt=${this.alt} part="image" />`:""}
|
|
2
|
+
${this.src?c`<span class="edge" part="edge" aria-hidden="true"></span>`:""}
|
|
3
|
+
<span class="mark-size-probe" aria-hidden="true"></span>
|
|
4
|
+
<span class="anchor-gap-probe" aria-hidden="true"></span>
|
|
5
|
+
${e.map((t,n)=>{let{dx:i,dy:p,forceLeader:h}=this._offsetFor(n),m=Math.hypot(i,p),u=Math.atan2(p,i)*(180/Math.PI),v=`--mx:${t.x}%;--my:${t.y}%;--mark-dx:${i}px;--mark-dy:${p}px;--leader-length:${m}px;--leader-angle:${u}deg`,b=t.n>r;return c`${(this.leader||h)&&m>0?c`<span class="leader" part="leader" ?hidden=${b} style=${v} aria-hidden="true"></span>`:""}
|
|
6
|
+
<span class="mark" part="mark" ?hidden=${b} style=${v} aria-hidden="true">${t.n}</span>
|
|
7
|
+
`})}
|
|
8
|
+
</div>
|
|
9
|
+
${this.noLegend||e.length===0?"":c`<ol class="legend" part="legend"> ${e.map(t=>c`<li class="item" ?data-pending=${t.n>r}>
|
|
10
|
+
<span class="n">${t.n}</span><span>${t.label}</span>
|
|
11
|
+
</li>`)}
|
|
12
|
+
</ol>`}
|
|
13
|
+
${this._hasCaption?c`<figcaption part="caption"> <span class="caption"><slot name="caption">${this.caption??""}</slot></span> ${this._hasSource?c`<deck-source part="source" href=${this.sourceHref??g}
|
|
14
|
+
><slot name="source">${this.source??""}</slot></deck-source
|
|
15
|
+
>`:g}
|
|
16
|
+
</figcaption>`:g}
|
|
17
|
+
</figure>
|
|
18
|
+
`}};s.styles=L`:host{display:flex;flex-direction:column;min-height:0;font-family:var(--rik-font-sans)}figure{display:flex;flex-direction:column;flex:1 1 auto;gap:var(--deck-annotate-gap,var(--deck-figure-gap,var(--rik-space-2)));min-height:0;margin:0}.frame{position:relative;flex:1 1 auto;min-height:0;line-height:0}img{display:block;width:100%;height:100%;object-fit:contain;object-position:center}.edge{position:absolute;left:var(--img-x,0%);top:var(--img-y,0%);width:calc(var(--img-w,1) * 100%);height:calc(var(--img-h,1) * 100%);border-radius:var(--deck-annotate-radius,var(--rik-radius-md));border:1px solid var(--deck-annotate-border,var(--rik-border-default));pointer-events:none}.mark{position:absolute;left:calc(var(--img-x,0%) + var(--mx) * var(--img-w,1));top:calc(var(--img-y,0%) + var(--my) * var(--img-h,1));transform:translate(calc(-50% + var(--mark-dx,0px)),calc(-50% + var(--mark-dy,0px)));width:var(--deck-annotate-mark-size,2.2rem);height:var(--deck-annotate-mark-size,2.2rem);border-radius:var(--rik-radius-pill);background:var(--deck-annotate-mark-bg,var(--rik-accent));color:var(--deck-annotate-mark-color,var(--rik-accent__on));display:grid;place-items:center;font-weight:700;font-size:var(--rik-font-size-sm,1rem);box-shadow:0 0 0 3px var(--deck-annotate-mark-ring,var(--rik-surface-page));transition:opacity 0.2s ease,transform 0.2s ease}.mark[hidden]{display:none}.leader{position:absolute;left:calc(var(--img-x,0%) + var(--mx) * var(--img-w,1));top:calc(var(--img-y,0%) + var(--my) * var(--img-h,1));width:var(--leader-length,0px);height:var(--deck-annotate-leader-width,2px);transform:translateY(-50%) rotate(var(--leader-angle,0deg));transform-origin:left center;background:var(--deck-annotate-leader,var(--rik-accent));border-radius:var(--rik-radius-pill);box-shadow:0 0 0 1px var(--deck-annotate-mark-ring,var(--rik-surface-page));pointer-events:none}.leader[hidden]{display:none}.mark-size-probe,.anchor-gap-probe{position:absolute;height:0;visibility:hidden;pointer-events:none}.mark-size-probe{width:var(--deck-annotate-mark-size,2.2rem)}.anchor-gap-probe{width:var(--deck-annotate-anchor-gap,var(--rik-space-2))}@media (prefers-reduced-motion:reduce){.mark{transition:none}}.legend{display:flex;flex-direction:column;gap:var(--rik-space-1);font-size:var(--deck-annotate-legend-size,var(--rik-font-size-sm));color:var(--deck-annotate-legend-color,var(--rik-text-default));flex:none}.item{display:flex;align-items:baseline;gap:var(--rik-space-2);opacity:1;transition:opacity 0.2s ease}.item[data-pending]{opacity:0}.n{flex:none;min-width:1.6em;font-weight:700;color:var(--deck-annotate-mark-bg,var(--rik-accent));font-variant-numeric:tabular-nums}@media print{.mark,.n{-webkit-print-color-adjust:exact;print-color-adjust:exact}.mark[hidden]{display:grid}.item[data-pending]{opacity:1}}figcaption{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:var(--rik-space-2) var(--rik-space-4);color:var(--deck-annotate-caption-color,var(--deck-figure-caption-color,var(--rik-text-default--muted)));font-size:var(--rik-font-size-sm);line-height:1.5}deck-source{--deck-source-gap:0}deck-source::part(source){white-space:nowrap}@media (max-width:640px){figcaption{grid-template-columns:1fr}deck-source::part(source){white-space:normal}}`,d([l({type:String})],s.prototype,"src",2),d([l({type:String})],s.prototype,"alt",2),d([l({type:String})],s.prototype,"marks",2),d([l({type:Boolean,attribute:"all-at-once"})],s.prototype,"allAtOnce",2),d([l({type:Boolean,attribute:"no-legend"})],s.prototype,"noLegend",2),d([l({type:Boolean,reflect:!0})],s.prototype,"leader",2),d([l({type:String})],s.prototype,"offset",2),d([l({type:String})],s.prototype,"offsets",2),d([l({type:String})],s.prototype,"caption",2),d([l({type:String})],s.prototype,"source",2),d([l({type:String,attribute:"source-href"})],s.prototype,"sourceHref",2),d([f()],s.prototype,"_step",2),d([f()],s.prototype,"_markSize",2),d([f()],s.prototype,"_anchorGap",2),s=d([R("deck-annotate")],s);export{s as DeckAnnotate};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type DeckBarTone = 'accent' | 'ok' | 'warn' | 'danger' | 'info' | 'muted';
|
|
3
|
+
export declare class DeckBar extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
5
|
+
/** The measured part, for a single-value bar. */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** The whole it is measured against · defaults to the sum of the segments. */
|
|
8
|
+
total?: number;
|
|
9
|
+
/** Text above the bar. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Colour of a single-value bar. */
|
|
12
|
+
tone: DeckBarTone;
|
|
13
|
+
/** A stacked bar · `label:value:tone` triples separated by `|`. */
|
|
14
|
+
segments?: string;
|
|
15
|
+
/** Hide the figure at the right of the label. */
|
|
16
|
+
noValue: boolean;
|
|
17
|
+
/** Hide the legend under a stacked bar. */
|
|
18
|
+
noLegend: boolean;
|
|
19
|
+
private get _stacked();
|
|
20
|
+
private _sized;
|
|
21
|
+
private _color;
|
|
22
|
+
/** The figure beside the label · the honest numbers, not the rounded share. */
|
|
23
|
+
private _figure;
|
|
24
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
25
|
+
/** A bar is an image to assistive technology · without a name it is silence. */
|
|
26
|
+
private _ariaLabel;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
'deck-bar': DeckBar;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/deck-bar.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var b=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var d=(l,r,t,n)=>{for(var e=n>1?void 0:n?k(r,t):r,a=l.length-1,i;a>=0;a--)(i=l[a])&&(e=(n?i(r,t,e):i(e))||e);return n&&e&&b(r,t,e),e};import{LitElement as x,css as y,html as p}from"./vendor/lit.js";import{customElement as _,property as c}from"./vendor/lit.js";function m(l){return l?l.split("|").map(r=>r.trim()).filter(Boolean).map(r=>{let[t="",n="",e=""]=r.split(":").map(a=>a.trim());return{label:t,value:n===""?Number.NaN:Number(n),tone:e||void 0}}).filter(r=>r.label.length>0&&Number.isFinite(r.value)&&r.value>=0):[]}function g(l,r){let t=l.reduce((s,u)=>s+Math.max(0,u.value),0),n=r!==void 0&&r>0?r:t;if(n<=0)return l.map(s=>({...s,percent:0,exact:0}));let e=l.map(s=>{let u=Math.max(0,s.value)/n*100;return{...s,exact:u,percent:Math.round(u)}});if(r!==void 0&&r>0)return e;let a=100-e.reduce((s,u)=>s+u.percent,0);if(a===0||e.length===0)return e;let i=0;for(let s=1;s<e.length;s++)e[s].exact>e[i].exact&&(i=s);return e[i]={...e[i],percent:e[i].percent+a},e}function v(l){let r=l.reduce((t,n)=>t+n.exact,0);return Math.max(0,100-r)}var h={accent:"var(--rik-accent__text)",ok:"var(--rik-status-success__text)",warn:"var(--rik-status-warn__text)",danger:"var(--rik-status-danger__text)",info:"var(--rik-status-info, var(--rik-accent__text))",muted:"var(--rik-text-default--faint)"},f=["accent","info","ok","warn","danger","muted"],o=class extends x{constructor(){super(...arguments);this.tone="accent";this.noValue=!1;this.noLegend=!1}get _stacked(){return(this.segments??"").trim().length>0}_sized(){return this._stacked?g(m(this.segments),this.total):g([{label:this.label??"",value:this.value??0}],this.total)}_color(t,n){let e=t??(this._stacked?f[n%f.length]:this.tone),a=h[e]??h.accent;return this._stacked?a:`var(--deck-bar-fill, ${a})`}_figure(t){if(this._stacked)return`${t.reduce((a,i)=>a+i.value,0)}`;let n=this.value??0;return this.total===void 0?`${n}`:`${n} / ${this.total}`}render(){let t=this._sized(),n=v(t),e=!!this.label||!this.noValue;return p`${e?p`<div class="head" part="head">
|
|
2
|
+
<span class="label" part="label">${this.label??""}</span>
|
|
3
|
+
${this.noValue?"":p`<span class="value" part="value">${this._figure(t)}</span>`}
|
|
4
|
+
</div>`:""}
|
|
5
|
+
<div
|
|
6
|
+
class="track"
|
|
7
|
+
part="track"
|
|
8
|
+
role="img"
|
|
9
|
+
aria-label=${this._ariaLabel(t,n)}
|
|
10
|
+
>
|
|
11
|
+
${t.map((a,i)=>p`<div class="seg" part="segment" style="width:${Math.min(100,a.exact)}%;--seg-color:${this._color(a.tone,i)}" ></div>`)}
|
|
12
|
+
</div>
|
|
13
|
+
${this._stacked&&!this.noLegend?p`<div class="legend" part="legend"> ${t.map((a,i)=>p`<span class="legend-item">
|
|
14
|
+
<span class="dot" style="--seg-color:${this._color(a.tone,i)}"></span>
|
|
15
|
+
${a.label}
|
|
16
|
+
<span class="legend-value">${a.percent}%</span>
|
|
17
|
+
</span>`)}
|
|
18
|
+
</div>`:""}
|
|
19
|
+
`}_ariaLabel(t,n){let e=this.label?`${this.label}: `:"";if(this._stacked)return e+t.map(i=>`${i.label} ${i.percent}%`).join(", ");let a=t[0]?.percent??0;return`${e}${a}%${n>0&&this.total!==void 0?` of ${this.total}`:""}`}};o.styles=y`:host{display:block;width:100%;font-family:var(--rik-font-sans);margin-block:var(--deck-bar-gap,var(--rik-space-2))}.head{display:flex;align-items:baseline;justify-content:space-between;gap:var(--rik-space-3);margin-bottom:var(--rik-space-1)}.label{color:var(--deck-bar-label-color,var(--rik-text-default));font-weight:600}.value{color:var(--deck-bar-value-color,var(--rik-text-default--faint));font-variant-numeric:tabular-nums;white-space:nowrap}.track{display:flex;width:100%;height:var(--deck-bar-height,var(--rik-space-3));border-radius:var(--deck-bar-radius,var(--rik-radius-pill));background:var(--deck-bar-track,var(--rik-surface-sunken));overflow:hidden}.seg{height:100%;background:var(--seg-color);transition:width 0.3s ease}.seg + .seg{box-shadow:inset var(--deck-bar-divider-width,2px) 0 0 var(--deck-bar-divider,var(--rik-surface-page))}@media (prefers-reduced-motion:reduce){.seg{transition:none}}.legend{display:flex;flex-wrap:wrap;gap:var(--rik-space-1) var(--rik-space-3);margin-top:var(--rik-space-1);font-size:var(--deck-bar-legend-size,var(--rik-font-size-xs));color:var(--deck-bar-legend-color,var(--rik-text-default--faint))}.legend-item{display:inline-flex;align-items:center;gap:var(--rik-space-1)}.dot{width:0.6em;height:0.6em;border-radius:var(--rik-radius-pill);background:var(--seg-color);flex:none}.legend-value{font-variant-numeric:tabular-nums;opacity:0.75}@media print{.seg,.dot{-webkit-print-color-adjust:exact;print-color-adjust:exact}}`,d([c({type:Number})],o.prototype,"value",2),d([c({type:Number})],o.prototype,"total",2),d([c({type:String})],o.prototype,"label",2),d([c({type:String,reflect:!0})],o.prototype,"tone",2),d([c({type:String})],o.prototype,"segments",2),d([c({type:Boolean,attribute:"no-value"})],o.prototype,"noValue",2),d([c({type:Boolean,attribute:"no-legend"})],o.prototype,"noLegend",2),o=d([_("deck-bar")],o);export{o as DeckBar};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type DeckBentoAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
3
|
+
export declare class DeckBento extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
eyebrow?: string;
|
|
6
|
+
cols?: string;
|
|
7
|
+
rows?: string;
|
|
8
|
+
gap?: string;
|
|
9
|
+
align?: DeckBentoAlign;
|
|
10
|
+
justify?: DeckBentoAlign;
|
|
11
|
+
/**
|
|
12
|
+
* Line a row of points up band by band.
|
|
13
|
+
*
|
|
14
|
+
* A row of items is a row of independent flows, so a title that wraps to a
|
|
15
|
+
* second line pushes its own body text below its neighbours' and nothing in
|
|
16
|
+
* the row shares a baseline. Giving the grid one band per child position and
|
|
17
|
+
* letting each point borrow those bands makes every first child share a row,
|
|
18
|
+
* every second child the next, and so on.
|
|
19
|
+
*
|
|
20
|
+
* Only a row of deck-point, and only one the author did not shape. A
|
|
21
|
+
* deck-cell is a size container, which reports no height for a band to be
|
|
22
|
+
* sized from and makes subgrid compute to none, so a row holding one is left
|
|
23
|
+
* alone rather than half-aligned. So is a row whose items claim their own
|
|
24
|
+
* span, or whose bento declares its own rows, because bands would fight that.
|
|
25
|
+
* Uneven items are left alone too · sharing bands there would mean inventing
|
|
26
|
+
* empty ones, and an invented band is a gap nobody asked for.
|
|
27
|
+
*
|
|
28
|
+
* Returns the band count, or 0 when this bento is not such a row.
|
|
29
|
+
*/
|
|
30
|
+
private _bandCount;
|
|
31
|
+
updated(): void;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'deck-bento': DeckBento;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var s=(e,r,i,o)=>{for(var t=o>1?void 0:o?h(r,i):r,n=e.length-1,d;n>=0;n--)(d=e[n])&&(t=(o?d(r,i,t):d(t))||t);return o&&t&&u(r,i,t),t};import{LitElement as y,html as m,css as x}from"./vendor/lit.js";import{customElement as w,property as l}from"./vendor/lit.js";import{css as c}from"./vendor/lit.js";var b=c`:host{display:none;position:absolute;inset:0;padding:var(--rik-slide-padding-y) var(--rik-slide-padding-x);flex-direction:column;overflow:hidden;background:var(--rik-surface-page);font-family:var(--rik-font-sans);color:var(--rik-text-default)}:host([active]){display:flex}.body,.col{justify-content:var(--_spread,var(--rik-slide-spread,center))}:host([fill]) .body > ::slotted(*),:host([fill]) .col > ::slotted(*){flex:1 1 0;min-height:0}:host([fill]) .body,:host([fill]) .col{justify-content:stretch}@media print{:host{display:flex;position:relative;inset:auto;width:calc(var(--deck-canvas-w,1920) * 1px);height:calc(var(--deck-canvas-h,1080) * 1px);break-inside:avoid;break-after:page;-webkit-print-color-adjust:exact;print-color-adjust:exact}:host(:last-child){break-after:auto}}`,k=c`h1{font-size:var(--rik-font-size-h1);font-weight:700;color:var(--rik-text-default);letter-spacing:-0.022em;line-height:1.15;margin-bottom:var(--rik-space-4);padding-bottom:var(--rik-space-2);border-bottom:3px solid var(--rik-accent);display:inline-block;align-self:flex-start;flex:0 0 auto}h1 .accent{color:var(--rik-accent)}::slotted(p),p{font-size:var(--rik-font-size-body);line-height:1.65;color:var(--rik-text-default--muted);margin:0}::slotted(strong),strong{color:var(--rik-text-default);font-weight:700}::slotted(code),code{font-family:var(--rik-font-mono);font-size:var(--rik-font-size-mono-sm);background:rgba(0,0,0,0.06);padding:2px 6px;border-radius:var(--rik-radius-sm);color:var(--rik-text-default)}`,v=c`.lbl{display:inline-block;padding:var(--deck-eyebrow-padding-y,0) var(--deck-eyebrow-padding-x,0);background:var(--deck-eyebrow-bg,transparent);color:var(--deck-eyebrow-color,var(--rik-accent__text));border-radius:var(--deck-eyebrow-radius,0);font-size:var(--rik-font-size-body);font-weight:600;margin-bottom:var(--rik-space-1);align-self:flex-start}.lead{font-size:var(--rik-font-size-lead);color:var(--rik-text-default--faint);line-height:1.5;margin-bottom:var(--rik-space-4);max-width:75ch;flex:0 0 auto}.kicker{font-size:var(--rik-font-size-xs);font-weight:700;letter-spacing:0.14em;text-transform:uppercase;color:var(--rik-text-default--faint);margin-bottom:var(--rik-space-3);display:block}.kicker.on-dark{color:rgba(255,255,255,0.35)}.caption{font-size:var(--rik-font-size-sm);color:var(--rik-text-default--faint);line-height:1.55}.caption.on-dark{color:rgba(255,255,255,0.5)}.col-label{font-size:var(--rik-font-size-xs);font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--rik-text-default--faint);margin-bottom:var(--rik-space-2)}`,f=[b,k,v];function p(e){if(!e)return null;let r=parseInt(e,10);return!Number.isNaN(r)&&String(r)===e.trim()&&r>=1&&r<=12?`repeat(${r}, minmax(0, 1fr))`:e}function g(e){if(!e)return null;let r=parseInt(e,10);return!Number.isNaN(r)&&String(r)===e.trim()&&r>=1&&r<=6?`var(--rik-space-${r})`:e}var a=class extends y{_bandCount(){if(this.rows)return 0;let r=[...this.children].filter(t=>t.tagName.startsWith("DECK-")),i=r.filter(t=>t.tagName==="DECK-POINT");if(i.length<2||i.length!==r.length||i.some(t=>t.hasAttribute("span")||t.hasAttribute("col")||t.hasAttribute("row")))return 0;let o=i.map(t=>t.childElementCount);return new Set(o).size!==1?0:o[0]??0}updated(){let r=p(this.cols),i=p(this.rows),o=g(this.gap),t=this._bandCount();for(let n of this.children)n.tagName==="DECK-POINT"&&(t>0?n.setAttribute("banded",String(t)):n.removeAttribute("banded"));this.toggleAttribute("banded",t>0),r&&this.style.setProperty("--_cols",r),t>0?this.style.setProperty("--_rows",`repeat(${t}, minmax(0, auto))`):i?this.style.setProperty("--_rows",i):this.style.removeProperty("--_rows"),o&&this.style.setProperty("--_gap",o),this.align&&this.style.setProperty("--_align",this.align),this.justify&&this.style.setProperty("--_justify",this.justify)}render(){return m`${this.eyebrow?m`<span class="lbl">${this.eyebrow}</span>`:""}
|
|
2
|
+
<slot name="title"></slot>
|
|
3
|
+
<div class="grid" part="grid"><slot></slot></div>
|
|
4
|
+
`}};a.styles=[...f,x`:host{gap:var(--rik-space-3)}.grid{flex:1 1 auto;margin-inline:calc(-1 * var(--deck-cell-padding-x,var(--rik-space-4)));display:grid;grid-template-columns:var(--_cols,repeat(2,minmax(0,1fr)));grid-template-rows:var(--_rows,minmax(0,1fr));gap:var(--_gap,var(--deck-bento-gap,var(--rik-space-3)));align-items:var(--_align,stretch);justify-items:var(--_justify,stretch);min-height:0;min-width:0}:host([banded]) .grid{align-content:start}`],s([l({type:String})],a.prototype,"eyebrow",2),s([l({type:String})],a.prototype,"cols",2),s([l({type:String})],a.prototype,"rows",2),s([l({type:String})],a.prototype,"gap",2),s([l({type:String})],a.prototype,"align",2),s([l({type:String})],a.prototype,"justify",2),a=s([w("deck-bento")],a);export{a as DeckBento};
|
|
@@ -3,6 +3,8 @@ export type DeckCalloutType = 'info' | 'warn' | 'danger' | 'ok';
|
|
|
3
3
|
export declare class DeckCallout extends LitElement {
|
|
4
4
|
static styles: import("lit").CSSResult;
|
|
5
5
|
type?: DeckCalloutType;
|
|
6
|
+
/** Use inverse text and a dark raised surface inside dark slide layouts. */
|
|
7
|
+
onDark: boolean;
|
|
6
8
|
render(): import("lit-html").TemplateResult<1>;
|
|
7
9
|
}
|
|
8
10
|
declare global {
|
package/dist/deck-callout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var k=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var i=(c,a,o,t)=>{for(var r=t>1?void 0:t?v(a,o):a,s=c.length-1,d;s>=0;s--)(d=c[s])&&(r=(t?d(a,o,r):d(r))||r);return t&&r&&k(a,o,r),r};import{LitElement as u,html as g,css as p}from"./vendor/lit.js";import{customElement as b,property as l}from"./vendor/lit.js";var n={info:'<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',warn:'<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',danger:'<circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/>',ok:'<path d="M20 6 9 17l-5-5"/>'},e=class extends u{constructor(){super(...arguments);this.onDark=!1}render(){let o=this.type??"info",t=n[o]??n.info;return g`<div class="icon-box"> <svg viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" .innerHTML="${t}"></svg> </div> <div class="content"><slot></slot></div>`}};e.styles=p`:host{display:flex;gap:var(--rik-space-3);padding:var(--deck-callout-padding-y,var(--rik-space-3)) var(--deck-callout-padding-x,var(--rik-space-4));border-radius:var(--deck-callout-radius,var(--rik-radius-md));background:var(--deck-callout-bg,var(--rik-status-info__bg--mid));border:1px solid var(--deck-callout-border,var(--rik-status-info__border));box-shadow:var(--rik-elevation-2);align-items:center;color:var(--deck-callout-color,var(--rik-text-default--muted));font-family:var(--rik-font-sans);font-size:var(--rik-font-size-body);line-height:1.55}:host([type="info"]){--deck-callout-bg:var(--rik-status-info__bg--mid);--deck-callout-border:var(--rik-status-info__border);--deck-callout-stroke:var(--rik-accent)}:host([type="warn"]){--deck-callout-bg:var(--rik-status-warn__bg);--deck-callout-border:var(--rik-status-warn__border);--deck-callout-stroke:var(--rik-status-warn)}:host([type="danger"]){--deck-callout-bg:var(--rik-status-danger__bg);--deck-callout-border:var(--rik-status-danger__border);--deck-callout-stroke:var(--rik-status-danger)}:host([type="ok"]){--deck-callout-bg:var(--rik-status-success__bg);--deck-callout-border:var(--rik-status-success__border);--deck-callout-stroke:var(--rik-status-success)}:host([on-dark]){--deck-callout-bg:var(--rik-surface-inverse--soft-2);--deck-callout-border:var(--rik-border-inverse);--deck-callout-color:var(--rik-text-inverse--muted);--deck-callout-strong-color:var(--rik-text-inverse);--deck-callout-code-bg:var(--rik-surface-inverse__overlay);box-shadow:none}:host([on-dark]) .icon-box{background:var(--rik-surface-inverse__overlay)}.icon-box{flex-shrink:0;width:var(--rik-icon-2xl);height:var(--rik-icon-2xl);display:inline-flex;align-items:center;justify-content:center;border-radius:50%;background:var(--rik-surface-tint)}.icon-box svg{width:var(--rik-icon-lg);height:var(--rik-icon-lg);stroke:var(--deck-callout-stroke,var(--rik-accent));stroke-width:2.2}.content{flex:1}::slotted(p){margin:0}::slotted(strong){color:var(--deck-callout-strong-color,var(--rik-text-default));font-weight:700}::slotted(code){font-family:var(--rik-font-mono);font-size:var(--rik-font-size-mono-sm);background:var(--deck-callout-code-bg,var(--rik-surface-tint));padding:2px 6px;border-radius:var(--rik-radius-sm);color:var(--deck-callout-strong-color,var(--rik-text-default))}`,i([l({type:String})],e.prototype,"type",2),i([l({type:Boolean,reflect:!0,attribute:"on-dark"})],e.prototype,"onDark",2),e=i([b("deck-callout")],e);export{e as DeckCallout};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type DeckCellAlign = 'start' | 'center' | 'end' | 'stretch';
|
|
3
|
+
export type DeckCellJustify = 'start' | 'center' | 'end' | 'between';
|
|
4
|
+
export declare class DeckCell extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
6
|
+
span?: string;
|
|
7
|
+
col?: string;
|
|
8
|
+
row?: string;
|
|
9
|
+
align?: DeckCellAlign;
|
|
10
|
+
justify?: DeckCellJustify;
|
|
11
|
+
tone?: string;
|
|
12
|
+
updated(): void;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'deck-cell': DeckCell;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var n=(e,r,s,d)=>{for(var i=d>1?void 0:d?f(r,s):r,l=e.length-1,c;l>=0;l--)(c=e[l])&&(i=(d?c(r,s,i):c(i))||i);return d&&i&&p(r,s,i),i};import{LitElement as u,html as b,css as k}from"./vendor/lit.js";import{customElement as h,property as o}from"./vendor/lit.js";function a(e){if(!e)return"auto";let r=e.trim();return/^\d+$/.test(r)?`span ${r}`:r}function g(e){if(!e)return{col:"auto",row:"auto"};let[r,s]=e.toLowerCase().split("x");return{col:a(r),row:a(s)}}var v={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"},m={start:"flex-start",center:"center",end:"flex-end",between:"space-between"},t=class extends u{updated(){let r=g(this.span);this.style.setProperty("--_col",this.col?a(this.col):r.col),this.style.setProperty("--_row",this.row?a(this.row):r.row),this.align&&this.style.setProperty("--_align",v[this.align]??this.align),this.justify&&this.style.setProperty("--_justify",m[this.justify]??this.justify)}render(){return b`<slot></slot>`}};t.styles=k`:host{display:flex;flex-direction:column;gap:var(--deck-cell-gap,var(--rik-space-2));align-items:var(--_align,stretch);justify-content:var(--_justify,flex-start);grid-column:var(--_col,auto);grid-row:var(--_row,auto);min-width:0;min-height:0;overflow:hidden;box-sizing:border-box;container-type:size;padding:var(--deck-cell-padding-y,var(--rik-space-3)) var(--deck-cell-padding-x,var(--rik-space-4));background:var(--deck-cell-bg,var(--rik-surface-raised--strong));border:1px solid var(--deck-cell-border,var(--rik-border-default));border-radius:var(--deck-cell-radius,var(--rik-radius-lg));font-family:var(--rik-font-sans);color:var(--rik-text-default--muted)}:host([tone="info"]){background:var(--deck-cell-bg,var(--rik-status-info__bg));border-color:var(--deck-cell-border,var(--rik-status-info__border))}:host([tone="warn"]){background:var(--deck-cell-bg,var(--rik-status-warn__bg));border-color:var(--deck-cell-border,var(--rik-status-warn__border))}:host([tone="ok"]){background:var(--deck-cell-bg,var(--rik-status-success__bg));border-color:var(--deck-cell-border,var(--rik-status-success__border))}:host([tone="danger"]){background:var(--deck-cell-bg,var(--rik-status-danger__bg));border-color:var(--deck-cell-border,var(--rik-status-danger__border))}:host([plain]){background:none;border-color:transparent;border-radius:0}:host([flat]){border:none}::slotted(h3){font-family:var(--rik-font-display,var(--rik-font-sans));font-size:var(--rik-font-size-h2);font-weight:700;color:var(--rik-text-default);letter-spacing:-0.01em;line-height:1.2;margin:0}::slotted(p){font-size:var(--rik-font-size-body);line-height:1.5;margin:0}::slotted(img),::slotted(svg),::slotted(video){flex:1 1 0;min-height:0;width:100%;max-width:100%;object-fit:contain}::slotted(table){width:100%;border-collapse:collapse}`,n([o({type:String})],t.prototype,"span",2),n([o({type:String})],t.prototype,"col",2),n([o({type:String})],t.prototype,"row",2),n([o({type:String})],t.prototype,"align",2),n([o({type:String})],t.prototype,"justify",2),n([o({type:String})],t.prototype,"tone",2),t=n([h("deck-cell")],t);export{t as DeckCell};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class DeckChecklist extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
/** Columns · 1 (default) reads as a list, 2 as a contrast. */
|
|
5
|
+
cols?: string;
|
|
6
|
+
willUpdate(): void;
|
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
8
|
+
}
|
|
9
|
+
export declare class DeckCheck extends LitElement {
|
|
10
|
+
static styles: import("lit").CSSResult;
|
|
11
|
+
/** This one does NOT work · flips the marker and its colour. */
|
|
12
|
+
no: boolean;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'deck-checklist': DeckChecklist;
|
|
18
|
+
'deck-check': DeckCheck;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var s=(o,e,n,c)=>{for(var r=c>1?void 0:c?u(e,n):e,i=o.length-1,d;i>=0;i--)(d=o[i])&&(r=(c?d(e,n,r):d(r))||r);return c&&r&&k(e,n,r),r};import{LitElement as v,css as h,html as m}from"./vendor/lit.js";import{customElement as p,property as M}from"./vendor/lit.js";var g='{"check":"M20 6 9 17l-5-5","cross":"M18 6 6 18M6 6l12 12","alert":"M12 9v4m0 4h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z","info":"M12 16v-4m0-4h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z","question":"M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3m.1 4h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z","ban":"M4.9 4.9l14.2 14.2M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z","arrow":"M5 12h14m-6-6 6 6-6 6","arrow-down":"M12 5v14m6-6-6 6-6-6","clock":"M12 6v6l4 2m6-2a10 10 0 1 1-20 0 10 10 0 0 1 20 0Z","calendar":"M8 2v4m8-4v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z","refresh":"M21 12a9 9 0 1 1-3-6.7M21 3v6h-6","trend":"M22 7 13.5 15.5l-5-5L2 17M16 7h6v6","user":"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z","team":"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm10 14v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8","target":"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0-6a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 9a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z","flag":"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1Zm0 0v7","lock":"M7 11V7a5 5 0 0 1 10 0v4M5 11h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2Z","search":"M21 21l-4.3-4.3M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z","code":"M16 18l6-6-6-6M8 6l-6 6 6 6","database":"M3 5c0 1.7 4 3 9 3s9-1.3 9-3-4-3-9-3-9 1.3-9 3Zm0 0v14c0 1.7 4 3 9 3s9-1.3 9-3V5M3 12c0 1.7 4 3 9 3s9-1.3 9-3","cloud":"M17.5 19a4.5 4.5 0 0 0 0-9h-1.3A7 7 0 1 0 4 16.9","document":"M14 2v6h6M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Zm-6 11h8m-8 4h8m-8-8h2","chart":"M3 3v18h18M7 16V9m5 7V5m5 11v-4","spark":"M12 2 15 9l7 3-7 3-3 7-3-7-7-3 7-3Z"}',l=Object.freeze(JSON.parse(g)),x=Object.keys(l);var a=class extends v{willUpdate(){let e=Number.parseInt(this.cols??"1",10);this.style.setProperty("--_cols",String(e>=1&&e<=6?e:1))}render(){return m`<slot></slot>`}};a.styles=h`:host{display:grid;grid-template-columns:repeat(var(--deck-checklist-cols,var(--_cols,1)),minmax(0,1fr));gap:0 var(--deck-checklist-gap,var(--rik-space-6));align-content:start}::slotted(deck-check){border-top:1px solid var(--deck-checklist-rule,var(--rik-border-default))}`,s([M({type:String,reflect:!0})],a.prototype,"cols",2),a=s([p("deck-checklist")],a);var t=class extends v{constructor(){super(...arguments);this.no=!1}render(){return m`<span class="mark" part="mark" role="img" aria-label=${this.no?"No":"Yes"}> <svg viewBox="0 0 24 24" focusable="false"> <path d=${this.no?l.cross:l.check} /> </svg> </span> <span part="label"><slot></slot></span>`}};t.styles=h`:host{display:flex;align-items:baseline;gap:var(--deck-check-gap,var(--rik-space-3));padding:var(--deck-check-padding,var(--rik-space-3)) 0;font-family:var(--rik-font-sans);font-size:var(--rik-font-size-lead);line-height:1.35;color:var(--deck-check-color,var(--rik-text-default))}.mark{flex:none;width:var(--deck-check-size,1.1em);height:var(--deck-check-size,1.1em);align-self:center;color:var(--deck-check-yes,var(--rik-status-success__text))}:host([no]) .mark{color:var(--deck-check-no,var(--rik-status-danger__text))}:host([no]) [part='label']{color:var(--deck-check-no-color,var(--rik-text-default--muted))}svg{width:100%;height:100%;display:block;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}@media print{.mark{-webkit-print-color-adjust:exact;print-color-adjust:exact}}`,s([M({type:Boolean,reflect:!0})],t.prototype,"no",2),t=s([p("deck-check")],t);export{t as DeckCheck,a as DeckChecklist};
|
|
@@ -5,6 +5,8 @@ export declare class DeckCover extends LitElement {
|
|
|
5
5
|
brandSrc?: string;
|
|
6
6
|
speaker?: string;
|
|
7
7
|
company?: string;
|
|
8
|
+
/** Optional client logo shown before the company name. */
|
|
9
|
+
companySrc?: string;
|
|
8
10
|
duration?: string;
|
|
9
11
|
audience?: string;
|
|
10
12
|
runtime?: string;
|
|
@@ -13,6 +15,12 @@ export declare class DeckCover extends LitElement {
|
|
|
13
15
|
durationLabel?: string;
|
|
14
16
|
audienceLabel?: string;
|
|
15
17
|
runtimeLabel?: string;
|
|
18
|
+
/** The meta labels, in the language the document declares.
|
|
19
|
+
*
|
|
20
|
+
* These four words used to be French whatever the deck said, so an English
|
|
21
|
+
* deck opened on "PRÉSENTÉ PAR". Everything else the engine writes is in
|
|
22
|
+
* English; the cover is the only place that spoke for the author. */
|
|
23
|
+
private labels;
|
|
16
24
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
25
|
}
|
|
18
26
|
declare global {
|
package/dist/deck-cover.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
${s?
|
|
3
|
-
${o
|
|
1
|
+
var f=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var e=(p,a,l,s)=>{for(var i=s>1?void 0:s?v(a,l):a,c=p.length-1,d;c>=0;c--)(d=p[c])&&(i=(s?d(a,l,i):d(i))||i);return s&&i&&f(a,l,i),i};import{LitElement as h,html as o,css as y}from"./vendor/lit.js";import{customElement as x,property as r}from"./vendor/lit.js";import{css as m}from"./vendor/lit.js";var b=m`:host{display:none;position:absolute;inset:0;padding:var(--rik-slide-padding-y) var(--rik-slide-padding-x);flex-direction:column;overflow:hidden;background:var(--rik-surface-page);font-family:var(--rik-font-sans);color:var(--rik-text-default)}:host([active]){display:flex}.body,.col{justify-content:var(--_spread,var(--rik-slide-spread,center))}:host([fill]) .body > ::slotted(*),:host([fill]) .col > ::slotted(*){flex:1 1 0;min-height:0}:host([fill]) .body,:host([fill]) .col{justify-content:stretch}@media print{:host{display:flex;position:relative;inset:auto;width:calc(var(--deck-canvas-w,1920) * 1px);height:calc(var(--deck-canvas-h,1080) * 1px);break-inside:avoid;break-after:page;-webkit-print-color-adjust:exact;print-color-adjust:exact}:host(:last-child){break-after:auto}}`,k=m`h1{font-size:var(--rik-font-size-h1);font-weight:700;color:var(--rik-text-default);letter-spacing:-0.022em;line-height:1.15;margin-bottom:var(--rik-space-4);padding-bottom:var(--rik-space-2);border-bottom:3px solid var(--rik-accent);display:inline-block;align-self:flex-start;flex:0 0 auto}h1 .accent{color:var(--rik-accent)}::slotted(p),p{font-size:var(--rik-font-size-body);line-height:1.65;color:var(--rik-text-default--muted);margin:0}::slotted(strong),strong{color:var(--rik-text-default);font-weight:700}::slotted(code),code{font-family:var(--rik-font-mono);font-size:var(--rik-font-size-mono-sm);background:rgba(0,0,0,0.06);padding:2px 6px;border-radius:var(--rik-radius-sm);color:var(--rik-text-default)}`,u=m`.lbl{display:inline-block;padding:var(--deck-eyebrow-padding-y,0) var(--deck-eyebrow-padding-x,0);background:var(--deck-eyebrow-bg,transparent);color:var(--deck-eyebrow-color,var(--rik-accent__text));border-radius:var(--deck-eyebrow-radius,0);font-size:var(--rik-font-size-body);font-weight:600;margin-bottom:var(--rik-space-1);align-self:flex-start}.lead{font-size:var(--rik-font-size-lead);color:var(--rik-text-default--faint);line-height:1.5;margin-bottom:var(--rik-space-4);max-width:75ch;flex:0 0 auto}.kicker{font-size:var(--rik-font-size-xs);font-weight:700;letter-spacing:0.14em;text-transform:uppercase;color:var(--rik-text-default--faint);margin-bottom:var(--rik-space-3);display:block}.kicker.on-dark{color:rgba(255,255,255,0.35)}.caption{font-size:var(--rik-font-size-sm);color:var(--rik-text-default--faint);line-height:1.55}.caption.on-dark{color:rgba(255,255,255,0.5)}.col-label{font-size:var(--rik-font-size-xs);font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--rik-text-default--faint);margin-bottom:var(--rik-space-2)}`,g=[b,k,u];var t=class extends h{labels(){return(this.closest("[lang]")?.getAttribute("lang")??(typeof document>"u"?"":document.documentElement.lang)).toLowerCase().startsWith("fr")?{speaker:"Pr\xE9sent\xE9 par",company:"Entreprise",duration:"Dur\xE9e",audience:"Audience"}:{speaker:"Presented by",company:"Company",duration:"Duration",audience:"Audience"}}render(){let a=this.labels(),l=(this.brand??"").split("\xB7").map(n=>n.trim()).filter(Boolean),s=l[0]??"",i=l.slice(1).join(" \xB7 "),c=[this.speaker&&{key:"speaker",l:this.speakerLabel??a.speaker,v:this.speaker},this.company&&{key:"company",l:this.companyLabel??a.company,v:this.company,src:this.companySrc},this.duration&&{key:"duration",l:this.durationLabel??a.duration,v:this.duration},this.audience&&{key:"audience",l:this.audienceLabel??a.audience,v:this.audience},this.runtime&&{key:"runtime",l:this.runtimeLabel??"Runtime",v:this.runtime}].filter(n=>!!n),d=!!this.brandSrc;return o`<div class="brand" part="brand"> ${d?o`<span class="brand-tile"><img src="${this.brandSrc}" alt="${s}"></span>`:""}
|
|
2
|
+
${s?o`<span class="brand-name">${s}</span>`:""}
|
|
3
|
+
${i?o`<span class="brand-context">${i}</span>`:""}
|
|
4
4
|
</div>
|
|
5
5
|
<slot></slot>
|
|
6
|
-
${
|
|
7
|
-
<div class="meta-item"
|
|
6
|
+
${c.length?o`<div class="meta" part="meta"> ${c.map(n=>o`
|
|
7
|
+
<div class="meta-item" data-field="${n.key}">
|
|
8
|
+
<strong>${n.l}</strong>
|
|
9
|
+
${n.src?o`<div class="meta-value"><img class="meta-logo" src="${n.src}" alt=""><span>${n.v}</span></div>`:o`<span>${n.v}</span>`}
|
|
10
|
+
</div>
|
|
8
11
|
`)}
|
|
9
12
|
</div>`:""}
|
|
10
|
-
`}};t.styles=[...
|
|
13
|
+
`}};t.styles=[...g,y`:host{background:var(--deck-cover-bg,var(--rik-surface-inverse));justify-content:center;color:var(--deck-cover-text,var(--rik-text-inverse))}.brand{display:inline-flex;align-items:center;gap:var(--rik-space-3);margin-bottom:var(--rik-space-5);align-self:flex-start}.brand-tile{width:2.5rem;height:2.5rem;display:inline-flex;align-items:center;justify-content:center}.brand-tile img{width:100%;height:100%;display:block}.brand-name{font-family:var(--rik-font-display,inherit);font-size:var(--rik-font-size-xs);font-weight:700;letter-spacing:0.2em;text-transform:uppercase;color:var(--deck-cover-soft,var(--rik-text-inverse--muted))}.brand-context{font-size:var(--rik-font-size-xs);font-weight:700;color:var(--deck-cover-muted,var(--rik-text-inverse--faint));letter-spacing:0.2em;text-transform:uppercase;padding-left:var(--rik-space-3);border-left:1px solid var(--deck-cover-border,var(--rik-border-inverse))}::slotted(h1){font-size:clamp(3.6rem,9cqw,8.5rem);font-weight:900;color:var(--deck-cover-text,var(--rik-text-inverse));line-height:1.02;letter-spacing:-0.035em;margin-bottom:var(--rik-space-4);border:none;padding:0}::slotted(.sub){font-size:var(--rik-font-size-h2);color:var(--deck-cover-muted,var(--rik-text-inverse--faint));margin-bottom:var(--rik-space-6);max-width:60ch;line-height:1.45;display:block}.meta{display:flex;gap:var(--rik-space-6);border-top:1px solid var(--deck-cover-border,var(--rik-border-inverse));padding-top:var(--rik-space-4)}.meta-item strong{display:block;font-size:var(--rik-font-size-xs);letter-spacing:0.12em;text-transform:uppercase;color:var(--deck-cover-faint,var(--rik-text-inverse--muted));margin-bottom:6px;font-weight:700}.meta-item span{color:var(--deck-cover-text,var(--rik-text-inverse));font-size:var(--rik-font-size-body);font-weight:600}.meta-value{display:flex;align-items:center;gap:var(--rik-space-2)}.meta-logo{height:1.6em;width:auto;display:block}`],e([r({type:String})],t.prototype,"brand",2),e([r({type:String,attribute:"brand-src"})],t.prototype,"brandSrc",2),e([r({type:String})],t.prototype,"speaker",2),e([r({type:String})],t.prototype,"company",2),e([r({type:String,attribute:"company-src"})],t.prototype,"companySrc",2),e([r({type:String})],t.prototype,"duration",2),e([r({type:String})],t.prototype,"audience",2),e([r({type:String})],t.prototype,"runtime",2),e([r({type:String,attribute:"speaker-label"})],t.prototype,"speakerLabel",2),e([r({type:String,attribute:"company-label"})],t.prototype,"companyLabel",2),e([r({type:String,attribute:"duration-label"})],t.prototype,"durationLabel",2),e([r({type:String,attribute:"audience-label"})],t.prototype,"audienceLabel",2),e([r({type:String,attribute:"runtime-label"})],t.prototype,"runtimeLabel",2),t=e([x("deck-cover")],t);export{t as DeckCover};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class DeckCsv extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
delimiter: string;
|
|
5
|
+
noHeader: boolean;
|
|
6
|
+
fit: boolean;
|
|
7
|
+
fitMin?: number;
|
|
8
|
+
fitMax?: number;
|
|
9
|
+
/** 1-based body rows to emphasise · `2` or `2 5`. A table with no hierarchy
|
|
10
|
+
* is unreadable at projection distance. */
|
|
11
|
+
highlightRows?: string;
|
|
12
|
+
/** 1-based columns to emphasise · same grammar. */
|
|
13
|
+
highlightCols?: string;
|
|
14
|
+
/** Reveal body rows one per step instead of showing the whole table. */
|
|
15
|
+
reveal: boolean;
|
|
16
|
+
/** Current step, set by deck-root on every step change. */
|
|
17
|
+
private step;
|
|
18
|
+
private rows;
|
|
19
|
+
private fitter;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
/** One step per body row when revealing · published on the host slide, which
|
|
22
|
+
* is where the engine reads the count from. Never lowers an author's own. */
|
|
23
|
+
private _publishSteps;
|
|
24
|
+
/** Called by deck-root on every step change. */
|
|
25
|
+
applyStep(step: number): void;
|
|
26
|
+
/** 1-based indices from a space-separated attribute. */
|
|
27
|
+
private _marked;
|
|
28
|
+
updated(): void;
|
|
29
|
+
/** Re-read the light-DOM CSV and re-render · used by the live editor. */
|
|
30
|
+
reparse(): void;
|
|
31
|
+
private parse;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
}
|
|
34
|
+
declare global {
|
|
35
|
+
interface HTMLElementTagNameMap {
|
|
36
|
+
'deck-csv': DeckCsv;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/dist/deck-csv.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var k=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var d=(l,r,t,i)=>{for(var e=i>1?void 0:i?w(r,t):r,a=l.length-1,s;a>=0;a--)(s=l[a])&&(e=(i?s(r,t,e):s(e))||e);return i&&e&&k(r,t,e),e};import{LitElement as x,html as u,css as R}from"./vendor/lit.js";import{customElement as S,property as f,state as v}from"./vendor/lit.js";function y(l,r,t,i=.5){if(r<=l)return l;if(t(r))return r;let e=l,a=r;for(;a-e>i;){let s=(e+a)/2;t(s)?e=s:a=s}return e}var b=class{constructor(r,t={}){this.host=r;this.opts=t;r.addController(this)}hostConnected(){this.ro=new ResizeObserver(()=>this.refit()),this.ro.observe(this.host),this.refit(),document.fonts?.ready?.then(()=>{this.ro&&this.refit()})}hostDisconnected(){this.ro?.disconnect(),this.ro=void 0}refit(){let r=this.host;if(this.opts.enabled&&!this.opts.enabled()){r.style.removeProperty("font-size");return}if(r.clientWidth===0||r.clientHeight===0)return;let t=parseFloat(getComputedStyle(document.documentElement).fontSize)||16,i=(this.opts.minRem?.()??1)*t,e=(this.opts.maxRem?.()??12)*t,a=s=>(r.style.fontSize=`${s}px`,r.scrollWidth<=r.clientWidth&&r.scrollHeight<=r.clientHeight);r.style.fontSize=`${y(i,e,a)}px`}};function g(l,r=","){let t=[],i=[],e=[],a="",s=!1,h=!1,n=()=>{e.push(a),a=""},c=()=>{n(),t.push(e),i.push(h),e=[],h=!1};for(let p=0;p<l.length;p++){let m=l[p];if(s){m==='"'?l[p+1]==='"'?(a+='"',p++):s=!1:a+=m;continue}m==='"'?(s=!0,h=!0):l.startsWith(r,p)?(n(),p+=r.length-1):m===`
|
|
2
|
+
`?c():m==="\r"?l[p+1]!==`
|
|
3
|
+
`&&c():a+=m}return(a.length>0||e.length>0)&&c(),t.filter((p,m)=>i[m]||!(p.length===1&&p[0]===""))}var o=class extends x{constructor(){super(...arguments);this.delimiter=",";this.noHeader=!1;this.fit=!1;this.reveal=!1;this.step=0;this.rows=[];this.fitter=new b(this,{enabled:()=>this.fit,minRem:()=>this.fitMin??.6,maxRem:()=>this.fitMax??2})}connectedCallback(){super.connectedCallback(),this.parse(),this._publishSteps()}_publishSteps(){if(!this.reveal)return;let t=this;for(;t?.parentElement&&t.parentElement.tagName.toLowerCase()!=="deck-root";)t=t.parentElement;if(!t?.parentElement)return;let i=Math.max(0,this.rows.length-(this.noHeader?0:1)),e=Number(t.getAttribute("steps")??t.getAttribute("data-steps")??"0");i>e&&t.setAttribute("data-steps",String(i))}applyStep(t){this.step=t}_marked(t){return new Set((t??"").split(/[\s,]+/).map(i=>Number.parseInt(i,10)).filter(i=>Number.isFinite(i)&&i>0))}updated(){this.fitter.refit()}reparse(){this.parse()}parse(){let t=this.textContent??"",i=t.split(`
|
|
4
|
+
`),e=i.filter(n=>n.trim().length>0).reduce((n,c)=>Math.min(n,c.match(/^ */)?.[0].length??0),1/0),a=e===1/0?t:i.map(n=>n.slice(e)).join(`
|
|
5
|
+
`),s=g(a.trim(),this.delimiter).map(n=>n.map(c=>c.trim())),h=s.reduce((n,c)=>Math.max(n,c.length),0);this.rows=s.map(n=>n.length===h?n:[...n,...Array(h-n.length).fill("")])}render(){if(this.rows.length===0)return u``;let t=this.noHeader?null:this.rows[0],i=this.noHeader?this.rows:this.rows.slice(1),e=this._marked(this.highlightRows),a=this._marked(this.highlightCols);return u`<table part="table"> ${t?u`<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
${t.map((s,h)=>u`<th ?data-mark=${a.has(h+1)}>${s}</th>`)}
|
|
8
|
+
</tr>
|
|
9
|
+
</thead>`:""}
|
|
10
|
+
<tbody>
|
|
11
|
+
${i.map((s,h)=>u`<tr ?data-mark=${e.has(h+1)} ?data-pending=${this.reveal&&h+1>this.step} > ${s.map((n,c)=>u`<td ?data-mark=${a.has(c+1)}>${n}</td>`)}
|
|
12
|
+
</tr>`)}
|
|
13
|
+
</tbody>
|
|
14
|
+
</table>
|
|
15
|
+
`}};o.styles=R`:host{display:block;min-width:0;overflow:hidden;font-family:var(--rik-font-sans);font-size:var(--rik-font-size-body)}:host([fit]){width:100%;height:100%}table{width:100%;border-collapse:collapse;font-size:1em;color:var(--rik-text-default--muted)}th,td{border:1px solid var(--deck-csv-border,var(--rik-border-default));padding:var(--deck-csv-padding-y,var(--rik-space-1)) var(--deck-csv-padding-x,var(--rik-space-2));text-align:left;vertical-align:top}tr[data-mark] > td{background:var(--deck-csv-mark-bg,var(--rik-surface-inverse));color:var(--deck-csv-mark-color,var(--rik-text-inverse));border-color:var(--deck-csv-mark-bg,var(--rik-surface-inverse));font-weight:700}td[data-mark],th[data-mark]{color:var(--deck-csv-mark-col-color,var(--rik-accent__text));font-weight:700}tr[data-mark] > td[data-mark]{color:var(--deck-csv-mark-col-on-mark,var(--rik-accent))}tr[data-pending]{visibility:hidden}@media print{tr[data-pending]{visibility:visible}tr[data-mark] > td,td[data-mark],th[data-mark]{-webkit-print-color-adjust:exact;print-color-adjust:exact}}th{background:var(--deck-csv-header-bg,transparent);color:var(--rik-text-default);font-weight:700;border-bottom:2px solid var(--deck-csv-header-rule,var(--rik-accent))}`,d([f({type:String})],o.prototype,"delimiter",2),d([f({type:Boolean,attribute:"no-header"})],o.prototype,"noHeader",2),d([f({type:Boolean})],o.prototype,"fit",2),d([f({type:Number,attribute:"fit-min"})],o.prototype,"fitMin",2),d([f({type:Number,attribute:"fit-max"})],o.prototype,"fitMax",2),d([f({type:String,attribute:"highlight-rows"})],o.prototype,"highlightRows",2),d([f({type:String,attribute:"highlight-cols"})],o.prototype,"highlightCols",2),d([f({type:Boolean,reflect:!0})],o.prototype,"reveal",2),d([v()],o.prototype,"step",2),d([v()],o.prototype,"rows",2),o=d([S("deck-csv")],o);export{o as DeckCsv};
|