diff --git a/inlang/source-code/doc-layout-component/.storybook/main.js b/inlang/source-code/doc-layout-component/.storybook/main.js new file mode 100644 index 0000000000..fda30850f8 --- /dev/null +++ b/inlang/source-code/doc-layout-component/.storybook/main.js @@ -0,0 +1,13 @@ +/** @type { import('@storybook/web-components-vite').StorybookConfig } */ +const config = { + stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + addons: ["@storybook/addon-links", "@storybook/addon-essentials"], + framework: { + name: "@storybook/web-components-vite", + options: {}, + }, + docs: { + autodocs: "tag", + }, +} +export default config diff --git a/inlang/source-code/doc-layout-component/.storybook/preview.js b/inlang/source-code/doc-layout-component/.storybook/preview.js new file mode 100644 index 0000000000..09ca6a367c --- /dev/null +++ b/inlang/source-code/doc-layout-component/.storybook/preview.js @@ -0,0 +1,17 @@ +/** @type { import('@storybook/web-components').Preview } */ + +import "./../src/styling/preview.css" + +const preview = { + parameters: { + actions: { argTypesRegex: "^on[A-Z].*" }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + }, +} + +export default preview diff --git a/inlang/source-code/doc-layout-component/CHANGELOG.md b/inlang/source-code/doc-layout-component/CHANGELOG.md new file mode 100644 index 0000000000..40050fea83 --- /dev/null +++ b/inlang/source-code/doc-layout-component/CHANGELOG.md @@ -0,0 +1,102 @@ +# @inlang/settings-component + +## 1.0.6 + +### Patch Changes + +- Updated dependencies [3c959bc] + - @inlang/sdk@0.34.2 + +## 1.0.5 + +### Patch Changes + +- @inlang/sdk@0.34.1 + +## 1.0.4 + +### Patch Changes + +- Updated dependencies [5b8c053] + - @inlang/sdk@0.34.0 + +## 1.0.3 + +### Patch Changes + +- c92bde5: Added description to project settings type & allow experimental field in settings component +- 2508271: Style fix float +- 0b4af82: Fixed mobile styling for objects + - @inlang/sdk@0.33.1 + +## 1.0.2 + +### Patch Changes + +- Updated dependencies [d573ab8] + - @inlang/sdk@0.33.0 + +## 1.0.1 + +### Patch Changes + +- ddea787: Don't display the lint rule levels when there are no lint rules installed + +## 1.0.0 + +### Major Changes + +- 552037b: First fully releasable version of the settings componeny + +## 0.0.16 + +### Patch Changes + +- Updated dependencies [bc9875d] + - @inlang/sdk@0.32.0 + +## 0.0.15 + +### Patch Changes + +- Updated dependencies [c068dd2] + - @inlang/sdk@0.31.0 + +## 0.0.14 + +### Patch Changes + +- Updated dependencies [9b26a31] + - @inlang/sdk@0.30.0 + +## 0.0.13 + +### Patch Changes + +- Updated dependencies [62dfa26] + - @inlang/sdk@0.29.0 + +## 0.0.12 + +### Patch Changes + +- @inlang/sdk@0.28.3 + +## 0.0.11 + +### Patch Changes + +- @inlang/sdk@0.28.2 + +## 0.0.10 + +### Patch Changes + +- @inlang/sdk@0.28.1 + +## 0.0.2 + +### Patch Changes + +- Updated dependencies [4837297] + - @inlang/sdk@0.27.0 diff --git a/inlang/source-code/doc-layout-component/README.md b/inlang/source-code/doc-layout-component/README.md new file mode 100644 index 0000000000..47ea5e121c --- /dev/null +++ b/inlang/source-code/doc-layout-component/README.md @@ -0,0 +1,9 @@ +# doc-layout-conponent + +This package provides the doc-layout component for documentation pages as a shared web-components mainly used by inlang.com. + +### Docs +To open the docs please execute this on the root of the project. +```bash +pnpm --filter @inlang/doc-layout-component run storybook +``` diff --git a/inlang/source-code/doc-layout-component/package.json b/inlang/source-code/doc-layout-component/package.json new file mode 100644 index 0000000000..3bd3675e86 --- /dev/null +++ b/inlang/source-code/doc-layout-component/package.json @@ -0,0 +1,48 @@ +{ + "name": "@inlang/doc-layout-component", + "type": "module", + "version": "0.0.1", + "publishConfig": { + "access": "public" + }, + "description": "", + "exports": { + ".": { + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + } + }, + "scripts": { + "build": "pnpm run format && esbuild src/index.ts --bundle --external:node:crypto --format=esm --platform=browser --outfile=dist/index.mjs && tsc --emitDeclarationOnly --declaration --outDir dist", + "test": "tsc --noEmit && vitest run --passWithNoTests --coverage", + "format": "prettier --write **/*.ts", + "storybook": "storybook dev -p 6006" + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@inlang/marketplace-registry": "workspace:^", + "@nx/storybook": "^18.0.4", + "@storybook/addon-essentials": "^7.6.16", + "@storybook/addon-links": "^7.6.16", + "@storybook/blocks": "^7.6.16", + "@storybook/web-components": "^7.6.16", + "@storybook/web-components-vite": "^7.6.16", + "@types/chroma-js": "^2.4.4", + "esbuild": "^0.20.0", + "lit": "^3.1.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "storybook": "^7.6.16", + "vitest": "0.33.0", + "@vitest/coverage-v8": "^0.33.0" + }, + "dependencies": { + "@inlang/sdk": "workspace:^", + "@lit/task": "^1.0.0", + "@shoelace-style/shoelace": "2.14.0", + "chroma-js": "^2.4.2", + "@sinclair/typebox": "0.31.28" + } +} diff --git a/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.test.ts b/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.test.ts new file mode 100644 index 0000000000..c1f300ade7 --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.test.ts @@ -0,0 +1,38 @@ +import { describe, expect, it } from "vitest" +import { getColor, getPalette } from "./overridePrimitiveColors.js" +import chroma from "chroma-js" + +describe("getColors", () => { + //color of violet + const refColor = chroma("#EE82EE") + + it("should pickup css colors", () => { + const color = getColor("violet") + expect(color).toStrictEqual(refColor) + }) + it("should pickup hex colors", () => { + const color = getColor("#EE82EE") + expect(color).toStrictEqual(refColor) + }) + it("should pickup rgb colors", () => { + const color = getColor("rgb(238, 130, 238)") + expect(color).toStrictEqual(refColor) + }) + it("should pickup rgba colors", () => { + const color = getColor("rgba(238, 130, 238, 1)") + expect(color).toStrictEqual(refColor) + }) +}) + +describe("getPalette", () => { + //reference color (green) with good white on green contrast ratio + const refColor = "#16a34a" + + it("should create a palette with 50, 100-900 and 950 shades", () => { + const palette = getPalette(refColor) + expect(Object.keys(palette).length).toBe(11) + expect(palette[50]).toBe("#f4f9f5") + expect(palette[600]).toBe(refColor) + expect(palette[950]).toBe("#083a1a") + }) +}) diff --git a/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.ts b/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.ts new file mode 100644 index 0000000000..397e3eb6cf --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/helper/overridePrimitiveColors.ts @@ -0,0 +1,59 @@ +import chroma from "chroma-js" + +const overridePrimitiveColors = () => { + const inlangDocLayout = document.querySelector("inlang-doc-layout") + if (!inlangDocLayout) return undefined + + const primitives = ["primary", "success", "warning", "danger", "neutral"] + + for (const primitive of primitives) { + const unformattedColor = window + .getComputedStyle(inlangDocLayout) + .getPropertyValue(`--inlang-color-${primitive}`) + .trim() + + if (unformattedColor !== "") { + const colorShades = getPalette(unformattedColor) + appendCSSProperties(colorShades, primitive, inlangDocLayout) + } + } +} + +const appendCSSProperties = ( + colorShades: Record, + primitive: string, + element: HTMLElement +) => { + let textContent = Object.entries(colorShades) + .map(([index, shade]) => `--sl-color-${primitive}-${index}: ${shade} !important;`) + .join("\n") + + textContent = ":host { " + textContent + " }" + + const shadowRoot = element.shadowRoot || element.attachShadow({ mode: "open" }) + + const style = document.createElement("style") + style.textContent = textContent + shadowRoot.appendChild(style) +} + +export const getColor = (unformattedColor: string) => chroma(unformattedColor) + +export const getPalette = (unformattedColor: string) => { + const color = getColor(unformattedColor) + const colors = chroma.scale(["white", color, "black"]).domain([0, 0.6, 1]).mode("lrgb") + const palette: Record = {} + + // Create 50 + palette[50] = colors(0.05).hex() + + // Create 100-900 + for (let i = 0.1; i < 0.9; i += 0.1) { + palette[Math.round(i * 1000)] = colors(i).hex() + } + // Create 950 + palette[950] = colors(0.95).hex() + return palette +} + +export default overridePrimitiveColors diff --git a/inlang/source-code/doc-layout-component/src/index.ts b/inlang/source-code/doc-layout-component/src/index.ts new file mode 100644 index 0000000000..82f34cd60e --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/index.ts @@ -0,0 +1 @@ +export { default as InlangDocLayout } from "./stories/inlang-doc-layout.js" diff --git a/inlang/source-code/doc-layout-component/src/inlang-doc-layout.mdx b/inlang/source-code/doc-layout-component/src/inlang-doc-layout.mdx new file mode 100644 index 0000000000..60fed9adc0 --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/inlang-doc-layout.mdx @@ -0,0 +1,81 @@ +import { Meta, Primary, Controls, Story, Canvas, ArgTypes, Source } from '@storybook/blocks'; +import * as InlangDocLayout from './stories/inlang-doc-layout.stories'; + + + +# Settings Component + +The settings component is a simple form that allows app builders add settings quickly. The component can be used as `inlang-settings`. + +## Table of Contents +- [Example](#example-settings) +- [Props and Attributes](#props-and-attributes) +- [Events](#events) +- [Usage](#usage) +- [CSS Custom properties](#css-custom-properties) +- [Part API](#part-api) + +## Example Settings + + + + + +## Props and Attributes + + + +Depending on your framework you can use pass the needed information as a prop or as an [attribute](https://lit.dev/docs/components/properties/#attributes). + +## Events + +The settings component emits the following events: + +- `set-settings`: Emitted when the settings are changed. The event detail contains the new settings. + +## Usage + +- Solidjs - Prop: `prop:settings={obj}` - Event: `on:set-settings` +- Lit - Attribute: `settings=${JSON.stringify(obj)}` - Event: `@set-settings` +- Lit - Props: `.settings=${obj}` - Event: `@set-settings` +- Html - Attribute: `settings=${JSON.stringify(obj)}` - Event: EventListener -> `set-settings` + +## CSS Custom properties + +The settings component uses the following css properties: + +### Primitives + +From each property the component derives different shades and maps it on the shoelace components. + +- `--inlang-color-primary` +- `--inlang-color-success` +- `--inlang-color-warning` +- `--inlang-color-danger` +- `--inlang-color-neutral` + +### Inputs + +Most styles are derrived from input css properties. + +Examples: +- `--sl-input-color` +- `--sl-input-background-color` +- `--sl-input-border-color` + +You can find all css properties listed [here](https://shoelace.style/tokens/more). + +## Part API + +The settings component is built with the following parts: + +- `base`: Root of component +- `module-container`: List of modules +- `module-title`: The title of a module +- `property`: Root of property +- `property-title`: The title of a property +- `property-paragraph`: All p elements in a property +- `option-wrapper`: Wrapper for options +- `option`: All options in a dropdown +- `float`: The floating bar when a change exists +- `button`: The root of all neutral buttons diff --git a/inlang/source-code/doc-layout-component/src/mock/project.ts b/inlang/source-code/doc-layout-component/src/mock/project.ts new file mode 100644 index 0000000000..a9f82ee3ca --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/mock/project.ts @@ -0,0 +1,359 @@ +import type { InlangProject } from "@inlang/sdk" + +export const mockSettings: ReturnType = { + $schema: "https://inlang.com/schema/project-settings", + sourceLanguageTag: "en", + languageTags: ["en", "es", "fr", "pt-br", "ru", "zh-cn"], + messageLintRuleLevels: { + "messageLintRule.inlang.identicalPattern": "error", + }, + modules: [ + "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js", + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js", + ], + "plugin.inlang.i18next": { + pathPattern: { + brain: "./frontend/public/locales/{languageTag}/brain.json", + chat: "./frontend/public/locales/{languageTag}/chat.json", + config: "./frontend/public/locales/{languageTag}/config.json", + contact: "./frontend/public/locales/{languageTag}/contact.json", + deleteOrUnsubscribeFormBrain: + "./frontend/public/locales/{languageTag}/deleteOrUnsubscribeFormBrain.json", + explore: "./frontend/public/locales/{languageTag}/explore.json", + external_api_definition: + "./frontend/public/locales/{languageTag}/external_api_definition.json", + home: "./frontend/public/locales/{languageTag}/home.json", + invitation: "./frontend/public/locales/{languageTag}/invitation.json", + knowledge: "./frontend/public/locales/{languageTag}/knowledge.json", + login: "./frontend/public/locales/{languageTag}/login.json", + logout: "./frontend/public/locales/{languageTag}/logout.json", + monetization: "./frontend/public/locales/{languageTag}/monetization.json", + translation: "./frontend/public/locales/{languageTag}/translation.json", + upload: "./frontend/public/locales/{languageTag}/upload.json", + user: "./frontend/public/locales/{languageTag}/user.json", + }, + }, +} + +export const mockInstalledPlugins = [ + { + id: "plugin.inlang.i18next", + displayName: { + en: "i18next", + }, + description: { + en: "i18next", + }, + module: "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js", + settingsSchema: { + type: "object", + properties: { + pathPattern: { + title: "Path to language files", + anyOf: [ + { + pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", + description: + "Specify the pathPattern to locate language files in your repository. It must include `{languageTag}` and end with `.json`.", + examples: [ + "./{languageTag}/file.json", + "../folder/{languageTag}/file.json", + "./{languageTag}.json", + ], + type: "string", + }, + { + type: "object", + patternProperties: { + "^[^.]+$": { + pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", + description: "It must include `{languageTag}` and end with `.json`.", + examples: [ + "./{languageTag}/file.json", + "../folder/{languageTag}/file.json", + "./{languageTag}.json", + ], + type: "string", + }, + }, + }, + ], + }, + variableReferencePattern: { + type: "array", + title: "Variable reference pattern", + description: + "The pattern to match content in the messages. You can define an opening and closing pattern. The closing pattern is not required. The default is '{{' and '}}'.", + examples: ["{ and }", "{{ and }}", "< and >", "@:"], + items: { + type: "string", + }, + }, + sourceLanguageFilePath: { + title: "Source language file path", + description: + "Sometimes it is necessary to specify the location of the source language file(s) when they do not follow the standard naming or file structure convention.", + anyOf: [ + { + pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", + description: "The pathPattern must contain `{languageTag}` and end with `.json`.", + examples: [ + "./{languageTag}/file.json", + "../folder/{languageTag}/file.json", + "./{languageTag}.json", + ], + type: "string", + }, + { + type: "object", + patternProperties: { + "^[^.]+$": { + pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", + description: "The pathPattern must contain `{languageTag}` and end with `.json`.", + examples: [ + "./{languageTag}/file.json", + "../folder/{languageTag}/file.json", + "./{languageTag}.json", + ], + type: "string", + }, + }, + }, + ], + }, + ignore: { + type: "array", + title: "Ignore paths", + description: "Set a path that should be ignored.", + items: { + type: "string", + }, + }, + }, + required: ["pathPattern"], + }, + }, +] + +export const mockInstalledMessageLintRules = [ + { + id: "messageLintRule.inlang.emptyPattern", + displayName: { + en: "Empty Pattern", + }, + description: { + en: "Empty Pattern", + }, + module: + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js", + }, + { + id: "messageLintRule.inlang.identicalPattern", + displayName: { + en: "Identical Pattern", + }, + description: { + en: "Identical Pattern", + }, + module: + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js", + settingsSchema: { + type: "object", + properties: { + ignore: { + type: "array", + items: { + pattern: "[^*]", + description: "All items in the array need quotaion marks at the end and beginning", + type: "string", + }, + title: "DEPRECATED. Ignore paths", + description: "Set a path that should be ignored.", + }, + }, + }, + }, + { + id: "messageLintRule.inlang.missingTranslation", + displayName: { + en: "Missing Translation", + }, + description: { + en: "Missing Translation", + }, + module: + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js", + }, + { + id: "messageLintRule.inlang.messageWithoutSource", + displayName: { + en: "Message Without Source", + }, + description: { + en: "Message Without Source", + }, + module: + "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js", + }, +] + +// export const mockProject = { +// id: "mock-project", +// installed: { +// plugins: () => [ +// { +// id: "plugin.inlang.i18next", +// displayName: { +// en: "i18next", +// }, +// description: { +// en: "i18next", +// }, +// module: "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js", +// settingsSchema: { +// type: "object", +// properties: { +// pathPattern: { +// anyOf: [ +// { +// pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", +// description: "The pathPattern must contain `{languageTag}` and end with `.json`.", +// examples: [ +// "./{languageTag}/file.json", +// "../folder/{languageTag}/file.json", +// "./{languageTag}.json", +// ], +// type: "string", +// }, +// { +// type: "object", +// patternProperties: { +// "^[^.]+$": { +// pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", +// description: +// "The pathPattern must contain `{languageTag}` and end with `.json`.", +// examples: [ +// "./{languageTag}/file.json", +// "../folder/{languageTag}/file.json", +// "./{languageTag}.json", +// ], +// type: "string", +// }, +// }, +// }, +// ], +// }, +// variableReferencePattern: { +// type: "array", +// items: { +// type: "string", +// }, +// }, +// sourceLanguageFilePath: { +// anyOf: [ +// { +// pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", +// description: "The pathPattern must contain `{languageTag}` and end with `.json`.", +// examples: [ +// "./{languageTag}/file.json", +// "../folder/{languageTag}/file.json", +// "./{languageTag}.json", +// ], +// type: "string", +// }, +// { +// type: "object", +// patternProperties: { +// "^[^.]+$": { +// pattern: "^(\\./|\\../|/)[^*]*\\{languageTag\\}[^*]*\\.json", +// description: +// "The pathPattern must contain `{languageTag}` and end with `.json`.", +// examples: [ +// "./{languageTag}/file.json", +// "../folder/{languageTag}/file.json", +// "./{languageTag}.json", +// ], +// type: "string", +// }, +// }, +// }, +// ], +// }, +// ignore: { +// type: "array", +// items: { +// type: "string", +// }, +// }, +// }, +// required: ["pathPattern"], +// }, +// }, +// ], +// messageLintRules: () => [ +// { +// id: "messageLintRule.inlang.emptyPattern", +// displayName: { +// en: "Empty Pattern", +// }, +// description: { +// en: "Empty Pattern", +// }, +// module: +// "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@latest/dist/index.js", +// }, +// { +// id: "messageLintRule.inlang.identicalPattern", +// displayName: { +// en: "Identical Pattern", +// }, +// description: { +// en: "Identical Pattern", +// }, +// module: +// "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@latest/dist/index.js", +// settingsSchema: { +// type: "object", +// properties: { +// ignore: { +// type: "array", +// items: { +// pattern: "[^*]", +// description: "All items in the array need quotaion marks at the end and beginning", +// type: "string", +// }, +// }, +// }, +// }, +// }, +// { +// id: "messageLintRule.inlang.missingTranslation", +// displayName: { +// en: "Missing Translation", +// }, +// description: { +// en: "Missing Translation", +// }, +// module: +// "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@latest/dist/index.js", +// }, +// { +// id: "messageLintRule.inlang.messageWithoutSource", +// displayName: { +// en: "Message Without Source", +// }, +// description: { +// en: "Message Without Source", +// }, +// module: +// "https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@latest/dist/index.js", +// }, +// ], +// }, +// errors: () => [], +// settings: () => mockSettings, +// setSettings: (settings: any) => (mockSettings = settings), +// } diff --git a/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.stories.ts b/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.stories.ts new file mode 100644 index 0000000000..9b96f48d6f --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.stories.ts @@ -0,0 +1,18 @@ +import "./inlang-doc-layout.ts" +import type { Meta, StoryObj } from "@storybook/web-components" +import { html } from "lit" + +const meta: Meta = { + component: "inlang-doc-layout", + title: "Public/inlang-doc-layout", +} + +export default meta + +export const Props: StoryObj = { + render: () => html` `, +} + +export const Attributes: StoryObj = { + render: () => html` `, +} diff --git a/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.ts b/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.ts new file mode 100644 index 0000000000..cc463065b2 --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/stories/inlang-doc-layout.ts @@ -0,0 +1,27 @@ +import { html, LitElement, css } from "lit" +import { customElement } from "lit/decorators.js" +import { baseStyling } from "../styling/base.js" +import overridePrimitiveColors from "./../helper/overridePrimitiveColors.js" + +@customElement("inlang-doc-layout") +export default class InlangDocLayout extends LitElement { + static override styles = [baseStyling, css``] + + override async firstUpdated() { + await this.updateComplete + + //override primitive colors to match the design system + overridePrimitiveColors() + } + + override render() { + return html`
doc-layout-component
` + } +} + +// add types +declare global { + interface HTMLElementTagNameMap { + "inlang-doc-layout": InlangDocLayout + } +} diff --git a/inlang/source-code/doc-layout-component/src/styling/base.ts b/inlang/source-code/doc-layout-component/src/styling/base.ts new file mode 100644 index 0000000000..1804bb1b7c --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/styling/base.ts @@ -0,0 +1,535 @@ +import { css } from "lit" + +/* +* This gets into the published component +*/ + +export const baseStyling = css` + :host { + font-family: "Inter", sans-serif; + + /* + * Color Primitives + */ + + /* Gray */ + --sl-color-gray-50: hsl(0 0% 97.5%); + --sl-color-gray-100: hsl(240 4.8% 95.9%); + --sl-color-gray-200: hsl(240 5.9% 90%); + --sl-color-gray-300: hsl(240 4.9% 83.9%); + --sl-color-gray-400: hsl(240 5% 64.9%); + --sl-color-gray-500: hsl(240 3.8% 46.1%); + --sl-color-gray-600: hsl(240 5.2% 33.9%); + --sl-color-gray-700: hsl(240 5.3% 26.1%); + --sl-color-gray-800: hsl(240 3.7% 15.9%); + --sl-color-gray-900: hsl(240 5.9% 10%); + --sl-color-gray-950: hsl(240 7.3% 8%); + + /* Red */ + --sl-color-red-50: hsl(0 85.7% 97.3%); + --sl-color-red-100: hsl(0 93.3% 94.1%); + --sl-color-red-200: hsl(0 96.3% 89.4%); + --sl-color-red-300: hsl(0 93.5% 81.8%); + --sl-color-red-400: hsl(0 90.6% 70.8%); + --sl-color-red-500: hsl(0 84.2% 60.2%); + --sl-color-red-600: hsl(0 72.2% 50.6%); + --sl-color-red-700: hsl(0 73.7% 41.8%); + --sl-color-red-800: hsl(0 70% 35.3%); + --sl-color-red-900: hsl(0 62.8% 30.6%); + --sl-color-red-950: hsl(0 60% 19.6%); + + /* Orange */ + --sl-color-orange-50: hsl(33.3 100% 96.5%); + --sl-color-orange-100: hsl(34.3 100% 91.8%); + --sl-color-orange-200: hsl(32.1 97.7% 83.1%); + --sl-color-orange-300: hsl(30.7 97.2% 72.4%); + --sl-color-orange-400: hsl(27 96% 61%); + --sl-color-orange-500: hsl(24.6 95% 53.1%); + --sl-color-orange-600: hsl(20.5 90.2% 48.2%); + --sl-color-orange-700: hsl(17.5 88.3% 40.4%); + --sl-color-orange-800: hsl(15 79.1% 33.7%); + --sl-color-orange-900: hsl(15.3 74.6% 27.8%); + --sl-color-orange-950: hsl(15.2 69.1% 19%); + + /* Amber */ + --sl-color-amber-50: hsl(48 100% 96.1%); + --sl-color-amber-100: hsl(48 96.5% 88.8%); + --sl-color-amber-200: hsl(48 96.6% 76.7%); + --sl-color-amber-300: hsl(45.9 96.7% 64.5%); + --sl-color-amber-400: hsl(43.3 96.4% 56.3%); + --sl-color-amber-500: hsl(37.7 92.1% 50.2%); + --sl-color-amber-600: hsl(32.1 94.6% 43.7%); + --sl-color-amber-700: hsl(26 90.5% 37.1%); + --sl-color-amber-800: hsl(22.7 82.5% 31.4%); + --sl-color-amber-900: hsl(21.7 77.8% 26.5%); + --sl-color-amber-950: hsl(22.9 74.1% 16.7%); + + /* Yellow */ + --sl-color-yellow-50: hsl(54.5 91.7% 95.3%); + --sl-color-yellow-100: hsl(54.9 96.7% 88%); + --sl-color-yellow-200: hsl(52.8 98.3% 76.9%); + --sl-color-yellow-300: hsl(50.4 97.8% 63.5%); + --sl-color-yellow-400: hsl(47.9 95.8% 53.1%); + --sl-color-yellow-500: hsl(45.4 93.4% 47.5%); + --sl-color-yellow-600: hsl(40.6 96.1% 40.4%); + --sl-color-yellow-700: hsl(35.5 91.7% 32.9%); + --sl-color-yellow-800: hsl(31.8 81% 28.8%); + --sl-color-yellow-900: hsl(28.4 72.5% 25.7%); + --sl-color-yellow-950: hsl(33.1 69% 13.9%); + + /* Lime */ + --sl-color-lime-50: hsl(78.3 92% 95.1%); + --sl-color-lime-100: hsl(79.6 89.1% 89.2%); + --sl-color-lime-200: hsl(80.9 88.5% 79.6%); + --sl-color-lime-300: hsl(82 84.5% 67.1%); + --sl-color-lime-400: hsl(82.7 78% 55.5%); + --sl-color-lime-500: hsl(83.7 80.5% 44.3%); + --sl-color-lime-600: hsl(84.8 85.2% 34.5%); + --sl-color-lime-700: hsl(85.9 78.4% 27.3%); + --sl-color-lime-800: hsl(86.3 69% 22.7%); + --sl-color-lime-900: hsl(87.6 61.2% 20.2%); + --sl-color-lime-950: hsl(86.5 60.6% 13.9%); + + /* Green */ + --sl-color-green-50: hsl(138.5 76.5% 96.7%); + --sl-color-green-100: hsl(140.6 84.2% 92.5%); + --sl-color-green-200: hsl(141 78.9% 85.1%); + --sl-color-green-300: hsl(141.7 76.6% 73.1%); + --sl-color-green-400: hsl(141.9 69.2% 58%); + --sl-color-green-500: hsl(142.1 70.6% 45.3%); + --sl-color-green-600: hsl(142.1 76.2% 36.3%); + --sl-color-green-700: hsl(142.4 71.8% 29.2%); + --sl-color-green-800: hsl(142.8 64.2% 24.1%); + --sl-color-green-900: hsl(143.8 61.2% 20.2%); + --sl-color-green-950: hsl(144.3 60.7% 12%); + + /* Emerald */ + --sl-color-emerald-50: hsl(151.8 81% 95.9%); + --sl-color-emerald-100: hsl(149.3 80.4% 90%); + --sl-color-emerald-200: hsl(152.4 76% 80.4%); + --sl-color-emerald-300: hsl(156.2 71.6% 66.9%); + --sl-color-emerald-400: hsl(158.1 64.4% 51.6%); + --sl-color-emerald-500: hsl(160.1 84.1% 39.4%); + --sl-color-emerald-600: hsl(161.4 93.5% 30.4%); + --sl-color-emerald-700: hsl(162.9 93.5% 24.3%); + --sl-color-emerald-800: hsl(163.1 88.1% 19.8%); + --sl-color-emerald-900: hsl(164.2 85.7% 16.5%); + --sl-color-emerald-950: hsl(164.3 87.5% 9.4%); + + /* Teal */ + --sl-color-teal-50: hsl(166.2 76.5% 96.7%); + --sl-color-teal-100: hsl(167.2 85.5% 89.2%); + --sl-color-teal-200: hsl(168.4 83.8% 78.2%); + --sl-color-teal-300: hsl(170.6 76.9% 64.3%); + --sl-color-teal-400: hsl(172.5 66% 50.4%); + --sl-color-teal-500: hsl(173.4 80.4% 40%); + --sl-color-teal-600: hsl(174.7 83.9% 31.6%); + --sl-color-teal-700: hsl(175.3 77.4% 26.1%); + --sl-color-teal-800: hsl(176.1 69.4% 21.8%); + --sl-color-teal-900: hsl(175.9 60.8% 19%); + --sl-color-teal-950: hsl(176.5 58.6% 11.4%); + + /* Cyan */ + --sl-color-cyan-50: hsl(183.2 100% 96.3%); + --sl-color-cyan-100: hsl(185.1 95.9% 90.4%); + --sl-color-cyan-200: hsl(186.2 93.5% 81.8%); + --sl-color-cyan-300: hsl(187 92.4% 69%); + --sl-color-cyan-400: hsl(187.9 85.7% 53.3%); + --sl-color-cyan-500: hsl(188.7 94.5% 42.7%); + --sl-color-cyan-600: hsl(191.6 91.4% 36.5%); + --sl-color-cyan-700: hsl(192.9 82.3% 31%); + --sl-color-cyan-800: hsl(194.4 69.6% 27.1%); + --sl-color-cyan-900: hsl(196.4 63.6% 23.7%); + --sl-color-cyan-950: hsl(196.8 61% 16.1%); + + /* Sky */ + --sl-color-sky-50: hsl(204 100% 97.1%); + --sl-color-sky-100: hsl(204 93.8% 93.7%); + --sl-color-sky-200: hsl(200.6 94.4% 86.1%); + --sl-color-sky-300: hsl(199.4 95.5% 73.9%); + --sl-color-sky-400: hsl(198.4 93.2% 59.6%); + --sl-color-sky-500: hsl(198.6 88.7% 48.4%); + --sl-color-sky-600: hsl(200.4 98% 39.4%); + --sl-color-sky-700: hsl(201.3 96.3% 32.2%); + --sl-color-sky-800: hsl(201 90% 27.5%); + --sl-color-sky-900: hsl(202 80.3% 23.9%); + --sl-color-sky-950: hsl(202.3 73.8% 16.5%); + + /* Blue */ + --sl-color-blue-50: hsl(213.8 100% 96.9%); + --sl-color-blue-100: hsl(214.3 94.6% 92.7%); + --sl-color-blue-200: hsl(213.3 96.9% 87.3%); + --sl-color-blue-300: hsl(211.7 96.4% 78.4%); + --sl-color-blue-400: hsl(213.1 93.9% 67.8%); + --sl-color-blue-500: hsl(217.2 91.2% 59.8%); + --sl-color-blue-600: hsl(221.2 83.2% 53.3%); + --sl-color-blue-700: hsl(224.3 76.3% 48%); + --sl-color-blue-800: hsl(225.9 70.7% 40.2%); + --sl-color-blue-900: hsl(224.4 64.3% 32.9%); + --sl-color-blue-950: hsl(226.2 55.3% 18.4%); + + /* Indigo */ + --sl-color-indigo-50: hsl(225.9 100% 96.7%); + --sl-color-indigo-100: hsl(226.5 100% 93.9%); + --sl-color-indigo-200: hsl(228 96.5% 88.8%); + --sl-color-indigo-300: hsl(229.7 93.5% 81.8%); + --sl-color-indigo-400: hsl(234.5 89.5% 73.9%); + --sl-color-indigo-500: hsl(238.7 83.5% 66.7%); + --sl-color-indigo-600: hsl(243.4 75.4% 58.6%); + --sl-color-indigo-700: hsl(244.5 57.9% 50.6%); + --sl-color-indigo-800: hsl(243.7 54.5% 41.4%); + --sl-color-indigo-900: hsl(242.2 47.4% 34.3%); + --sl-color-indigo-950: hsl(243.5 43.6% 22.9%); + + /* Violet */ + --sl-color-violet-50: hsl(250 100% 97.6%); + --sl-color-violet-100: hsl(251.4 91.3% 95.5%); + --sl-color-violet-200: hsl(250.5 95.2% 91.8%); + --sl-color-violet-300: hsl(252.5 94.7% 85.1%); + --sl-color-violet-400: hsl(255.1 91.7% 76.3%); + --sl-color-violet-500: hsl(258.3 89.5% 66.3%); + --sl-color-violet-600: hsl(262.1 83.3% 57.8%); + --sl-color-violet-700: hsl(263.4 70% 50.4%); + --sl-color-violet-800: hsl(263.4 69.3% 42.2%); + --sl-color-violet-900: hsl(263.5 67.4% 34.9%); + --sl-color-violet-950: hsl(265.1 61.5% 21.4%); + + /* Purple */ + --sl-color-purple-50: hsl(270 100% 98%); + --sl-color-purple-100: hsl(268.7 100% 95.5%); + --sl-color-purple-200: hsl(268.6 100% 91.8%); + --sl-color-purple-300: hsl(269.2 97.4% 85.1%); + --sl-color-purple-400: hsl(270 95.2% 75.3%); + --sl-color-purple-500: hsl(270.7 91% 65.1%); + --sl-color-purple-600: hsl(271.5 81.3% 55.9%); + --sl-color-purple-700: hsl(272.1 71.7% 47.1%); + --sl-color-purple-800: hsl(272.9 67.2% 39.4%); + --sl-color-purple-900: hsl(273.6 65.6% 32%); + --sl-color-purple-950: hsl(276 59.5% 16.5%); + + /* Fuchsia */ + --sl-color-fuchsia-50: hsl(289.1 100% 97.8%); + --sl-color-fuchsia-100: hsl(287 100% 95.5%); + --sl-color-fuchsia-200: hsl(288.3 95.8% 90.6%); + --sl-color-fuchsia-300: hsl(291.1 93.1% 82.9%); + --sl-color-fuchsia-400: hsl(292 91.4% 72.5%); + --sl-color-fuchsia-500: hsl(292.2 84.1% 60.6%); + --sl-color-fuchsia-600: hsl(293.4 69.5% 48.8%); + --sl-color-fuchsia-700: hsl(294.7 72.4% 39.8%); + --sl-color-fuchsia-800: hsl(295.4 70.2% 32.9%); + --sl-color-fuchsia-900: hsl(296.7 63.6% 28%); + --sl-color-fuchsia-950: hsl(297.1 56.8% 14.5%); + + /* Pink */ + --sl-color-pink-50: hsl(327.3 73.3% 97.1%); + --sl-color-pink-100: hsl(325.7 77.8% 94.7%); + --sl-color-pink-200: hsl(325.9 84.6% 89.8%); + --sl-color-pink-300: hsl(327.4 87.1% 81.8%); + --sl-color-pink-400: hsl(328.6 85.5% 70.2%); + --sl-color-pink-500: hsl(330.4 81.2% 60.4%); + --sl-color-pink-600: hsl(333.3 71.4% 50.6%); + --sl-color-pink-700: hsl(335.1 77.6% 42%); + --sl-color-pink-800: hsl(335.8 74.4% 35.3%); + --sl-color-pink-900: hsl(335.9 69% 30.4%); + --sl-color-pink-950: hsl(336.2 65.4% 15.9%); + + /* Rose */ + --sl-color-rose-50: hsl(355.7 100% 97.3%); + --sl-color-rose-100: hsl(355.6 100% 94.7%); + --sl-color-rose-200: hsl(352.7 96.1% 90%); + --sl-color-rose-300: hsl(352.6 95.7% 81.8%); + --sl-color-rose-400: hsl(351.3 94.5% 71.4%); + --sl-color-rose-500: hsl(349.7 89.2% 60.2%); + --sl-color-rose-600: hsl(346.8 77.2% 49.8%); + --sl-color-rose-700: hsl(345.3 82.7% 40.8%); + --sl-color-rose-800: hsl(343.4 79.7% 34.7%); + --sl-color-rose-900: hsl(341.5 75.5% 30.4%); + --sl-color-rose-950: hsl(341.3 70.1% 17.1%); + + /* + * Theme Tokens + */ + + /* Primary */ + --sl-color-primary-50: var(--sl-color-sky-50); + --sl-color-primary-100: var(--sl-color-sky-100); + --sl-color-primary-200: var(--sl-color-sky-200); + --sl-color-primary-300: var(--sl-color-sky-300); + --sl-color-primary-400: var(--sl-color-sky-400); + --sl-color-primary-500: var(--sl-color-sky-500); + --sl-color-primary-600: var(--sl-color-sky-600); + --sl-color-primary-700: var(--sl-color-sky-700); + --sl-color-primary-800: var(--sl-color-sky-800); + --sl-color-primary-900: var(--sl-color-sky-900); + --sl-color-primary-950: var(--sl-color-sky-950); + + /* Success */ + --sl-color-success-50: var(--sl-color-green-50); + --sl-color-success-100: var(--sl-color-green-100); + --sl-color-success-200: var(--sl-color-green-200); + --sl-color-success-300: var(--sl-color-green-300); + --sl-color-success-400: var(--sl-color-green-400); + --sl-color-success-500: var(--sl-color-green-500); + --sl-color-success-600: var(--sl-color-green-600); + --sl-color-success-700: var(--sl-color-green-700); + --sl-color-success-800: var(--sl-color-green-800); + --sl-color-success-900: var(--sl-color-green-900); + --sl-color-success-950: var(--sl-color-green-950); + + /* Warning */ + --sl-color-warning-50: var(--sl-color-amber-50); + --sl-color-warning-100: var(--sl-color-amber-100); + --sl-color-warning-200: var(--sl-color-amber-200); + --sl-color-warning-300: var(--sl-color-amber-300); + --sl-color-warning-400: var(--sl-color-amber-400); + --sl-color-warning-500: var(--sl-color-amber-500); + --sl-color-warning-600: var(--sl-color-amber-600); + --sl-color-warning-700: var(--sl-color-amber-700); + --sl-color-warning-800: var(--sl-color-amber-800); + --sl-color-warning-900: var(--sl-color-amber-900); + --sl-color-warning-950: var(--sl-color-amber-950); + + /* Danger */ + --sl-color-danger-50: var(--sl-color-red-50); + --sl-color-danger-100: var(--sl-color-red-100); + --sl-color-danger-200: var(--sl-color-red-200); + --sl-color-danger-300: var(--sl-color-red-300); + --sl-color-danger-400: var(--sl-color-red-400); + --sl-color-danger-500: var(--sl-color-red-500); + --sl-color-danger-600: var(--sl-color-red-600); + --sl-color-danger-700: var(--sl-color-red-700); + --sl-color-danger-800: var(--sl-color-red-800); + --sl-color-danger-900: var(--sl-color-red-900); + --sl-color-danger-950: var(--sl-color-red-950); + + /* Neutral */ + --sl-color-neutral-50: var(--sl-color-gray-50); + --sl-color-neutral-100: var(--sl-color-gray-100); + --sl-color-neutral-200: var(--sl-color-gray-200); + --sl-color-neutral-300: var(--sl-color-gray-300); + --sl-color-neutral-400: var(--sl-color-gray-400); + --sl-color-neutral-500: var(--sl-color-gray-500); + --sl-color-neutral-600: var(--sl-color-gray-600); + --sl-color-neutral-700: var(--sl-color-gray-700); + --sl-color-neutral-800: var(--sl-color-gray-800); + --sl-color-neutral-900: var(--sl-color-gray-900); + --sl-color-neutral-950: var(--sl-color-gray-950); + + /* Neutral one-offs */ + --sl-color-neutral-0: hsl(0, 0%, 100%); + --sl-color-neutral-1000: hsl(0, 0%, 0%); + + /* + * Border radii + */ + + --sl-border-radius-small: 0.1875rem; /* 3px */ + --sl-border-radius-medium: 0.25rem; /* 4px */ + --sl-border-radius-large: 0.5rem; /* 8px */ + --sl-border-radius-x-large: 1rem; /* 16px */ + + --sl-border-radius-circle: 50%; + --sl-border-radius-pill: 9999px; + + /* + * Elevations + */ + + --sl-shadow-x-small: 0 1px 2px hsl(240 3.8% 46.1% / 6%); + --sl-shadow-small: 0 1px 2px hsl(240 3.8% 46.1% / 12%); + --sl-shadow-medium: 0 2px 4px hsl(240 3.8% 46.1% / 12%); + --sl-shadow-large: 0 2px 8px hsl(240 3.8% 46.1% / 12%); + --sl-shadow-x-large: 0 4px 16px hsl(240 3.8% 46.1% / 12%); + + /* + * Spacings + */ + + --sl-spacing-3x-small: 0.125rem; /* 2px */ + --sl-spacing-2x-small: 0.25rem; /* 4px */ + --sl-spacing-x-small: 0.5rem; /* 8px */ + --sl-spacing-small: 0.75rem; /* 12px */ + --sl-spacing-medium: 1rem; /* 16px */ + --sl-spacing-large: 1.25rem; /* 20px */ + --sl-spacing-x-large: 1.75rem; /* 28px */ + --sl-spacing-2x-large: 2.25rem; /* 36px */ + --sl-spacing-3x-large: 3rem; /* 48px */ + --sl-spacing-4x-large: 4.5rem; /* 72px */ + + /* + * Transitions + */ + + --sl-transition-x-slow: 1000ms; + --sl-transition-slow: 500ms; + --sl-transition-medium: 250ms; + --sl-transition-fast: 150ms; + --sl-transition-x-fast: 50ms; + + /* + * Typography + */ + + /* Fonts */ + --sl-font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; + --sl-font-sans: Inter, sans-serif; + --sl-font-serif: Inter, "Times New Roman", serif; + + /* Font sizes */ + --sl-font-size-2x-small: 0.625rem; /* 10px */ + --sl-font-size-x-small: 0.75rem; /* 12px */ + --sl-font-size-small: 0.875rem; /* 14px */ + --sl-font-size-medium: 1rem; /* 16px */ + --sl-font-size-large: 1.25rem; /* 20px */ + --sl-font-size-x-large: 1.5rem; /* 24px */ + --sl-font-size-2x-large: 2.25rem; /* 36px */ + --sl-font-size-3x-large: 3rem; /* 48px */ + --sl-font-size-4x-large: 4.5rem; /* 72px */ + + /* Font weights */ + --sl-font-weight-light: 300; + --sl-font-weight-normal: 400; + --sl-font-weight-semibold: 500; + --sl-font-weight-bold: 700; + + /* Letter spacings */ + --sl-letter-spacing-denser: -0.03em; + --sl-letter-spacing-dense: -0.015em; + --sl-letter-spacing-normal: normal; + --sl-letter-spacing-loose: 0.075em; + --sl-letter-spacing-looser: 0.15em; + + /* Line heights */ + --sl-line-height-denser: 1; + --sl-line-height-dense: 1.4; + --sl-line-height-normal: 1.8; + --sl-line-height-loose: 2.2; + --sl-line-height-looser: 2.6; + + /* Focus rings */ + --sl-focus-ring-color: var(--sl-color-primary-600); + --sl-focus-ring-style: solid; + --sl-focus-ring-width: 3px; + --sl-focus-ring: var(--sl-focus-ring-style) var(--sl-focus-ring-width) + var(--sl-focus-ring-color); + --sl-focus-ring-offset: 1px; + + /* + * Forms + */ + + /* Buttons */ + --sl-button-font-size-small: var(--sl-font-size-x-small); + --sl-button-font-size-medium: var(--sl-font-size-small); + --sl-button-font-size-large: var(--sl-font-size-medium); + + /* Inputs */ + --sl-input-height-small: 1.875rem; /* 30px */ + --sl-input-height-medium: 2.5rem; /* 40px */ + --sl-input-height-large: 3.125rem; /* 50px */ + + --sl-input-background-color: var(--sl-color-neutral-0); + --sl-input-background-color-hover: var(--sl-input-background-color); + --sl-input-background-color-focus: var(--sl-input-background-color); + --sl-input-background-color-disabled: var(--sl-color-neutral-100); + --sl-input-border-color: var(--sl-color-neutral-300); + --sl-input-border-color-hover: var(--sl-color-neutral-400); + --sl-input-border-color-focus: var(--sl-color-primary-500); + --sl-input-border-color-disabled: var(--sl-color-neutral-300); + --sl-input-border-width: 1px; + --sl-input-required-content: "*"; + --sl-input-required-content-offset: -2px; + --sl-input-required-content-color: var(--sl-input-label-color); + + --sl-input-border-radius-small: var(--sl-border-radius-medium); + --sl-input-border-radius-medium: var(--sl-border-radius-medium); + --sl-input-border-radius-large: var(--sl-border-radius-medium); + + --sl-input-font-family: var(--sl-font-sans); + --sl-input-font-weight: var(--sl-font-weight-normal); + --sl-input-font-size-small: var(--sl-font-size-small); + --sl-input-font-size-medium: var(--sl-font-size-medium); + --sl-input-font-size-large: var(--sl-font-size-large); + --sl-input-letter-spacing: var(--sl-letter-spacing-normal); + + --sl-input-color: var(--sl-color-neutral-700); + --sl-input-color-hover: var(--sl-color-neutral-700); + --sl-input-color-focus: var(--sl-color-neutral-700); + --sl-input-color-disabled: var(--sl-color-neutral-900); + --sl-input-icon-color: var(--sl-color-neutral-500); + --sl-input-icon-color-hover: var(--sl-color-neutral-600); + --sl-input-icon-color-focus: var(--sl-color-neutral-600); + --sl-input-placeholder-color: var(--sl-color-neutral-500); + --sl-input-placeholder-color-disabled: var(--sl-color-neutral-600); + --sl-input-spacing-small: var(--sl-spacing-small); + --sl-input-spacing-medium: var(--sl-spacing-medium); + --sl-input-spacing-large: var(--sl-spacing-large); + + --sl-input-focus-ring-color: hsl(198.6 88.7% 48.4% / 40%); + --sl-input-focus-ring-offset: 0; + + --sl-input-filled-background-color: var(--sl-color-neutral-100); + --sl-input-filled-background-color-hover: var(--sl-color-neutral-100); + --sl-input-filled-background-color-focus: var(--sl-color-neutral-100); + --sl-input-filled-background-color-disabled: var(--sl-color-neutral-100); + --sl-input-filled-color: var(--sl-color-neutral-800); + --sl-input-filled-color-hover: var(--sl-color-neutral-800); + --sl-input-filled-color-focus: var(--sl-color-neutral-700); + --sl-input-filled-color-disabled: var(--sl-color-neutral-800); + + /* Labels */ + --sl-input-label-font-size-small: var(--sl-font-size-small); + --sl-input-label-font-size-medium: var(--sl-font-size-medium); + --sl-input-label-font-size-large: var(--sl-font-size-large); + --sl-input-label-color: inherit; + + /* Help text */ + --sl-input-help-text-font-size-small: var(--sl-font-size-x-small); + --sl-input-help-text-font-size-medium: var(--sl-font-size-small); + --sl-input-help-text-font-size-large: var(--sl-font-size-medium); + --sl-input-help-text-color: var(--sl-color-neutral-500); + + /* Toggles (checkboxes, radios, switches) */ + --sl-toggle-size-small: 0.875rem; /* 14px */ + --sl-toggle-size-medium: 1.125rem; /* 18px */ + --sl-toggle-size-large: 1.375rem; /* 22px */ + + /* + * Overlays + */ + + --sl-overlay-background-color: hsl(240 3.8% 46.1% / 33%); + + /* + * Panels + */ + + --sl-panel-background-color: var(--sl-color-neutral-0); + --sl-panel-border-color: var(--sl-color-neutral-200); + --sl-panel-border-width: 1px; + + /* + * Tooltips + */ + + --sl-tooltip-border-radius: var(--sl-border-radius-medium); + --sl-tooltip-background-color: var(--sl-color-neutral-800); + --sl-tooltip-color: var(--sl-color-neutral-0); + --sl-tooltip-font-family: var(--sl-font-sans); + --sl-tooltip-font-weight: var(--sl-font-weight-normal); + --sl-tooltip-font-size: var(--sl-font-size-small); + --sl-tooltip-line-height: var(--sl-line-height-dense); + --sl-tooltip-padding: var(--sl-spacing-2x-small) var(--sl-spacing-x-small); + --sl-tooltip-arrow-size: 6px; + + /* + * Z-indexes + */ + + --sl-z-index-drawer: 700; + --sl-z-index-dialog: 800; + --sl-z-index-dropdown: 900; + --sl-z-index-toast: 950; + --sl-z-index-tooltip: 1000; + } +` diff --git a/inlang/source-code/doc-layout-component/src/styling/preview.css b/inlang/source-code/doc-layout-component/src/styling/preview.css new file mode 100644 index 0000000000..6f553ad632 --- /dev/null +++ b/inlang/source-code/doc-layout-component/src/styling/preview.css @@ -0,0 +1,9 @@ +html { + width: 100%; + display: flex; + justify-content: center; +} +body { + width: 100%; + max-width: 800px; +} diff --git a/inlang/source-code/doc-layout-component/tsconfig.json b/inlang/source-code/doc-layout-component/tsconfig.json new file mode 100644 index 0000000000..44ae6d21ee --- /dev/null +++ b/inlang/source-code/doc-layout-component/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../tsconfig.base.json", + "include": ["src/**/*"], + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "declaration": true, + "declarationMap": true, + "experimentalDecorators": true, + "useDefineForClassFields": false, + "types": [], + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "exclude": ["**/*.stories.ts", "**/*.stories.js", "**/*.mdx", "dist"], + "references": [] +} diff --git a/inlang/source-code/sdk/multi-project-test/project4-dir/project.inlang/messages.json b/inlang/source-code/sdk/multi-project-test/project4-dir/project.inlang/messages.json index 9dda436675..8e4c82d680 100644 --- a/inlang/source-code/sdk/multi-project-test/project4-dir/project.inlang/messages.json +++ b/inlang/source-code/sdk/multi-project-test/project4-dir/project.inlang/messages.json @@ -4,16 +4,6 @@ "id": "project4_message_key_1", "selectors": [], "variants": [ - { - "languageTag": "de", - "match": [], - "pattern": [ - { - "type": "Text", - "value": "Mock translate local en to de: Generated message (1)" - } - ] - }, { "languageTag": "en", "match": [], @@ -31,16 +21,6 @@ "id": "project4_message_key_2", "selectors": [], "variants": [ - { - "languageTag": "de", - "match": [], - "pattern": [ - { - "type": "Text", - "value": "Mock translate local en to de: Generated message (2)" - } - ] - }, { "languageTag": "en", "match": [], @@ -58,16 +38,6 @@ "id": "project4_message_key_3", "selectors": [], "variants": [ - { - "languageTag": "de", - "match": [], - "pattern": [ - { - "type": "Text", - "value": "Mock translate local en to de: Generated message (3)" - } - ] - }, { "languageTag": "en", "match": [], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 36f9e35f5f..60b53f0a61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -391,6 +391,70 @@ importers: specifier: 0.34.6 version: 0.34.6(jsdom@22.1.0) + inlang/source-code/doc-layout-component: + dependencies: + '@inlang/sdk': + specifier: workspace:^ + version: link:../sdk + '@lit/task': + specifier: ^1.0.0 + version: 1.0.0 + '@shoelace-style/shoelace': + specifier: 2.14.0 + version: 2.14.0(@types/react@18.2.79) + '@sinclair/typebox': + specifier: 0.31.28 + version: 0.31.28 + chroma-js: + specifier: ^2.4.2 + version: 2.4.2 + devDependencies: + '@inlang/marketplace-registry': + specifier: workspace:^ + version: link:../marketplace-registry + '@nx/storybook': + specifier: ^18.0.4 + version: 18.3.3(@types/node@20.12.7)(nx@18.3.3)(typescript@5.3.3) + '@storybook/addon-essentials': + specifier: ^7.6.16 + version: 7.6.18(@types/react@18.2.79)(react-dom@18.2.0)(react@18.2.0) + '@storybook/addon-links': + specifier: ^7.6.16 + version: 7.6.18(react@18.2.0) + '@storybook/blocks': + specifier: ^7.6.16 + version: 7.6.18(@types/react@18.2.79)(react-dom@18.2.0)(react@18.2.0) + '@storybook/web-components': + specifier: ^7.6.16 + version: 7.6.18(lit@3.1.3)(react-dom@18.2.0)(react@18.2.0) + '@storybook/web-components-vite': + specifier: ^7.6.16 + version: 7.6.18(lit@3.1.3)(react-dom@18.2.0)(react@18.2.0)(typescript@5.3.3)(vite@4.5.2) + '@types/chroma-js': + specifier: ^2.4.4 + version: 2.4.4 + '@vitest/coverage-v8': + specifier: 0.34.6 + version: 0.34.6(vitest@0.34.6) + esbuild: + specifier: ^0.20.0 + version: 0.20.2 + lit: + specifier: ^3.1.2 + version: 3.1.3 + react: + specifier: ^18.2.0 + version: 18.2.0 + react-dom: + specifier: ^18.2.0 + version: 18.2.0(react@18.2.0) + storybook: + specifier: ^7.6.16 + version: 7.6.18 + vitest: + specifier: 0.34.6 + version: 0.34.6(jsdom@22.1.0) + inlang/source-code/editor: dependencies: '@inlang/settings-component':