@threadlabs/looma 0.51.4 → 0.51.6
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/components/ui-card/ui-card.html +7 -0
- package/components/ui-disclosure/ui-disclosure.js +42 -1
- package/dist/index.js +1 -1
- package/docs/catalog.json +28 -1
- package/editor/index.js +44 -1
- package/package.json +1 -1
- package/styles/ui-card.css +5 -0
- package/vanilla/UiCard.d.ts +1 -0
- package/vanilla/UiCard.js +13 -13
package/docs/catalog.json
CHANGED
|
@@ -533,7 +533,7 @@
|
|
|
533
533
|
],
|
|
534
534
|
"schemaVersion": 1,
|
|
535
535
|
"package": "@threadlabs/looma",
|
|
536
|
-
"version": "0.51.
|
|
536
|
+
"version": "0.51.6",
|
|
537
537
|
"groups": [
|
|
538
538
|
{
|
|
539
539
|
"id": "layout",
|
|
@@ -6085,6 +6085,17 @@
|
|
|
6085
6085
|
"aside"
|
|
6086
6086
|
]
|
|
6087
6087
|
},
|
|
6088
|
+
{
|
|
6089
|
+
"name": "fill",
|
|
6090
|
+
"property": "fill",
|
|
6091
|
+
"description": "In a bounded flex column, grows into the remaining height. Put a filling Scroll Area in the body when its content needs to scroll independently.",
|
|
6092
|
+
"type": "boolean",
|
|
6093
|
+
"valueType": {
|
|
6094
|
+
"kind": "terminal",
|
|
6095
|
+
"name": "boolean"
|
|
6096
|
+
},
|
|
6097
|
+
"default": false
|
|
6098
|
+
},
|
|
6088
6099
|
{
|
|
6089
6100
|
"name": "padding",
|
|
6090
6101
|
"property": "padding",
|
|
@@ -6185,6 +6196,12 @@
|
|
|
6185
6196
|
"aside"
|
|
6186
6197
|
]
|
|
6187
6198
|
},
|
|
6199
|
+
{
|
|
6200
|
+
"name": "fill",
|
|
6201
|
+
"description": "In a bounded flex column, grows into the remaining height. Put a filling Scroll Area in the body when its content needs to scroll independently.",
|
|
6202
|
+
"type": "boolean",
|
|
6203
|
+
"default": false
|
|
6204
|
+
},
|
|
6188
6205
|
{
|
|
6189
6206
|
"name": "padding",
|
|
6190
6207
|
"description": "The space inside the card: xs is compact (0.5rem), sm is snug (0.75rem), md is the default (1.5rem), and lg is roomy (2rem).",
|
|
@@ -6323,6 +6340,16 @@
|
|
|
6323
6340
|
"resizable": false,
|
|
6324
6341
|
"bindings": "",
|
|
6325
6342
|
"frameworks": {}
|
|
6343
|
+
},
|
|
6344
|
+
{
|
|
6345
|
+
"id": "@threadlabs/looma/ui-card/05-fill",
|
|
6346
|
+
"name": "05-fill",
|
|
6347
|
+
"title": "Fill a bounded column",
|
|
6348
|
+
"description": "Place this stack in a bounded-height parent. The surface fills the remaining space while its body scrolls independently.",
|
|
6349
|
+
"markup": "<ui-stack fill gap=\"s\">\n <ui-text weight=\"semibold\">Reference panel</ui-text>\n <ui-card fill variant=\"subtle\" tone=\"accent\" padding=\"xs\">\n <ui-scroll-area fill>\n <ui-stack gap=\"s\">\n <ui-text>A short list still has a full-height surface.</ui-text>\n <ui-text>Longer content scrolls inside this panel.</ui-text>\n </ui-stack>\n </ui-scroll-area>\n </ui-card>\n <ui-text size=\"sm\" tone=\"secondary\">Persistent controls stay below the panel.</ui-text>\n</ui-stack>",
|
|
6350
|
+
"resizable": false,
|
|
6351
|
+
"bindings": "",
|
|
6352
|
+
"frameworks": {}
|
|
6326
6353
|
}
|
|
6327
6354
|
]
|
|
6328
6355
|
},
|
package/editor/index.js
CHANGED
|
@@ -12077,12 +12077,47 @@ function connect$2(host) {
|
|
|
12077
12077
|
host.state.internalOpen = Boolean(external);
|
|
12078
12078
|
let groupName = "";
|
|
12079
12079
|
let disposed = false;
|
|
12080
|
+
let motionFrame = 0;
|
|
12081
|
+
let takeoverMotion;
|
|
12082
|
+
const view = document.defaultView;
|
|
12083
|
+
const reducedMotion = view?.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
12084
|
+
const stopTakeoverMotion = () => {
|
|
12085
|
+
view?.cancelAnimationFrame(motionFrame);
|
|
12086
|
+
motionFrame = 0;
|
|
12087
|
+
takeoverMotion?.cancel();
|
|
12088
|
+
};
|
|
12089
|
+
const onMotionPreferenceChange = () => {
|
|
12090
|
+
if (reducedMotion.matches) stopTakeoverMotion();
|
|
12091
|
+
};
|
|
12092
|
+
reducedMotion?.addEventListener("change", onMotionPreferenceChange);
|
|
12093
|
+
const animateFillTakeover = () => {
|
|
12094
|
+
if (motionFrame || !host.props.fill.value || !view || !host.element.animate) return;
|
|
12095
|
+
const previousTop = host.refs.heading.getBoundingClientRect().top;
|
|
12096
|
+
takeoverMotion?.cancel();
|
|
12097
|
+
if (reducedMotion?.matches) return;
|
|
12098
|
+
motionFrame = view.requestAnimationFrame(() => {
|
|
12099
|
+
motionFrame = 0;
|
|
12100
|
+
if (disposed || !host.element.isConnected) return;
|
|
12101
|
+
const delta = previousTop - host.refs.heading.getBoundingClientRect().top;
|
|
12102
|
+
if (Math.abs(delta) < 1) return;
|
|
12103
|
+
const style = view.getComputedStyle(host.element);
|
|
12104
|
+
const duration = style.transitionDuration.split(",")[0].trim();
|
|
12105
|
+
const milliseconds = parseFloat(duration) * (duration.endsWith("ms") ? 1 : 1e3);
|
|
12106
|
+
if (!(milliseconds > 0)) return;
|
|
12107
|
+
takeoverMotion = host.element.animate([{ translate: `0 ${delta}px` }, { translate: "0 0" }], {
|
|
12108
|
+
duration: milliseconds,
|
|
12109
|
+
easing: style.transitionTimingFunction,
|
|
12110
|
+
fill: "none"
|
|
12111
|
+
});
|
|
12112
|
+
});
|
|
12113
|
+
};
|
|
12080
12114
|
const member = {
|
|
12081
12115
|
isOpen: () => Boolean(host.state.internalOpen),
|
|
12082
12116
|
required: () => Boolean(host.props.requiredOpen.value),
|
|
12083
12117
|
disabled: () => Boolean(host.props.disabled.value),
|
|
12084
12118
|
open() {
|
|
12085
12119
|
if (disposed || host.state.internalOpen) return;
|
|
12120
|
+
animateFillTakeover();
|
|
12086
12121
|
host.state.internalOpen = true;
|
|
12087
12122
|
syncGroup("programmatic", "programmatic");
|
|
12088
12123
|
host.dispatch("open", {
|
|
@@ -12093,6 +12128,7 @@ function connect$2(host) {
|
|
|
12093
12128
|
},
|
|
12094
12129
|
close(reason, how) {
|
|
12095
12130
|
if (!host.state.internalOpen) return;
|
|
12131
|
+
animateFillTakeover();
|
|
12096
12132
|
host.state.internalOpen = false;
|
|
12097
12133
|
host.dispatch("close", {
|
|
12098
12134
|
open: false,
|
|
@@ -12121,7 +12157,10 @@ function connect$2(host) {
|
|
|
12121
12157
|
const stop = host.effect(() => {
|
|
12122
12158
|
if (host.props.open.value !== external) {
|
|
12123
12159
|
external = host.props.open.value;
|
|
12124
|
-
if (external || mayClose())
|
|
12160
|
+
if (external || mayClose()) {
|
|
12161
|
+
animateFillTakeover();
|
|
12162
|
+
host.state.internalOpen = Boolean(external);
|
|
12163
|
+
}
|
|
12125
12164
|
}
|
|
12126
12165
|
const level = Number(host.props.headingLevel.value);
|
|
12127
12166
|
host.state.headingRole = Number.isInteger(level) && level >= 2 && level <= 6 ? "heading" : null;
|
|
@@ -12135,6 +12174,7 @@ function connect$2(host) {
|
|
|
12135
12174
|
const open = !host.state.internalOpen;
|
|
12136
12175
|
if (!open && !mayClose()) return;
|
|
12137
12176
|
const how = trigger();
|
|
12177
|
+
animateFillTakeover();
|
|
12138
12178
|
host.state.internalOpen = open;
|
|
12139
12179
|
if (open) syncGroup("action", how);
|
|
12140
12180
|
host.dispatch(open ? "open" : "close", {
|
|
@@ -12145,6 +12185,7 @@ function connect$2(host) {
|
|
|
12145
12185
|
};
|
|
12146
12186
|
const onBeforematch = () => queueMicrotask(() => {
|
|
12147
12187
|
if (disposed || host.state.internalOpen) return;
|
|
12188
|
+
animateFillTakeover();
|
|
12148
12189
|
host.state.internalOpen = true;
|
|
12149
12190
|
syncGroup("programmatic", "programmatic");
|
|
12150
12191
|
host.dispatch("open", {
|
|
@@ -12162,6 +12203,8 @@ function connect$2(host) {
|
|
|
12162
12203
|
measureHeading();
|
|
12163
12204
|
return () => {
|
|
12164
12205
|
disposed = true;
|
|
12206
|
+
stopTakeoverMotion();
|
|
12207
|
+
reducedMotion?.removeEventListener("change", onMotionPreferenceChange);
|
|
12165
12208
|
headingObserver?.disconnect();
|
|
12166
12209
|
stop();
|
|
12167
12210
|
stopTracking();
|
package/package.json
CHANGED
package/styles/ui-card.css
CHANGED
package/vanilla/UiCard.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface UiCardElement extends HTMLElement {
|
|
|
11
11
|
}
|
|
12
12
|
export interface UiCardProps {
|
|
13
13
|
as?: "div" | "section" | "article" | "aside" | null;
|
|
14
|
+
fill?: boolean | null;
|
|
14
15
|
padding?: "xs" | "sm" | "md" | "lg" | null;
|
|
15
16
|
size?: "content" | "sm" | "md" | "lg" | null;
|
|
16
17
|
tone?: "neutral" | "accent" | "accent-secondary" | "accent-tertiary" | "info" | "success" | "warning" | "danger" | null;
|
package/vanilla/UiCard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by HTML Next 1.0.0-alpha.79 for Vanilla DOM. Do not edit.
|
|
2
|
-
import { attachGeneratedController, buildTemplate, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, armElement, replaceRoot, checkFormat, defineComponent } from "@nextwebwg/html-next/generated-runtime";
|
|
2
|
+
import { attachGeneratedController, buildTemplate, writeAttribute, dispose, formatOf, keywordFormat, hostState, acceptProps, manageProps, generatedInputs, project, fillSlot, armElement, replaceRoot, checkBoolean, checkFormat, defineComponent } from "@nextwebwg/html-next/generated-runtime";
|
|
3
3
|
import "../styles/ui-card.css";
|
|
4
4
|
|
|
5
5
|
const T0 = ["",[],"\n ",["div",["class","header"],4],"\n ",["div",["class","content"],4],"\n ",["div",["class","actions"],4],"\n "];
|
|
@@ -20,13 +20,13 @@ const T14 = ["",[]];
|
|
|
20
20
|
const T15 = ["",[]];
|
|
21
21
|
let P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15;
|
|
22
22
|
const S = { n: [], t: [], f: import.meta.url, g: "ui-card", b: generatedInputs };
|
|
23
|
-
const A = [["section",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["article",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["aside",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["div",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]]];
|
|
23
|
+
const A = [["section",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-fill","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["article",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-fill","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["aside",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-fill","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]],["div",{},[],"",[],["data-ui-card-state","data-ui-card-prop-as","data-ui-card-prop-fill","data-ui-card-prop-padding","data-ui-card-prop-size","data-ui-card-prop-tone","data-ui-card-prop-treatment","data-ui-card-prop-variant"]]];
|
|
24
24
|
const Q = [[],[],[],[]];
|
|
25
|
-
const D = { g: "ui-card", props: { "as": { "required":false,"values":["div","section","article","aside"],"default":"div", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "padding": { "required":false,"values":["xs","sm","md","lg"],"default":"md", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "size": { "required":false,"values":["content","sm","md","lg"],"default":"content", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "tone": { "required":false,"values":["neutral","accent","accent-secondary","accent-tertiary","info","success","warning","danger"],"default":"neutral", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "treatment": { "required":false,"values":["standard","expressive"],"default":"standard", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "variant": { "required":false,"values":["outlined","subtle","elevated"],"default":"outlined", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
|
|
25
|
+
const D = { g: "ui-card", props: { "as": { "required":false,"values":["div","section","article","aside"],"default":"div", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "fill": { "required":false,"default":false, c: checkBoolean, t: "boolean", j: 0, m: "b" }, "padding": { "required":false,"values":["xs","sm","md","lg"],"default":"md", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "size": { "required":false,"values":["content","sm","md","lg"],"default":"content", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "tone": { "required":false,"values":["neutral","accent","accent-secondary","accent-tertiary","info","success","warning","danger"],"default":"neutral", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "treatment": { "required":false,"values":["standard","expressive"],"default":"standard", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] }, "variant": { "required":false,"values":["outlined","subtle","elevated"],"default":"outlined", c: checkFormat("keyword", keywordFormat), t: "keyword", j: 0, m: ["p",formatOf(keywordFormat)] } } };
|
|
26
26
|
|
|
27
27
|
export function createUiCard(options = {}, html) {
|
|
28
28
|
const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
|
|
29
|
-
const v = [null, null, null, null, null, null];
|
|
29
|
+
const v = [null, null, null, null, null, null, null];
|
|
30
30
|
let B = acceptProps(undefined, D, S.n, v, componentProps, [], html);
|
|
31
31
|
let a = ((v[0] === "section") ? 0 : (v[0] === "article") ? 1 : (v[0] === "aside") ? 2 : 3);
|
|
32
32
|
let element;
|
|
@@ -168,8 +168,8 @@ export function createUiCard(options = {}, html) {
|
|
|
168
168
|
return r;
|
|
169
169
|
};
|
|
170
170
|
const p0 = (r, c, d) => {
|
|
171
|
-
if (c &
|
|
172
|
-
const x0 = hostState(["padding","variant","treatment","tone","size"], [v[1], v[
|
|
171
|
+
if (c & 126) {
|
|
172
|
+
const x0 = hostState(["fill","padding","variant","treatment","tone","size"], [v[1], v[2], v[6], v[5], v[4], v[3]]);
|
|
173
173
|
const s0 = x0;
|
|
174
174
|
if (s0 !== r.v0) writeAttribute(r.n, "data-ui-card-state", (r.v0 = s0) === "" ? null : s0);
|
|
175
175
|
}
|
|
@@ -195,8 +195,8 @@ export function createUiCard(options = {}, html) {
|
|
|
195
195
|
return r;
|
|
196
196
|
};
|
|
197
197
|
const p4 = (r, c, d) => {
|
|
198
|
-
if (c &
|
|
199
|
-
const x0 = hostState(["padding","variant","treatment","tone","size"], [v[1], v[
|
|
198
|
+
if (c & 126) {
|
|
199
|
+
const x0 = hostState(["fill","padding","variant","treatment","tone","size"], [v[1], v[2], v[6], v[5], v[4], v[3]]);
|
|
200
200
|
const s0 = x0;
|
|
201
201
|
if (s0 !== r.v0) writeAttribute(r.n, "data-ui-card-state", (r.v0 = s0) === "" ? null : s0);
|
|
202
202
|
}
|
|
@@ -222,8 +222,8 @@ export function createUiCard(options = {}, html) {
|
|
|
222
222
|
return r;
|
|
223
223
|
};
|
|
224
224
|
const p8 = (r, c, d) => {
|
|
225
|
-
if (c &
|
|
226
|
-
const x0 = hostState(["padding","variant","treatment","tone","size"], [v[1], v[
|
|
225
|
+
if (c & 126) {
|
|
226
|
+
const x0 = hostState(["fill","padding","variant","treatment","tone","size"], [v[1], v[2], v[6], v[5], v[4], v[3]]);
|
|
227
227
|
const s0 = x0;
|
|
228
228
|
if (s0 !== r.v0) writeAttribute(r.n, "data-ui-card-state", (r.v0 = s0) === "" ? null : s0);
|
|
229
229
|
}
|
|
@@ -249,8 +249,8 @@ export function createUiCard(options = {}, html) {
|
|
|
249
249
|
return r;
|
|
250
250
|
};
|
|
251
251
|
const p12 = (r, c, d) => {
|
|
252
|
-
if (c &
|
|
253
|
-
const x0 = hostState(["padding","variant","treatment","tone","size"], [v[1], v[
|
|
252
|
+
if (c & 126) {
|
|
253
|
+
const x0 = hostState(["fill","padding","variant","treatment","tone","size"], [v[1], v[2], v[6], v[5], v[4], v[3]]);
|
|
254
254
|
const s0 = x0;
|
|
255
255
|
if (s0 !== r.v0) writeAttribute(r.n, "data-ui-card-state", (r.v0 = s0) === "" ? null : s0);
|
|
256
256
|
}
|
|
@@ -291,4 +291,4 @@ export function createUiCard(options = {}, html) {
|
|
|
291
291
|
manageProps(I);
|
|
292
292
|
return element;
|
|
293
293
|
}
|
|
294
|
-
defineComponent("ui-card", createUiCard, ["as","padding","size","tone","treatment","variant"]);
|
|
294
|
+
defineComponent("ui-card", createUiCard, ["as","fill","padding","size","tone","treatment","variant"]);
|