Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
cb14357
docs init
techniq Oct 5, 2025
59fd313
Setup content-collections
techniq Oct 5, 2025
a191aac
Setup mdsx
techniq Oct 6, 2025
e98f84a
Setup unplugin-icons and Svelte UX
techniq Oct 6, 2025
539e139
Rough in more functionality
techniq Oct 6, 2025
f0520e5
more roughing in
techniq Oct 6, 2025
fb3fb0c
responsive tweaks
techniq Oct 6, 2025
7706db8
Add svelte inspector
techniq Oct 6, 2025
dcc70ea
Move `getComponentDoc` util under lib/markdown
techniq Oct 7, 2025
31fe347
Add layerchart as workspace dependency. Copy data generators
techniq Oct 7, 2025
3d76433
Remove prettier-plugin-tailwindcss (order doesn't make sense: `class=…
techniq Oct 7, 2025
0b12fdc
Support toggling the side menu on large viewports
techniq Oct 7, 2025
f34708f
Add `Code` component
techniq Oct 7, 2025
83fefda
basic code
techniq Oct 7, 2025
b0a648a
Use styles header elements in page layout
techniq Oct 7, 2025
77b402b
Experiment with using rehype plugin to insert example source
techniq Oct 7, 2025
700734d
tweak layout, cleanup
techniq Oct 7, 2025
720c7de
Fix posthog import
techniq Oct 8, 2025
d36d904
More experimenting (PromiseExample, AsyncExample)
techniq Oct 8, 2025
382e1ed
Add blockquote to blueprint
techniq Oct 8, 2025
ebbb0e7
cleanup
techniq Oct 8, 2025
4caa77a
Fix icon types
techniq Oct 8, 2025
817ec5a
Only show related and component source if available
techniq Oct 8, 2025
6a47291
Add li, ul, and ol components to markdown blueprint
techniq Oct 8, 2025
b9ca7c3
Rename `supportedContexts` to `layers`
techniq Oct 8, 2025
4ce26c7
Add a component to markdown blueprint
techniq Oct 8, 2025
bc2223a
Only transition explicit properties (width, left) to improve theme to…
techniq Oct 8, 2025
415e0f3
Split example investigation into separate files
techniq Oct 8, 2025
09e5c6f
Make things less whiny
techniq Oct 8, 2025
11871fa
Read menu `section` from frontmatter instead of directory
techniq Oct 8, 2025
8b20caf
Load examples (with sources) via page load()
techniq Oct 8, 2025
a1cfbd8
Rename `Example` to `SourceExample`
techniq Oct 9, 2025
f611036
Register examples on context and setup `Example` component to streamline
techniq Oct 9, 2025
03944cb
Fix svelte-check, eslint, and prettier errors
techniq Oct 9, 2025
99c2b16
Install chromium playwright browser in CI
techniq Oct 9, 2025
ff04ded
only install chromium for docs (for now)
techniq Oct 9, 2025
34ef631
Setup shared state (renderContext, debug)
techniq Oct 9, 2025
95f617e
Add Source button
techniq Oct 9, 2025
92bcaff
Setup "View data"
techniq Oct 9, 2025
fff1cda
Add p components to markdown blueprint
techniq Oct 9, 2025
2906588
Add padding above example
techniq Oct 9, 2025
006cd55
Remove nested directory (ex. charts) from AreaChart/LineChart. Impro…
techniq Oct 9, 2025
6f40930
Use github-dark theme, add TODO to fix light/dark theme
techniq Oct 9, 2025
8246a57
Fix reactivity of `examples` context, rename `/components/[...slug]` …
techniq Oct 9, 2025
81383cf
Fix Charts source / sourceUrl
techniq Oct 9, 2025
dcf7718
Add AreaChart `default-series-label` example
techniq Oct 9, 2025
25b13ab
Support opening example in separate route
techniq Oct 9, 2025
105ac0a
Add breadcrumb
techniq Oct 9, 2025
5e74108
cleanup
techniq Oct 10, 2025
8154d67
Ignore content-collections (needed until #651 is merged)
techniq Oct 10, 2025
87d479b
Merge branch 'next' of https://github.com/techniq/layerchart into next
techniq Oct 10, 2025
f17d50b
Merge branch 'next' into docs-v2
techniq Oct 10, 2025
b55e679
Move getChartContext / setChartContext to new `$lib/contexts` module
techniq Oct 11, 2025
60ae9c5
Rename [get|set]RenderContext to [get|set]LayerContext. Move to `$li…
techniq Oct 12, 2025
38d5e3c
Fix imports
techniq Oct 12, 2025
f904309
fix(Layer): svelte-check errors on children
techniq Oct 12, 2025
ee7f462
Move getGeoContext/setGeoContext/GeoContextValue to $lib/contexts module
techniq Oct 12, 2025
4bba04c
Move getTooltipContext/setTooltipContext/TooltipContextValue to $lib/…
techniq Oct 12, 2025
4c33b4d
Move LegendPayload to $lib/contexts
techniq Oct 12, 2025
5f3fdef
Move getTransformContext/setTransformContext/TransformContextValue to…
techniq Oct 12, 2025
fe7d60f
Move Canavs context to $lib/contexts module
techniq Oct 12, 2025
2724ac2
Rename `layout` diretory to `layers`
techniq Oct 12, 2025
e7113c4
feat: Support global settings (layer type, debug, etc)
techniq Oct 12, 2025
4900b06
Use settings() within new docs
techniq Oct 12, 2025
abfa41a
feat(Example): Support showing code by default
techniq Oct 12, 2025
706147c
Removing border/padding from examples and handle in Example
techniq Oct 12, 2025
f944df1
feat(Chart): Support passing explicit `width` and `height` instead of…
techniq Oct 12, 2025
8d2a966
Use `<Chart height={...}>` for new examples
techniq Oct 12, 2025
d85d9c0
Remove `export { data };` from displayed source
techniq Oct 12, 2025
12f9b7d
Migrate more AreaChart examples
techniq Oct 12, 2025
ad9568a
Migrate more AreaChart examples
techniq Oct 13, 2025
00f5bfd
Add example data
techniq Oct 13, 2025
6b0220f
Migrate more AreaChart examples
techniq Oct 13, 2025
843f648
Migrate more AreaChart examples
techniq Oct 13, 2025
5055587
Use remote functions for remote data fetching
techniq Oct 13, 2025
90e607f
Migrate remaining AreaChart examples
techniq Oct 13, 2025
0ac111d
Only show TableOfContents on component example list page, not individ…
techniq Oct 13, 2025
23d7f77
started job on barchart
l0uisgrange Oct 13, 2025
11e8e39
Add "Back to examples" button
techniq Oct 13, 2025
4ad12af
Merge branch 'docs-v2' of https://github.com/l0uisgrange/layerchart i…
techniq Oct 13, 2025
e92b911
Update PieChart and ScatterChart metadata
techniq Oct 13, 2025
cf80427
More LineChart examples
techniq Oct 14, 2025
9f8c7b4
More LineChart examples
techniq Oct 14, 2025
276f176
More LineChart examples
techniq Oct 14, 2025
77f1900
Change Code tab-size from `4` to `2`
techniq Oct 14, 2025
c850498
Improve `a` and `p` markdown components
techniq Oct 14, 2025
32c838d
More LineChart examples
techniq Oct 14, 2025
673f5ec
Migrate remaining LineChart examples
techniq Oct 14, 2025
10214d0
docs(BarChart): Reduce basic data points from 30 to 10
techniq Oct 14, 2025
dafef6e
Support resizing example (x-only)
techniq Oct 14, 2025
847a734
Fix types for passing `width` and `height` to ArcChart and PieChart
techniq Oct 14, 2025
ac3e32c
Add ArcChart page
techniq Oct 14, 2025
04c3543
tweak blockquote style
techniq Oct 14, 2025
8ce7874
add margin above example actions
techniq Oct 14, 2025
014ff10
Improve location of LineChart draw toggle
techniq Oct 14, 2025
ae31f91
Migrate remaining ArcChart examples
techniq Oct 14, 2025
51e724e
update import order
techniq Oct 14, 2025
c2e4169
Add better visual distinction when resizing example container
techniq Oct 14, 2025
e7729d4
More PieChart examples
techniq Oct 14, 2025
02da164
Migrate remaining PieChart examples
techniq Oct 14, 2025
e4d7dc5
Add penguin data remote function and add simple svelte:boundary with …
techniq Oct 14, 2025
b5d7552
Add ScatterChart examples
techniq Oct 14, 2025
8b4c9a7
Migrate remaining ScatterChart examples
techniq Oct 14, 2025
8b3d38c
Add Axis page placeholder
techniq Oct 15, 2025
a825987
Merge branch 'next' of https://github.com/techniq/layerchart into next
techniq Oct 15, 2025
eb70c69
Merge branch 'next' into docs-v2
techniq Oct 15, 2025
29bc0cd
Add more Axis examples
techniq Oct 15, 2025
cba2cef
feat(Layer): Support showing chart and full frame boundaries with `se…
techniq Oct 15, 2025
78df859
More Axis examples
techniq Oct 15, 2025
710f18f
Remove used of tailwind classes from new Layer debug, also fixing htm…
techniq Oct 15, 2025
54eb09f
Migrate remaining Axis examples
techniq Oct 15, 2025
74fc985
Add Frame examples
techniq Oct 15, 2025
8360c5a
Migrate remaining Grid examples
techniq Oct 16, 2025
01095ee
Add Legend examples
techniq Oct 16, 2025
4c29d63
Add Rule examples
techniq Oct 16, 2025
a9bf71f
Filter out "examples" section
techniq Oct 16, 2025
ef885a6
Add Arc examples
techniq Oct 16, 2025
404c869
Add explicit order to sections
techniq Oct 16, 2025
f128934
Update `pnpm dev` at root to run `svelte-package --watch` for package…
techniq Oct 16, 2025
e8f36a8
Do not package --watch by default (just initial package) when running…
techniq Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/fair-phones-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

refactor: Rename simplified charts `renderContext` prop to `layer`
5 changes: 5 additions & 0 deletions .changeset/flat-cases-enter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

refactor: Move contexts to separate `$lib/contexts` module
5 changes: 5 additions & 0 deletions .changeset/four-lizards-win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

feat(Layer): Allow `type` to be optional, fallbacking back to `settings.layer` type
5 changes: 5 additions & 0 deletions .changeset/full-times-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

feat: Support global settings (layer type, debug, etc)
5 changes: 5 additions & 0 deletions .changeset/icy-llamas-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

feat(Chart): Support passing explicit `width` and `height` instead of requiring parent dimensions
5 changes: 5 additions & 0 deletions .changeset/twenty-bushes-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'layerchart': patch
---

feat(Layer): Support showing chart and full frame boundaries with `settings.debug`
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- run: pnpm install --frozen-lockfile

- run: pnpm --filter docs exec playwright install chromium

- run: pnpm check:packages

- run: pnpm lint:packages
Expand Down
27 changes: 27 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
test-results
node_modules

# Output
.output
.vercel
.netlify
.wrangler
/.svelte-kit
/build

# OS
.DS_Store
Thumbs.db

# Env
.env
.env.*
!.env.example
!.env.test

# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# Content Collections
.content-collections
1 change: 1 addition & 0 deletions docs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
9 changes: 9 additions & 0 deletions docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Package Managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb

# Miscellaneous
/static/
15 changes: 15 additions & 0 deletions docs/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
38 changes: 38 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# sv

Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).

## Creating a project

If you're seeing this, you've probably already done this step. Congrats!

```sh
# create a new project in the current directory
npx sv create

# create a new project in my-app
npx sv create my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```sh
npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open
```

## Building

To create a production version of your app:

```sh
npm run build
```

You can preview the production build with `npm run preview`.

> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
51 changes: 51 additions & 0 deletions docs/content-collections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { defineCollection, defineConfig } from '@content-collections/core';
// import { compileMarkdown } from '@content-collections/markdown';
import { toPascalCase } from '@layerstack/utils';
import { z } from 'zod';
import { readFileSync } from 'fs';
import { join } from 'path';

const components = defineCollection({
name: 'components',
directory: 'src/content/components',
include: '**/*.md',
schema: z.object({
description: z.string().optional(),
section: z.string().optional(),
layers: z.array(z.string()).default([]),
related: z.array(z.string()).default([])
}),
transform: async (doc) => {
const { filePath, fileName, directory, path } = doc._meta;

// Read the source file from the layerchart package
const sourcePath = join(
process.cwd(),
`../packages/layerchart/src/lib/components/${doc.section === 'charts' ? 'charts/' : ''}${path}.svelte`
);

let source = '';
let sourceUrl = '';
try {
source = readFileSync(sourcePath, 'utf-8');
sourceUrl = `https://github.com/techniq/layerchart/blob/next/packages/layerchart/src/lib/components/${path}.svelte`;
} catch (error) {
// console.warn(
// `Could not read source file for ${filePath}: ${error instanceof Error ? error.message : String(error)}`
// );
}

return {
...doc,
name: toPascalCase(fileName.replace('.md', '')),
slug: path,
source,
sourceUrl
// html: await compileMarkdown(context, doc)
};
}
});

export default defineConfig({
collections: [components]
});
6 changes: 6 additions & 0 deletions docs/e2e/demo.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { expect, test } from '@playwright/test';

test('home page has expected h1', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toBeVisible();
});
45 changes: 45 additions & 0 deletions docs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import prettier from 'eslint-config-prettier';
import { fileURLToPath } from 'node:url';
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import ts from 'typescript-eslint';
import svelteConfig from './svelte.config.js';

const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url));

export default defineConfig(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
prettier,
...svelte.configs.prettier,
{
languageOptions: {
globals: { ...globals.browser, ...globals.node }
},
rules: {
// typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects.
// see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
'no-undef': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'svelte/require-each-key': 'off',
'svelte/no-navigation-without-resolve': 'off'
}
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: ['.svelte'],
parser: ts.parser,
svelteConfig
}
}
}
);
123 changes: 123 additions & 0 deletions docs/mdsx.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import { defineConfig } from 'mdsx';

import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm';
import rehypePrettyCode from 'rehype-pretty-code';

import { readFileSync } from 'node:fs';
import path, { resolve } from 'node:path';
import process from 'node:process';
// import { fileURLToPath } from "node:url";
// import prettier from "@prettier/sync";
// import { getHighlighter } from 'shiki';
// import { createHighlighter } from 'shiki';
import { u } from 'unist-builder';
import { visit } from 'unist-util-visit';
// import { codeBlockPrettierConfig } from "./other/code-block-prettier.js";
// import { rehypeCustomHighlight } from '@mdsx/rehype-custom-highlighter';

/**
* @type {import('rehype-pretty-code').Options}
*/
const prettyCodeOptions = {
theme: 'github-dark'
// TODO: Why does this not work?
// theme: {
// light: 'github-light',
// dark: 'github-dark'
// }
};

export const mdsxConfig = defineConfig({
extensions: ['.md'],
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypeSlug, rehypeComponentExample, [rehypePrettyCode, prettyCodeOptions]],
blueprints: {
default: {
path: 'src/lib/markdown/blueprints/default/blueprint.svelte'
}
}
});

/**
* Adds the source code to component examples.
*
* @returns {HastTransformer} - unified transformer
*/
function rehypeComponentExample() {
return async (tree) => {
const componentRegex = /component="([^"]+)"/;
const nameRegex = /name="([^"]+)"/;

visit(tree, (node, index, parent) => {
if (node?.type === 'raw' && node?.value?.startsWith('<SourceExample')) {
const currNode = node;

const componentMatch = currNode.value.match(componentRegex);
const component = componentMatch ? componentMatch[1] : null;
if (!component) return null;

const nameMatch = currNode.value.match(nameRegex);
const name = nameMatch ? nameMatch[1] : null;
if (!name) return null;

try {
const sourceCode = getComponentSourceFileContent(component, name);
if (!sourceCode)
throw new Error(
`Could not find source code for component: ${component} example: ${name}`
);

const sourceCodeNode = u('element', {
tagName: 'pre',
properties: {
className: ['code']
},
children: [
u('element', {
tagName: 'code',
properties: {
className: [`language-svelte`]
},
attributes: {},
children: [
{
type: 'text',
value: sourceCode
}
]
})
]
});
if (!index) return;
parent.children.splice(index + 1, 0, sourceCodeNode);
} catch (e) {
console.error(e);
}
}
});
};
}

function getComponentSourceFileContent(component, name) {
if (!component || !name) return null;

const filePath = path.join(process.cwd(), `./src/examples/${component}/${name}.svelte`);
try {
const fileContents = readFileSync(filePath, 'utf-8');

// return prettier.format(
// transformComponentSourceContent(fileContents),
// codeBlockPrettierConfig
// );
return fileContents;
} catch (e) {
console.error(`Error reading file at ${filePath}:`, e);
return null;
}
}

// function transformComponentSourceContent(src = '') {
// // return src.replaceAll(`import { cn } from "$lib/utils/styles.js"`, `import cn from "clsx"`);
// return src;
// }
Loading
Loading