@starci/grammar 0.16.3 → 0.17.0
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/README.md +42 -2
- package/dist/.build-stamp.json +4 -4
- package/dist/common/registry.d.ts +2 -1
- package/dist/common/registry.d.ts.map +1 -1
- package/dist/common/registry.js +2 -2
- package/dist/common/registry.js.map +1 -1
- package/dist/common/renderers.d.ts +3 -2
- package/dist/common/renderers.d.ts.map +1 -1
- package/dist/common/renderers.js +1 -0
- package/dist/common/renderers.js.map +1 -1
- package/dist/common/styles.css +154 -4
- package/dist/core/branch/ListBox/index.d.ts.map +1 -1
- package/dist/core/branch/ListBox/index.js +4 -2
- package/dist/core/branch/ListBox/index.js.map +1 -1
- package/dist/core/branch/Tabs/index.d.ts.map +1 -1
- package/dist/core/branch/Tabs/index.js +3 -1
- package/dist/core/branch/Tabs/index.js.map +1 -1
- package/dist/core/composite/FillViewport/index.d.ts +2 -6
- package/dist/core/composite/FillViewport/index.d.ts.map +1 -1
- package/dist/core/composite/FillViewport/index.js +3 -41
- package/dist/core/composite/FillViewport/index.js.map +1 -1
- package/dist/core/composite/FillViewport/useFillMeasure.d.ts +13 -0
- package/dist/core/composite/FillViewport/useFillMeasure.d.ts.map +1 -0
- package/dist/core/composite/FillViewport/useFillMeasure.js +51 -0
- package/dist/core/composite/FillViewport/useFillMeasure.js.map +1 -0
- package/dist/core/composition/Page/index.d.ts +19 -4
- package/dist/core/composition/Page/index.d.ts.map +1 -1
- package/dist/core/composition/Page/index.js +10 -2
- package/dist/core/composition/Page/index.js.map +1 -1
- package/dist/core/composition/PaneGrid/index.d.ts +12 -4
- package/dist/core/composition/PaneGrid/index.d.ts.map +1 -1
- package/dist/core/composition/PaneGrid/index.js +62 -11
- package/dist/core/composition/PaneGrid/index.js.map +1 -1
- package/dist/core/composition/PaneGrid/layout.d.ts +2 -0
- package/dist/core/composition/PaneGrid/layout.d.ts.map +1 -1
- package/dist/core/composition/PaneGrid/layout.js +5 -3
- package/dist/core/composition/PaneGrid/layout.js.map +1 -1
- package/dist/core/composition/PaneSection/index.d.ts +28 -0
- package/dist/core/composition/PaneSection/index.d.ts.map +1 -0
- package/dist/core/composition/PaneSection/index.js +31 -0
- package/dist/core/composition/PaneSection/index.js.map +1 -0
- package/dist/core/paneContext.d.ts +12 -0
- package/dist/core/paneContext.d.ts.map +1 -0
- package/dist/core/paneContext.js +6 -0
- package/dist/core/paneContext.js.map +1 -0
- package/dist/core/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createElement, useEffect } from "react";
|
|
4
|
+
import { VerticalScrollRegion } from "../../composite/VerticalScrollRegion/index.js";
|
|
5
|
+
import { usePaneContext } from "../../paneContext.js";
|
|
6
|
+
/**
|
|
7
|
+
* One band of a Pane: it pads inline by the pane's inset, the sections of a pane stack with the row gap between them,
|
|
8
|
+
* the first takes the pane's block-start inset and the last its block-end inset. With `scroll` the band is its own
|
|
9
|
+
* full-bleed scroll owner and the inset sits on its content, so the scrollbar stays on the pane edge. A section outside
|
|
10
|
+
* a Pane throws `PANE_SECTION_OUTSIDE_PANE`.
|
|
11
|
+
*/
|
|
12
|
+
export const PaneSection = ({ children, grow = false, scroll, align = "start", bleed, gap = "row", as = "div" }) => {
|
|
13
|
+
const pane = usePaneContext();
|
|
14
|
+
useEffect(() => pane?.register(), [pane]);
|
|
15
|
+
if (pane === undefined)
|
|
16
|
+
throw new Error("PANE_SECTION_OUTSIDE_PANE");
|
|
17
|
+
const shared = {
|
|
18
|
+
"data-component": "PaneSection",
|
|
19
|
+
"data-tier": "composition",
|
|
20
|
+
"data-grammar-pane-section-align": align,
|
|
21
|
+
"data-grammar-pane-section-gap": gap,
|
|
22
|
+
"data-grammar-pane-section-bleed": bleed,
|
|
23
|
+
"data-grammar-pane-section-grow": grow || scroll !== undefined ? "true" : undefined,
|
|
24
|
+
};
|
|
25
|
+
const contract = "PADDING-4 GAP-3";
|
|
26
|
+
if (scroll === undefined) {
|
|
27
|
+
return createElement(as, { ...shared, className: "starci-core-pane-section", "data-contract": contract }, children);
|
|
28
|
+
}
|
|
29
|
+
return (_jsx(VerticalScrollRegion, { ...shared, "aria-label": scroll.label, className: "starci-core-pane-section", "data-grammar-pane-section-scroll": "true", isScrollable: true, ...(scroll.role === undefined ? {} : { role: scroll.role }), ...(scroll.tone === undefined ? {} : { tone: scroll.tone }), ...(scroll.scrollRef === undefined ? {} : { ref: scroll.scrollRef }), children: createElement(as, { className: "starci-core-pane-section-content", "data-contract": contract }, children) }));
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/composition/PaneSection/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,SAAS,EAA4B,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAsBrD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,EAAoB,EAAE,EAAE;IACjI,MAAM,IAAI,GAAG,cAAc,EAAE,CAAA;IAC7B,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,IAAI,IAAI,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IACpE,MAAM,MAAM,GAAG;QACX,gBAAgB,EAAE,aAAa;QAC/B,WAAW,EAAE,aAAa;QAC1B,iCAAiC,EAAE,KAAK;QACxC,+BAA+B,EAAE,GAAG;QACpC,iCAAiC,EAAE,KAAK;QACxC,gCAAgC,EAAE,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACtF,CAAA;IACD,MAAM,QAAQ,GAAG,iBAAiB,CAAA;IAClC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,0BAA0B,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAA;IACvH,CAAC;IACD,OAAO,CACH,KAAC,oBAAoB,OACb,MAAM,gBACE,MAAM,CAAC,KAAK,EACxB,SAAS,EAAC,0BAA0B,sCACH,MAAM,EACvC,YAAY,WACR,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,KACxD,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,KACxD,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,YAEpE,aAAa,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,kCAAkC,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,GACvF,CAC1B,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** What a Pane gives its descendants: `content` publishes the Grammar pane inset to its PaneSections, `flush` publishes none. */
|
|
2
|
+
export type PaneInset = "content" | "flush";
|
|
3
|
+
export type PaneContextValue = {
|
|
4
|
+
readonly area: string;
|
|
5
|
+
readonly inset: PaneInset;
|
|
6
|
+
/** A PaneSection or nested PaneGrid announces itself on mount; the returned function withdraws it. */
|
|
7
|
+
readonly register: () => () => void;
|
|
8
|
+
};
|
|
9
|
+
/** Internal to the composition tier: not exported from the public entries. */
|
|
10
|
+
export declare const PaneContext: import("react").Context<PaneContextValue | undefined>;
|
|
11
|
+
export declare const usePaneContext: () => PaneContextValue | undefined;
|
|
12
|
+
//# sourceMappingURL=paneContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paneContext.d.ts","sourceRoot":"","sources":["../../src/core/paneContext.tsx"],"names":[],"mappings":"AAIA,iIAAiI;AACjI,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE3C,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,sGAAsG;IACtG,QAAQ,CAAC,QAAQ,EAAE,MAAM,MAAM,IAAI,CAAA;CACtC,CAAA;AAED,8EAA8E;AAC9E,eAAO,MAAM,WAAW,uDAAyD,CAAA;AAEjF,eAAO,MAAM,cAAc,QAAO,gBAAgB,GAAG,SAAoC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
/** Internal to the composition tier: not exported from the public entries. */
|
|
4
|
+
export const PaneContext = createContext(undefined);
|
|
5
|
+
export const usePaneContext = () => useContext(PaneContext);
|
|
6
|
+
//# sourceMappingURL=paneContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paneContext.js","sourceRoot":"","sources":["../../src/core/paneContext.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAYjD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAA;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAiC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA"}
|
package/dist/core/styles.css
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
.grammar-common-root[data-grammar-family="core"]
|
|
150
150
|
.starci-core-surface-card[data-grammar-surface-labelled="true"][data-grammar-surface-placement="panel"][data-grammar-frame="bounded"]
|
|
151
151
|
> [data-grammar-surface-label] {
|
|
152
|
-
--starci-core-surface-label-padding: var(--
|
|
152
|
+
--starci-core-surface-label-padding: var(--grammar-card-padding-block, 1rem) var(--grammar-card-padding-inline, 1rem) 0;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
.grammar-common-root[data-grammar-family="core"]
|