@lostgradient/cinder 0.26.3 → 0.27.1

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.
@@ -0,0 +1,4 @@
1
+ var schema={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{title:{type:"string",description:"Page-level heading text rendered inside the `headingLevel` heading; the runtime API also accepts a template-only snippet."},headingLevel:{enum:[1,2,3,4,5,6],description:"Heading level for the title element. Defaults to `1`.",default:1},description:{type:"string",description:"Optional supporting text rendered below the title; the runtime API also accepts a template-only snippet."},class:{type:"string",description:"Additional class names merged with `.cinder-page-header`."}},additionalProperties:false,required:["title"],metadata:{unsupportedProps:[{name:"actions",reason:"function-or-snippet",description:"Optional trailing actions (buttons, menus, controls)."},{name:"breadcrumbs",reason:"function-or-snippet",description:"Optional breadcrumb navigation rendered above the heading row."}]}};var page_header_schema_default=schema;
2
+ export{page_header_schema_default};
3
+
4
+ //# debugId=67C2E4A3D829E72664756E2164756E21
@@ -0,0 +1,3 @@
1
+ import{classNames}from"./index.server-tg0sj9mr.js";import*as $ from"svelte/internal/server";function Page_header($$renderer,$$props){$$renderer.component(($$renderer)=>{let{title,headingLevel=1,description,breadcrumbs,actions,class:className,$$slots,$$events,...rest}=$$props;const resolvedHeadingLevel=$.derived(()=>Number.isFinite(Math.trunc(Number(headingLevel)))?Math.min(6,Math.max(1,Math.trunc(Number(headingLevel)))):1);const titleTag=$.derived(()=>`h${resolvedHeadingLevel()}`);$$renderer.push(`<div${$.attributes({class:$.clsx(classNames("cinder-page-header",className)),...rest})}>`);if(breadcrumbs){$$renderer.push(`<!--[0--><div class="cinder-page-header__breadcrumbs">`);breadcrumbs($$renderer);$$renderer.push(`<!----></div>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--> <div class="cinder-page-header__row"><div class="cinder-page-header__heading-group">`);$.element($$renderer,titleTag(),()=>{$$renderer.push(` class="cinder-page-header__title"`)},()=>{if(typeof title==="string"){$$renderer.push(`<!--[0-->${$.escape(title)}`)}else{$$renderer.push("<!--[-1-->");title($$renderer);$$renderer.push(`<!---->`)}$$renderer.push(`<!--]-->`)});$$renderer.push(` `);if(description){$$renderer.push(`<!--[0--><p class="cinder-page-header__description">`);if(typeof description==="string"){$$renderer.push(`<!--[0-->${$.escape(description)}`)}else{$$renderer.push("<!--[-1-->");description($$renderer);$$renderer.push(`<!---->`)}$$renderer.push(`<!--]--></p>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--></div> `);if(actions){$$renderer.push(`<!--[0--><div class="cinder-page-header__actions">`);actions($$renderer);$$renderer.push(`<!----></div>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--></div></div>`)},Page_header)}var page_header_default=Page_header;export{Page_header,page_header_default};
2
+
3
+ //# debugId=8F7FB78C370ABB8564756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lostgradient/cinder",
3
- "version": "0.26.3",
3
+ "version": "0.27.1",
4
4
  "description": "A Svelte 5 component library and design system focused on accessibility, theming, and per-component tree-shaking.",
5
5
  "keywords": [
6
6
  "svelte",
@@ -6451,7 +6451,7 @@
6451
6451
  "types": "./dist/index.d.ts",
6452
6452
  "dependencies": {
6453
6453
  "@floating-ui/dom": "1.7.6",
6454
- "@lostgradient/markdown": "^0.6.0",
6454
+ "@lostgradient/markdown": "^0.6.1",
6455
6455
  "@shikijs/engine-oniguruma": "^3.21.0",
6456
6456
  "@shikijs/langs": "^3.21.0",
6457
6457
  "@shikijs/themes": "^3.21.0",
@@ -6584,5 +6584,5 @@
6584
6584
  "bin": {
6585
6585
  "cinder": "./dist/cli/index.js"
6586
6586
  },
6587
- "gitHead": "877956403acbf290a1e3e722f6262bf09e4b8090"
6587
+ "gitHead": "ed6aeb432f5fbc91bd0aa7d3af61dcb22b1f5eaf"
6588
6588
  }
@@ -2,5 +2,5 @@ import './page-header.css';
2
2
  import PageHeader from './page-header.svelte';
3
3
 
4
4
  export default PageHeader;
5
- export type { PageHeaderProps } from './page-header.types.ts';
5
+ export type { PageHeaderHeadingLevel, PageHeaderProps } from './page-header.types.ts';
6
6
  export { PageHeader };
@@ -7,7 +7,7 @@
7
7
  "id": "basic",
8
8
  "title": "Basic page header",
9
9
  "description": "Page-level heading with named title, description, breadcrumb, and action regions.",
10
- "code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder';\n import { Breadcrumbs } from '@lostgradient/cinder';\n import { PageHeader } from '@lostgradient/cinder';\n</script>\n\n<div>\n <PageHeader title=\"Approvals\" description=\"3 pending · 12 resolved\" />\n</div>\n\n<div style=\"margin-top: var(--cinder-space-4);\">\n <PageHeader>\n {#snippet breadcrumbs()}\n <Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Schedules' }]} />\n {/snippet}\n {#snippet title()}Schedules{/snippet}\n {#snippet description()}Create and manage recurring automation schedules.{/snippet}\n {#snippet actions()}\n <Button variant=\"primary\" size=\"sm\" label=\"+ New schedule\" />\n {/snippet}\n </PageHeader>\n</div>\n"
10
+ "code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder';\n import { Breadcrumbs } from '@lostgradient/cinder';\n import { PageHeader } from '@lostgradient/cinder';\n</script>\n\n<div>\n <PageHeader headingLevel={2} title=\"Approvals\" description=\"3 pending · 12 resolved\" />\n</div>\n\n<div style=\"margin-top: var(--cinder-space-4);\">\n <PageHeader headingLevel={2}>\n {#snippet breadcrumbs()}\n <Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Schedules' }]} />\n {/snippet}\n {#snippet title()}Schedules{/snippet}\n {#snippet description()}Create and manage recurring automation schedules.{/snippet}\n {#snippet actions()}\n <Button variant=\"primary\" size=\"sm\" label=\"+ New schedule\" />\n {/snippet}\n </PageHeader>\n</div>\n"
11
11
  }
12
12
  ]
13
13
  }
@@ -4,7 +4,12 @@
4
4
  "properties": {
5
5
  "title": {
6
6
  "type": "string",
7
- "description": "Page-level heading text rendered inside `<h1>`; the runtime API also accepts a template-only snippet."
7
+ "description": "Page-level heading text rendered inside the `headingLevel` heading; the runtime API also accepts a template-only snippet."
8
+ },
9
+ "headingLevel": {
10
+ "enum": [1, 2, 3, 4, 5, 6],
11
+ "description": "Heading level for the title element. Defaults to `1`.",
12
+ "default": 1
8
13
  },
9
14
  "description": {
10
15
  "type": "string",
@@ -7,7 +7,12 @@ const schema = {
7
7
  title: {
8
8
  type: 'string',
9
9
  description:
10
- 'Page-level heading text rendered inside `<h1>`; the runtime API also accepts a template-only snippet.',
10
+ 'Page-level heading text rendered inside the `headingLevel` heading; the runtime API also accepts a template-only snippet.',
11
+ },
12
+ headingLevel: {
13
+ enum: [1, 2, 3, 4, 5, 6],
14
+ description: 'Heading level for the title element. Defaults to `1`.',
15
+ default: 1,
11
16
  },
12
17
  description: {
13
18
  type: 'string',
@@ -4,7 +4,13 @@ export {};
4
4
 
5
5
  <script lang="ts">
6
6
  import { classNames } from '../../utilities/class-names.ts';
7
- let { title, description, breadcrumbs, actions, class: className, ...rest } = $props();
7
+ let { title, headingLevel = 1, description, breadcrumbs, actions, class: className, ...rest } = $props();
8
+ // Clamp to 1–6 so an out-of-range value from an untyped caller (JS, schema-driven usage)
9
+ // never builds <h0>/<hNaN>. Matches Card's heading clamp.
10
+ const resolvedHeadingLevel = $derived(Number.isFinite(Math.trunc(Number(headingLevel)))
11
+ ? Math.min(6, Math.max(1, Math.trunc(Number(headingLevel))))
12
+ : 1);
13
+ const titleTag = $derived(`h${resolvedHeadingLevel}`);
8
14
  </script>
9
15
 
10
16
  <div class={classNames('cinder-page-header', className)} {...rest}>
@@ -16,13 +22,13 @@ let { title, description, breadcrumbs, actions, class: className, ...rest } = $p
16
22
 
17
23
  <div class="cinder-page-header__row">
18
24
  <div class="cinder-page-header__heading-group">
19
- <h1 class="cinder-page-header__title">
25
+ <svelte:element this={titleTag} class="cinder-page-header__title">
20
26
  {#if typeof title === 'string'}
21
27
  {title}
22
28
  {:else}
23
29
  {@render title()}
24
30
  {/if}
25
- </h1>
31
+ </svelte:element>
26
32
  {#if description}
27
33
  <p class="cinder-page-header__description">
28
34
  {#if typeof description === 'string'}
@@ -1,13 +1,18 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLAttributes } from 'svelte/elements';
3
3
 
4
+ /** Heading level for the page title, so the document outline stays correct inside a host page. */
5
+ export type PageHeaderHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
6
+
4
7
  /** Props for the PageHeader component. */
5
8
  export type PageHeaderProps = Omit<
6
9
  HTMLAttributes<HTMLDivElement>,
7
10
  'class' | 'children' | 'title'
8
11
  > & {
9
- /** Page-level heading content. Rendered inside `<h1>`; snippets must emit phrasing content. */
12
+ /** Page-level heading content. Rendered inside the `headingLevel` heading; snippets must emit phrasing content. */
10
13
  title: string | Snippet;
14
+ /** Heading level for the title element. Defaults to `1`. */
15
+ headingLevel?: PageHeaderHeadingLevel;
11
16
  /** Optional supporting content rendered below the title; snippets must emit phrasing content. */
12
17
  description?: string | Snippet;
13
18
  /** Optional breadcrumb navigation rendered above the heading row. */
@@ -23,8 +28,13 @@ export type PageHeaderProps = Omit<
23
28
  * snippets, while schema-driven consumers use their string variants.
24
29
  */
25
30
  export interface PageHeaderSchemaProps {
26
- /** Page-level heading text rendered inside `<h1>`; the runtime API also accepts a template-only snippet. */
31
+ /** Page-level heading text rendered inside the `headingLevel` heading; the runtime API also accepts a template-only snippet. */
27
32
  title: string;
33
+ /**
34
+ * Heading level for the title element. Defaults to `1`.
35
+ * @default 1
36
+ */
37
+ headingLevel?: PageHeaderHeadingLevel;
28
38
  /** Optional supporting text rendered below the title; the runtime API also accepts a template-only snippet. */
29
39
  description?: string;
30
40
  /** Additional class names merged with `.cinder-page-header`. */
package/src/index.ts CHANGED
@@ -617,7 +617,7 @@ export { default as Pagination } from './components/pagination/index.ts';
617
617
  export type { PaginationProps } from './components/pagination/index.ts';
618
618
 
619
619
  export { default as PageHeader } from './components/page-header/index.ts';
620
- export type { PageHeaderProps } from './components/page-header/index.ts';
620
+ export type { PageHeaderHeadingLevel, PageHeaderProps } from './components/page-header/index.ts';
621
621
 
622
622
  export { default as PayloadInspector } from './components/payload-inspector/index.ts';
623
623
  export type { PayloadInspectorProps } from './components/payload-inspector/index.ts';
@@ -1,4 +0,0 @@
1
- var schema={$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{title:{type:"string",description:"Page-level heading text rendered inside `<h1>`; the runtime API also accepts a template-only snippet."},description:{type:"string",description:"Optional supporting text rendered below the title; the runtime API also accepts a template-only snippet."},class:{type:"string",description:"Additional class names merged with `.cinder-page-header`."}},additionalProperties:false,required:["title"],metadata:{unsupportedProps:[{name:"actions",reason:"function-or-snippet",description:"Optional trailing actions (buttons, menus, controls)."},{name:"breadcrumbs",reason:"function-or-snippet",description:"Optional breadcrumb navigation rendered above the heading row."}]}};var page_header_schema_default=schema;
2
- export{page_header_schema_default};
3
-
4
- //# debugId=6ED04A4C510C0C6C64756E2164756E21
@@ -1,3 +0,0 @@
1
- import{classNames}from"./index.server-tg0sj9mr.js";import*as $ from"svelte/internal/server";function Page_header($$renderer,$$props){$$renderer.component(($$renderer)=>{let{title,description,breadcrumbs,actions,class:className,$$slots,$$events,...rest}=$$props;$$renderer.push(`<div${$.attributes({class:$.clsx(classNames("cinder-page-header",className)),...rest})}>`);if(breadcrumbs){$$renderer.push(`<!--[0--><div class="cinder-page-header__breadcrumbs">`);breadcrumbs($$renderer);$$renderer.push(`<!----></div>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--> <div class="cinder-page-header__row"><div class="cinder-page-header__heading-group"><h1 class="cinder-page-header__title">`);if(typeof title==="string"){$$renderer.push(`<!--[0-->${$.escape(title)}`)}else{$$renderer.push("<!--[-1-->");title($$renderer);$$renderer.push(`<!---->`)}$$renderer.push(`<!--]--></h1> `);if(description){$$renderer.push(`<!--[0--><p class="cinder-page-header__description">`);if(typeof description==="string"){$$renderer.push(`<!--[0-->${$.escape(description)}`)}else{$$renderer.push("<!--[-1-->");description($$renderer);$$renderer.push(`<!---->`)}$$renderer.push(`<!--]--></p>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--></div> `);if(actions){$$renderer.push(`<!--[0--><div class="cinder-page-header__actions">`);actions($$renderer);$$renderer.push(`<!----></div>`)}else{$$renderer.push("<!--[-1-->")}$$renderer.push(`<!--]--></div></div>`)},Page_header)}var page_header_default=Page_header;export{Page_header,page_header_default};
2
-
3
- //# debugId=31DBED43BA5CC38C64756E2164756E21