Skip to content

Commit d95211a

Browse files
committed
refactor: panda v2
1 parent 28172bc commit d95211a

210 files changed

Lines changed: 5003 additions & 37573 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@fontsource-variable/source-code-pro": "^5.2.7",
4848
"@fontsource-variable/source-serif-4": "^5.2.9",
4949
"@ndla/types-backend": "^1.0.125",
50-
"@pandacss/dev": "^1.10.0",
50+
"@pandacss/dev": "^2.0.0-beta.3",
5151
"@storybook/addon-a11y": "^10.4.5",
5252
"@storybook/addon-docs": "^10.4.5",
5353
"@storybook/addon-links": "^10.4.5",

packages/audio-search/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": "tsdown",
1414
"dev": "tsdown --watch ./src",
1515
"build:types": "tsc -p tsconfig.build.json",
16-
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
16+
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --outfile dist/styles.css' 'panda buildinfo --outfile dist/panda.buildinfo.json'"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -39,7 +39,7 @@
3939
"devDependencies": {
4040
"@ndla/preset-panda": "workspace:^",
4141
"@ndla/types-backend": "^1.0.125",
42-
"@pandacss/dev": "^1.10.0"
42+
"@pandacss/dev": "^2.0.0-beta.3"
4343
},
4444
"peerDependencies": {
4545
"react": ">= 18",

packages/editor-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dev": "tsdown --watch ./src",
1616
"build:types": "tsc -p tsconfig.build.json",
1717
"prepublish": "concurrently 'yarn build:types' 'yarn build:panda'",
18-
"build:panda": "mkdir -p dist && concurrently 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
18+
"build:panda": "mkdir -p dist && concurrently 'panda cssgen --outfile dist/styles.css' 'panda buildinfo --outfile dist/panda.buildinfo.json'"
1919
},
2020
"repository": {
2121
"type": "git",
@@ -51,7 +51,7 @@
5151
},
5252
"devDependencies": {
5353
"@ndla/preset-panda": "workspace:^",
54-
"@pandacss/dev": "^1.10.0"
54+
"@pandacss/dev": "^2.0.0-beta.3"
5555
},
5656
"publishConfig": {
5757
"access": "public"

packages/editor-components/src/components/editor/ContentEditableFieldLabel.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
import { mergeProps } from "@ark-ui/react/utils";
1010
import { Label, useFieldContext, type LabelProps, type TextProps } from "@ndla/primitives";
11-
import { styled } from "@ndla/styled-system/jsx";
12-
import type { StyledProps } from "@ndla/styled-system/types";
11+
import { styled, type StyledProps } from "@ndla/styled-system/jsx";
1312
import type { HTMLProps } from "react";
1413

1514
interface Props extends TextProps, StyledProps, Omit<HTMLProps<HTMLParagraphElement>, "color" | "as"> {}

packages/icons/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "tsdown",
1515
"dev": "tsdown --watch ./src",
1616
"build:types": "tsc -p tsconfig.build.json",
17-
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
17+
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --outfile dist/styles.css' 'panda buildinfo --outfile dist/panda.buildinfo.json'"
1818
},
1919
"repository": {
2020
"type": "git",
@@ -36,7 +36,7 @@
3636
},
3737
"devDependencies": {
3838
"@ndla/preset-panda": "workspace:^",
39-
"@pandacss/dev": "^1.10.0"
39+
"@pandacss/dev": "^2.0.0-beta.3"
4040
},
4141
"peerDependencies": {
4242
"react": ">= 18",

packages/icons/src/Icon.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*
77
*/
88

9-
import { type RecipeVariantProps, cva, css } from "@ndla/styled-system/css";
10-
import { styled } from "@ndla/styled-system/jsx";
11-
import type { StyledProps } from "@ndla/styled-system/types";
9+
import { cva, css } from "@ndla/styled-system/css";
10+
import { styled, type StyledProps } from "@ndla/styled-system/jsx";
11+
import type { RecipeVariantProps } from "@ndla/styled-system/types";
1212
import { type ComponentPropsWithRef } from "react";
1313

1414
export const iconRecipe = cva({
@@ -40,7 +40,7 @@ export const iconRecipe = cva({
4040
},
4141
});
4242

43-
export type IconVariantProps = RecipeVariantProps<typeof iconRecipe>;
43+
export type IconVariantProps = NonNullable<RecipeVariantProps<typeof iconRecipe>>;
4444

4545
interface BaseIconProps extends ComponentPropsWithRef<"svg"> {
4646
title?: string;

packages/image-search/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build": "tsdown",
1414
"dev": "tsdown --watch ./src",
1515
"build:types": "tsc -p tsconfig.build.json",
16-
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
16+
"prepublish": "concurrently 'yarn build:types' 'mkdir -p dist' 'panda cssgen --outfile dist/styles.css' 'panda buildinfo --outfile dist/panda.buildinfo.json'"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -39,7 +39,7 @@
3939
"devDependencies": {
4040
"@ndla/preset-panda": "workspace:^",
4141
"@ndla/types-backend": "^1.0.125",
42-
"@pandacss/dev": "^1.10.0"
42+
"@pandacss/dev": "^2.0.0-beta.3"
4343
},
4444
"peerDependencies": {
4545
"react": ">= 18",

packages/preset-panda/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
],
3737
"dependencies": {
3838
"@ndla/core": "workspace:^",
39-
"@pandacss/dev": "^1.10.0"
39+
"@pandacss/dev": "^2.0.0-beta.3"
4040
},
4141
"publishConfig": {
4242
"access": "public"

packages/preset-panda/panda.config.ts

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
import { defineConfig } from "@pandacss/dev";
10-
import type { ArtifactContent, Artifact, ArtifactId } from "@pandacss/types";
1110
import preset from "./src";
11+
import { dualBuildPlugin } from "./src/plugins/dualBuildPlugin";
1212
import { forwardCssPropPlugin } from "./src/plugins/forwardCssPropPlugin";
1313

1414
export default defineConfig({
@@ -24,44 +24,5 @@ export default defineConfig({
2424
outdir: "../styled-system/src",
2525
jsxFramework: "react",
2626
syntax: "object-literal",
27-
plugins: [forwardCssPropPlugin()],
28-
hooks: {
29-
// We need to support both esm and cjs. This allows us to transpile the esm output to cjs. TODO: Remove this once we fully transition to esm.
30-
"codegen:prepare": async (config) => {
31-
const newArtifacts = config.artifacts.reduce<Artifact[]>((acc, artifact) => {
32-
if (artifact.id === "types-entry") {
33-
const indexFile = artifact.files.find((f) => f.file === "index.d.ts");
34-
if (indexFile?.code && !indexFile.code.includes("export * from './prop-type'")) {
35-
indexFile.code = indexFile.code.concat("\nexport * from './prop-type';");
36-
}
37-
}
38-
const [regularFiles, typeFiles] = artifact.files.reduce<[ArtifactContent[], ArtifactContent[]]>(
39-
(acc, curr) => {
40-
if (curr.file.endsWith("d.ts")) acc[1].push(curr);
41-
else acc[0].push(curr);
42-
43-
return acc;
44-
},
45-
[[], []],
46-
);
47-
48-
acc.push({
49-
...artifact,
50-
files: regularFiles.concat(typeFiles),
51-
});
52-
53-
acc.push({
54-
id: (artifact.id + "-types") as ArtifactId,
55-
dir: artifact.dir?.map((path, index) => (index === 1 ? path.replace("/src", "/lib") : path)),
56-
files: typeFiles,
57-
});
58-
59-
return acc;
60-
}, []);
61-
62-
config.artifacts = newArtifacts;
63-
64-
return config.artifacts;
65-
},
66-
},
27+
plugins: [forwardCssPropPlugin(), dualBuildPlugin],
6728
});

packages/preset-panda/src/boxShadows.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { css } from "@ndla/styled-system/css";
1010
import { styled } from "@ndla/styled-system/jsx";
11-
import type { ShadowToken } from "@ndla/styled-system/tokens";
11+
import type { ShadowToken } from "@ndla/styled-system/types";
1212
import type { Meta, StoryFn } from "@storybook/react";
1313

1414
const ShadowsContainer = styled("div", {

0 commit comments

Comments
 (0)