Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.4.0 #36

Merged
merged 40 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0c06223
Initial stuff
louisescher Dec 25, 2024
ecdc88e
Add new colors, standardize radii with radii.css
louisescher Dec 25, 2024
c6d3f2f
Fix spacing in tabs.ts
louisescher Dec 26, 2024
2628365
Remove leftover playground references
louisescher Dec 26, 2024
09c6000
Update astro version to 5.1.1 and typescript to 5.7.2
louisescher Dec 26, 2024
04928fd
Virtualize component scripts
louisescher Jan 14, 2025
abaf1a7
Update link for options documentation
louisescher Jan 14, 2025
2ffd4b1
Add ability to use custom CSS files for customization
louisescher Jan 15, 2025
be70bf5
Add accordion stuff
louisescher Jan 15, 2025
819f21b
Fix accordion logic
louisescher Jan 15, 2025
0832fd3
fix vite dep to conform to the rest of the StudioCMS Ecosystem (#37)
Adammatthiesen Jan 15, 2025
3ea97e6
Add accordion docs & finish component
louisescher Jan 16, 2025
45638fa
Allow for button to automatically render as anchor tag if href is passed
louisescher Jan 16, 2025
94ff475
Add badge to accordion in sidebar
louisescher Jan 16, 2025
5d74164
stuuuuuf
TheOtterlord Jan 16, 2025
f064ce6
Stuffs
louisescher Jan 16, 2025
b53742f
Add styles
louisescher Jan 16, 2025
8aa1a78
Merge changes
TheOtterlord Jan 16, 2025
ec25cd0
Ending conflicts and saving the world
TheOtterlord Jan 16, 2025
6ef4f32
Observe and update in response to theme change
TheOtterlord Jan 16, 2025
26a4a69
Format and add "no changes made" text
louisescher Jan 16, 2025
ca0262a
Final touches on dev toolbar app and docs for customization
louisescher Jan 16, 2025
d8ff9ff
Fix types on button component
louisescher Jan 16, 2025
7c82fa1
Update packages/studiocms_ui/src/integration.ts
louisescher Jan 16, 2025
d585bdf
Add astro-transition-event-polyfill integration, fix selects not work…
louisescher Jan 18, 2025
30861d2
Add progress component
louisescher Jan 20, 2025
1551861
Update upgrade guide from v0.3 to v0.4, remove deprecated file, and e…
louisescher Jan 20, 2025
b105144
Refactor ColorPicker to improve HSL to RGB conversion and streamline …
louisescher Jan 20, 2025
6a807e0
Dev Toolbar Debug
louisescher Jan 20, 2025
cecf414
Refactor ColorPicker HSL to RGB conversion for improved accuracy and …
louisescher Jan 20, 2025
515a581
Update custom color picker element's internal logic
louisescher Jan 20, 2025
a6ad31b
Fix color conversion
louisescher Jan 20, 2025
4e35b3a
Update astro-transition-event-polyfill to version 1.1.0; remove conso…
louisescher Jan 20, 2025
cfb43a0
Add build scripts and restructure UI components; remove unused files …
Adammatthiesen Jan 21, 2025
f321cf6
Finish upgrade guide and add sidebar docs
louisescher Jan 21, 2025
dd28fa8
Add changeset
louisescher Jan 21, 2025
98a1c33
Update changeset
louisescher Jan 21, 2025
83f4c19
Update OG image for docs
louisescher Jan 21, 2025
cde7de3
Update OG image URL
louisescher Jan 21, 2025
27d66c8
Fix toast icon always being blue
louisescher Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["ui-playground", "docs"]
"ignore": ["docs", "build-scripts"]
}
9 changes: 9 additions & 0 deletions .changeset/large-bikes-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@studiocms/ui": minor
---

Implement Build step and migrate all exported components into virtual modules

Instead of `@studiocms/ui/components` use `studiocms:ui/components`

For more information see https://ui.studiocms.dev
19 changes: 19 additions & 0 deletions .changeset/slimy-ladybugs-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@studiocms/ui": minor
---

Add a few new components:

- Accordion
- Badge
- Breadcrumbs
- Group
- Progress
- Sidebar

Add two new colors

- `info` (Blue)
- `monochrome` (Black/White)

Add the ability to pass a CSS file for customization of all colors
3 changes: 3 additions & 0 deletions .github/workflows/ci-pr-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:

- name: Install Tools & Dependencies
uses: withstudiocms/automations/.github/actions/install@main

- name: Build packages
run: pnpm ci:prepublish

- name: Publish packages
run: pnpm ci:snapshot
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
- name: Install Tools & Dependencies
uses: withstudiocms/automations/.github/actions/install@main

- name: Build packages
run: pnpm ci:prepublish

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@
"editor.gotoLocation.multipleDefinitions": "goto",
"cSpell.words": [
"astrojs",
"checkmark",
"createtoast",
"dismissable",
"Eleventy",
"fira",
"fontsource",
"frontmatter",
"heroicons",
"iconify",
"louisescher",
"Matthiesen",
"onest",
"pathe",
"polyline",
"searchselect",
"socialproof",
"studiocms",
"themetoggle",
"Thum",
"tsconfigs",
"vite",
"withstudiocms"
]
}
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn"
"noExplicitAny": "warn",
"noImplicitAnyLet": "info"
},
"style": {
"noNonNullAssertion": "off",
"noParameterAssign": "info",
"useSingleVarDeclarator": "info"
}
}
},
Expand Down
187 changes: 187 additions & 0 deletions build-scripts/cmd/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import { execSync } from 'node:child_process';
import fs from 'node:fs/promises';
import esbuild from 'esbuild';
import { copy } from 'esbuild-plugin-copy';
import glob from 'fast-glob';
import { dim, gray, green, red, yellow } from 'kleur/colors';

/** @type {import('esbuild').BuildOptions} */
const defaultConfig = {
minify: false,
format: 'esm',
platform: 'node',
target: 'node18',
sourcemap: false,
sourcesContent: false,
};

const dt = new Intl.DateTimeFormat('en-us', {
hour: '2-digit',
minute: '2-digit',
});

const dtsGen = (buildTsConfig) => ({
name: 'TypeScriptDeclarationsPlugin',
setup(build) {
build.onEnd((result) => {
if (result.errors.length > 0) return;
const date = dt.format(new Date());
console.log(`${dim(`[${date}]`)} Generating TypeScript declarations...`);
try {
const res = execSync(
`tsc --emitDeclarationOnly ${buildTsConfig ? '-p tsconfig.build.json' : ''} --outDir ./dist`
);
console.log(res.toString());
console.log(dim(`[${date}] `) + green('√ Generated TypeScript declarations'));
} catch (error) {
console.error(dim(`[${date}] `) + red(`${error}\n\n${error.stdout.toString()}`));
}
});
},
});

const CopyConfig = {
assets: [
{
from: ['./src/**/*.!(ts|js|css)'],
to: '.',
},
],
};

export default async function build(...args) {
const config = Object.assign({}, defaultConfig);
const isDev = args.slice(-1)[0] === 'IS_DEV';
const patterns = args
.filter((f) => !!f) // remove empty args
.map((f) => f.replace(/^'/, '').replace(/'$/, '')); // Needed for Windows: glob strings contain surrounding string chars??? remove these
const entryPoints = [].concat(
...(await Promise.all(
patterns.map((pattern) => glob(pattern, { filesOnly: true, absolute: true }))
))
);
const date = dt.format(new Date());

const noClean = args.includes('--no-clean-dist');
const bundle = args.includes('--bundle');
const forceCJS = args.includes('--force-cjs');
const buildTsConfig = args.includes('--build-tsconfig');

const { type = 'module', dependencies = {} } = await readPackageJSON('./package.json');

config.define = {};
for (const [key, value] of await getDefinedEntries()) {
config.define[`process.env.${key}`] = JSON.stringify(value);
}
const format = type === 'module' && !forceCJS ? 'esm' : 'cjs';

const outdir = 'dist';

if (!noClean) {
console.log(
`${dim(`[${date}]`)} Cleaning dist directory... ${dim(`(${entryPoints.length} files found)`)}`
);
await clean(outdir);
}

if (!isDev) {
console.log(
`${dim(`[${date}]`)} Building...${bundle ? '(Bundling)' : ''} ${dim(`(${entryPoints.length} files found)`)}`
);
await esbuild.build({
...config,
bundle,
external: bundle ? Object.keys(dependencies) : undefined,
entryPoints,
outdir,
outExtension: forceCJS ? { '.js': '.cjs' } : {},
format,
plugins: [copy(CopyConfig), dtsGen(buildTsConfig)],
});
console.log(dim(`[${date}] `) + green('√ Build Complete'));
return;
}

const rebuildPlugin = {
name: 'dev:rebuild',
setup(build) {
build.onEnd(async (result) => {
const date = dt.format(new Date());
if (result?.errors.length) {
console.error(dim(`[${date}] `) + red(error || result.errors.join('\n')));
} else {
if (result.warnings.length) {
console.info(
dim(`[${date}] `) + yellow(`! updated with warnings:\n${result.warnings.join('\n')}`)
);
}
console.info(dim(`[${date}] `) + green('√ updated'));
}
});
},
};

const builder = await esbuild.context({
...config,
entryPoints,
outdir,
format,
sourcemap: 'linked',
plugins: [copy(CopyConfig), rebuildPlugin, dtsGen(buildTsConfig)],
});

console.log(
`${dim(`[${date}] `) + gray('Watching for changes...')} ${dim(`(${entryPoints.length} files found)`)}`
);
await builder.watch();

process.on('beforeExit', () => {
builder.stop?.();
});
}

async function clean(outdir) {
const files = await glob([`${outdir}/**`], { filesOnly: true });
await Promise.all(files.map((file) => fs.rm(file, { force: true })));
}

/**
* Contextual `define` values to statically replace in the built JS output.
* Available to all packages, but mostly useful for CLIs like `create-astro`.
*/
async function getDefinedEntries() {
const define = {
/** The current version (at the time of building) for the current package, such as `astro` or `@astrojs/sitemap` */
PACKAGE_VERSION: await getInternalPackageVersion('./package.json'),
/** The current version (at the time of building) for `typescript` */
TYPESCRIPT_VERSION: await getWorkspacePackageVersion('typescript'),
};
for (const [key, value] of Object.entries(define)) {
if (value === undefined) {
delete define[key];
}
}
return Object.entries(define);
}

async function readPackageJSON(path) {
return await fs.readFile(path, { encoding: 'utf8' }).then((res) => JSON.parse(res));
}

async function getInternalPackageVersion(path) {
return readPackageJSON(path).then((res) => res.version);
}

async function getWorkspacePackageVersion(packageName) {
const { dependencies, devDependencies } = await readPackageJSON(
new URL('../../package.json', import.meta.url)
);
const deps = { ...dependencies, ...devDependencies };
const version = deps[packageName];
if (!version) {
throw new Error(
`Unable to resolve "${packageName}". Is it a dependency of the workspace root?`
);
}
return version.replace(/^\D+/, '');
}
14 changes: 14 additions & 0 deletions build-scripts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env node
export default async function run() {
const [cmd, ...args] = process.argv.slice(2);
switch (cmd) {
case 'dev':
case 'build': {
const { default: build } = await import('./cmd/build.js');
await build(...args, cmd === 'dev' ? 'IS_DEV' : undefined);
break;
}
}
}

run();
12 changes: 12 additions & 0 deletions build-scripts/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"declaration": true,
"strict": true,
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"target": "esnext"
}
}
19 changes: 19 additions & 0 deletions build-scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "build-scripts",
"version": "0.0.14",
"private": true,
"type": "module",
"main": "./index.js",
"bin": {
"build-scripts": "./index.js"
},
"dependencies": {
"esbuild": "^0.24.2",
"esbuild-plugin-copy": "^2.1.1",
"fast-glob": "^3.3.2",
"kleur": "^4.1.5",
"p-limit": "^6.1.0",
"tinyexec": "^0.3.1",
"tsconfck": "^3.1.4"
}
}
19 changes: 12 additions & 7 deletions docs/astro.config.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import starlight from '@astrojs/starlight';
import onestWoff2 from '@fontsource-variable/onest/files/onest-latin-wght-normal.woff2?url';
import ui from '@studiocms/ui';
import { defineConfig, envField } from 'astro/config';
import rehypePluginKit from './src/plugins/rehypePluginKit';

Expand Down Expand Up @@ -90,14 +91,14 @@ export default defineConfig({
tag: 'meta',
attrs: {
property: 'og:image',
content: `${site}og.png?v=2`,
content: `${site}og.png`,
},
},
{
tag: 'meta',
attrs: {
property: 'twitter:image',
content: `${site}og.png?v=2`,
content: `${site}og.png`,
},
},
{
Expand Down Expand Up @@ -158,10 +159,6 @@ export default defineConfig({
{
label: 'Installation',
link: 'docs/',
badge: {
text: 'Updated!',
variant: 'success',
},
},
{
label: 'Release Notes',
Expand All @@ -174,7 +171,14 @@ export default defineConfig({
],
},
{
label: 'Upgrade Guides',
label: 'Guides',
autogenerate: {
directory: 'docs/guides',
collapsed: true,
},
},
{
label: 'Upgrading StudioCMS',
autogenerate: {
directory: 'docs/upgrade-guides',
collapsed: true,
Expand All @@ -196,5 +200,6 @@ export default defineConfig({
},
],
}),
ui()
],
});
Binary file modified docs/public/og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading