@tenphi/renderer 0.27.0 → 0.30.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 +6 -4
- package/dist/client/preview-height.d.ts +16 -0
- package/dist/client/preview-height.d.ts.map +1 -0
- package/dist/client/preview-height.js +31 -0
- package/dist/client/preview-height.js.map +1 -0
- package/dist/components/Banner.styles.js +1 -1
- package/dist/components/Button.styles.js +1 -1
- package/dist/components/Card.astro +3 -4
- package/dist/components/Card.styles.js +16 -25
- package/dist/components/Document.styles.js +19 -40
- package/dist/components/Footer.styles.js +5 -5
- package/dist/components/Header.styles.js +2 -2
- package/dist/components/HeaderFrame.styles.js +1 -1
- package/dist/components/HeaderLinks.styles.js +25 -15
- package/dist/components/Hero.styles.js +8 -8
- package/dist/components/LanguageSelect.styles.js +5 -6
- package/dist/components/MainContent.styles.js +6 -8
- package/dist/components/MainPane.styles.js +2 -2
- package/dist/components/MarkdownAlert.styles.js +13 -13
- package/dist/components/MarkdownCodeBlock.styles.js +7 -10
- package/dist/components/MarkdownContent.styles.js +11 -17
- package/dist/components/MarkdownHeading.styles.js +4 -6
- package/dist/components/MarkdownInlineCode.styles.js +1 -1
- package/dist/components/MarkdownTable.styles.js +7 -10
- package/dist/components/Mermaid.styles.js +2 -2
- package/dist/components/MermaidSource.styles.js +1 -1
- package/dist/components/MobileMenuFooter.styles.js +5 -5
- package/dist/components/MobileMenuToggle.styles.js +2 -2
- package/dist/components/MobileNavigationTabs.styles.js +9 -10
- package/dist/components/MobileTableOfContents.styles.js +7 -7
- package/dist/components/PackageVersion.styles.js +1 -1
- package/dist/components/PageActions.styles.js +3 -3
- package/dist/components/PageFrame.styles.js +1 -1
- package/dist/components/Pagination.styles.js +13 -18
- package/dist/components/Preview.astro +7 -0
- package/dist/components/Preview.styles.js +10 -4
- package/dist/components/Search.styles.js +7 -8
- package/dist/components/SearchButton.styles.js +13 -5
- package/dist/components/SearchResults.styles.js +20 -20
- package/dist/components/Sidebar.styles.js +17 -19
- package/dist/components/SkipLink.styles.js +4 -3
- package/dist/components/SocialIcons.styles.js +1 -1
- package/dist/components/Steps.styles.js +3 -3
- package/dist/components/TableOfContents.styles.js +3 -3
- package/dist/components/TableOfContentsLayout.styles.js +2 -2
- package/dist/components/ThemeSelect.styles.js +16 -16
- package/dist/components/TopNavigation.styles.js +1 -3
- package/dist/components/VersionSwitcher.styles.js +4 -4
- package/dist/components/props.d.ts +2 -0
- package/dist/components/props.d.ts.map +1 -1
- package/dist/components/props.ts +2 -0
- package/dist/components/select-popover-styles.js +14 -14
- package/dist/define-component.d.ts.map +1 -1
- package/dist/define-component.js +20 -1
- package/dist/define-component.js.map +1 -0
- package/dist/eslint-plugin.d.ts +0 -5
- package/dist/eslint-plugin.d.ts.map +1 -1
- package/dist/eslint-plugin.js +0 -5
- package/dist/eslint-plugin.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/preview-document.d.ts +16 -3
- package/dist/preview-document.d.ts.map +1 -1
- package/dist/preview-document.js +31 -9
- package/dist/preview-document.js.map +1 -1
- package/dist/styling.js +2 -2
- package/dist/styling.js.map +1 -1
- package/package.json +4 -4
- package/dist/components/inherit-component-parts.d.ts +0 -1
- package/dist/components/inherit-component-parts.js +0 -7
- package/dist/define-component-BP4YwMak.js +0 -28
- package/dist/define-component-BP4YwMak.js.map +0 -1
package/dist/define-component.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as resolveComponentStyles } from "./component-styles-DstqPFf3.js";
|
|
2
|
+
import { tasty } from "@tenphi/tasty";
|
|
3
|
+
//#region src/define-component.ts
|
|
4
|
+
/** Extend a component's styles and defaults, preserving its props and compound parts. */
|
|
5
|
+
function extendComponent(name, base, options) {
|
|
6
|
+
return tasty(base, {
|
|
7
|
+
...options,
|
|
8
|
+
styles: resolveComponentStyles(name, options.styles ?? {})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** Create a named component with its built-in or custom theme styles merged into its defaults. */
|
|
12
|
+
function defineComponent(name, options) {
|
|
13
|
+
return tasty({
|
|
14
|
+
...options,
|
|
15
|
+
styles: resolveComponentStyles(name, options.styles ?? {})
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
2
19
|
export { defineComponent, extendComponent };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=define-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.js","names":[],"sources":["../src/define-component.ts"],"sourcesContent":["import {\n tasty,\n type ElementsDefinition,\n type ModPropsInput,\n type StylesInterface,\n type Styles,\n type SubElementProps,\n type TastyElementOptions,\n type TastyPolymorphicComponent,\n type TokenPropsInput,\n type VariantMap,\n} from \"@tenphi/tasty\";\nimport type {\n ComponentProps,\n ComponentType,\n ElementType,\n ForwardRefExoticComponent,\n JSX,\n PropsWithoutRef,\n RefAttributes,\n} from \"react\";\nimport { resolveComponentStyles } from \"./components/component-styles.js\";\n\ntype InheritedParts<C> = {\n [\n Name in keyof C as Name extends string\n ? Name extends Capitalize<Name>\n ? C[Name] extends ComponentType<any>\n ? Name\n : never\n : never\n : never\n ]: C[Name];\n};\n\ntype SubElementTag<Definition extends ElementsDefinition[string]> =\n Definition extends string\n ? Definition\n : Definition extends { as?: infer Tag }\n ? Tag extends keyof JSX.IntrinsicElements\n ? Tag\n : \"div\"\n : \"div\";\n\n// Use public Tasty types so declarations do not leak its private sub-element aliases.\ntype SubElements<E extends ElementsDefinition> = {\n [Name in keyof E]: ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<SubElementTag<E[Name]>>> &\n RefAttributes<\n SubElementTag<E[Name]> extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[SubElementTag<E[Name]>]\n : unknown\n >\n >;\n};\n\n/** Extend a component's styles and defaults, preserving its props and compound parts. */\nexport function extendComponent<C extends ComponentType<any>>(\n name: string,\n base: C,\n options: Partial<Omit<ComponentProps<C>, \"as\" | \"styles\">> & {\n styles?: Styles;\n },\n): ComponentType<ComponentProps<C>> & InheritedParts<C> {\n // Tasty copies the base's compound parts but types every base prop as\n // optional. Conservatively keep the base's required props.\n return tasty(base, {\n ...options,\n styles: resolveComponentStyles(name, options.styles ?? {}),\n }) as unknown as ComponentType<ComponentProps<C>> & InheritedParts<C>;\n}\n\n/** Create a named component with its built-in or custom theme styles merged into its defaults. */\nexport function defineComponent<\n K extends readonly (keyof StylesInterface)[],\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = \"div\",\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n name: string,\n options: TastyElementOptions<K, V, E, AsType, M, TP>,\n): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElements<E> {\n return tasty<K, V, E, AsType, M, TP>({\n ...options,\n styles: resolveComponentStyles(name, options.styles ?? {}),\n }) as TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElements<E>;\n}\n"],"mappings":";;;;AAyDA,SAAgB,gBACd,MACA,MACA,SAGsD;CAGtD,OAAO,MAAM,MAAM;EACjB,GAAG;EACH,QAAQ,uBAAuB,MAAM,QAAQ,UAAU,CAAC,CAAC;CAC3D,CAAC;AACH;;AAGA,SAAgB,gBAQd,MACA,SACiE;CACjE,OAAO,MAA8B;EACnC,GAAG;EACH,QAAQ,uBAAuB,MAAM,QAAQ,UAAU,CAAC,CAAC;CAC3D,CAAC;AACH"}
|
package/dist/eslint-plugin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-plugin.d.ts","names":[],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eslint-plugin.d.ts","names":[],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCagB,uBACd,QAAO,cACN"}
|
package/dist/eslint-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-plugin.js","names":["validationConfig"],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"sourcesContent":["import type { TastyValidationConfig } from \"@tenphi/eslint-plugin-tasty\";\n\nexport default {\n importSources: [\n \"@tenphi/cookbook/styling\",\n \"@tenphi/renderer/styling\",\n \"./component-styles.js\",\n \"../define-component.js\",\n ],\n styleFunctions: {\n defineComponent: { argument: 1, kind: \"options\" },\n extendComponent: { argument: 2, kind: \"options\", partial: true },\n resolveComponentStyles: { argument: 1, kind: \"styles\" },\n
|
|
1
|
+
{"version":3,"file":"eslint-plugin.js","names":["validationConfig"],"sources":["../src/tasty.config.ts","../src/eslint-plugin.ts"],"sourcesContent":["import type { TastyValidationConfig } from \"@tenphi/eslint-plugin-tasty\";\n\nexport default {\n importSources: [\n \"@tenphi/cookbook/styling\",\n \"@tenphi/renderer/styling\",\n \"./component-styles.js\",\n \"../define-component.js\",\n ],\n styleFunctions: {\n defineComponent: { argument: 1, kind: \"options\" },\n extendComponent: { argument: 2, kind: \"options\", partial: true },\n resolveComponentStyles: { argument: 1, kind: \"styles\" },\n },\n tokens: [\n \"$gap\",\n \"$margin-block-start\",\n \"$margin-block-end\",\n \"$padding-block-start\",\n \"$padding-block-end\",\n \"$radius\",\n \"$header-control-radius\",\n \"$card-radius\",\n \"$border-width\",\n \"$outline-width\",\n \"$outline-offset\",\n \"$layout-width\",\n \"$content-width\",\n \"$sidebar-width\",\n \"$control-height\",\n \"$transition\",\n \"$sharp-radius\",\n \"$bold-font-weight\",\n \"#white\",\n \"#black\",\n \"#clear\",\n \"#current\",\n \"#surface\",\n \"#header\",\n \"#heading\",\n \"#surface-2\",\n \"#surface-3\",\n \"#surface-2-hover\",\n \"#surface-2-pressed\",\n \"#surface-3-hover\",\n \"#surface-3-pressed\",\n \"#text\",\n \"#text-soft\",\n \"#text-muted\",\n \"#sidebar-text\",\n \"#border\",\n \"#border-strong\",\n \"#accent-text\",\n \"#accent-surface\",\n \"#accent-surface-text\",\n \"#logo-surface\",\n \"#logo-mark\",\n \"#accent-surface-subtle\",\n \"#accent-surface-2-subtle\",\n \"#focus\",\n \"#shadow\",\n \"#overlay\",\n \"#syntax-bg\",\n \"#syntax-text\",\n \"#syntax-comment\",\n \"#syntax-punctuation\",\n \"#syntax-keyword\",\n \"#syntax-string\",\n \"#syntax-token\",\n \"#syntax-property\",\n \"#syntax-number\",\n \"#syntax-function\",\n \"#syntax-value\",\n \"#syntax-operator\",\n \"#info\",\n \"#info-surface\",\n \"#info-text\",\n \"#success\",\n \"#success-surface\",\n \"#success-text\",\n \"#warning\",\n \"#warning-surface\",\n \"#warning-text\",\n \"#danger\",\n \"#danger-surface\",\n \"#danger-text\",\n \"#orange-surface\",\n \"#orange\",\n \"#orange-text\",\n \"#green-surface\",\n \"#green\",\n \"#green-text\",\n \"#blue-surface\",\n \"#blue\",\n \"#blue-text\",\n \"#purple-surface\",\n \"#purple\",\n \"#purple-text\",\n \"#red-surface\",\n \"#red\",\n \"#red-text\",\n ],\n units: [\"x\", \"r\", \"cr\", \"bw\"],\n states: [\n \"@system-light\",\n \"@system-dark\",\n \"@light\",\n \"@dark\",\n \"@sm\",\n \"@md\",\n \"@lg\",\n \"@reduced-motion\",\n \"@prose\",\n \"@prose-block\",\n \"@prose-heading\",\n ],\n presets: [\n \"body\",\n \"heading\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"navigation\",\n \"small\",\n \"code\",\n \"hero-title\",\n \"hero-tagline\",\n \"prose\",\n \"inline-code\",\n ],\n} satisfies TastyValidationConfig;\n","export { default, recommended, strict } from \"@tenphi/eslint-plugin-tasty\";\nexport type {\n ResolvedConfig,\n StyleFunctionConfig,\n TastyValidationConfig,\n} from \"@tenphi/eslint-plugin-tasty\";\nexport { default as validationConfig } from \"./tasty.config.js\";\n\nimport type { ThemeConfig } from \"@tenphi/docs\";\nimport type { TastyValidationConfig } from \"@tenphi/eslint-plugin-tasty\";\nimport validationConfig from \"./tasty.config.js\";\n\n/** Keep editor/linter names aligned with a Cookbook theme. */\nexport function createValidationConfig(\n theme: ThemeConfig = {},\n): TastyValidationConfig {\n return {\n ...validationConfig,\n tokens: [\n ...validationConfig.tokens,\n ...Object.keys(theme.tokens ?? {}),\n ...Object.keys(theme.palette ?? {}).map((name) => `#${name}`),\n ],\n units: [...validationConfig.units, ...Object.keys(theme.units ?? {})],\n states: [...validationConfig.states, ...Object.keys(theme.states ?? {})],\n presets: [...validationConfig.presets, ...Object.keys(theme.presets ?? {})],\n recipes: Object.keys(theme.recipes ?? {}),\n };\n}\n"],"mappings":";;AAEA,IAAA,uBAAe;CACb,eAAe;EACb;EACA;EACA;EACA;CACF;CACA,gBAAgB;EACd,iBAAiB;GAAE,UAAU;GAAG,MAAM;EAAU;EAChD,iBAAiB;GAAE,UAAU;GAAG,MAAM;GAAW,SAAS;EAAK;EAC/D,wBAAwB;GAAE,UAAU;GAAG,MAAM;EAAS;CACxD;CACA,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,OAAO;EAAC;EAAK;EAAK;EAAM;CAAI;CAC5B,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;;;;ACxHA,SAAgB,uBACd,QAAqB,CAAC,GACC;CACvB,OAAO;EACL,GAAGA;EACH,QAAQ;GACN,GAAGA,qBAAiB;GACpB,GAAG,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC;GACjC,GAAG,OAAO,KAAK,MAAM,WAAW,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM;EAC9D;EACA,OAAO,CAAC,GAAGA,qBAAiB,OAAO,GAAG,OAAO,KAAK,MAAM,SAAS,CAAC,CAAC,CAAC;EACpE,QAAQ,CAAC,GAAGA,qBAAiB,QAAQ,GAAG,OAAO,KAAK,MAAM,UAAU,CAAC,CAAC,CAAC;EACvE,SAAS,CAAC,GAAGA,qBAAiB,SAAS,GAAG,OAAO,KAAK,MAAM,WAAW,CAAC,CAAC,CAAC;EAC1E,SAAS,OAAO,KAAK,MAAM,WAAW,CAAC,CAAC;CAC1C;AACF"}
|