Skip to content

Commit

Permalink
fix storybook, type exports
Browse files Browse the repository at this point in the history
  • Loading branch information
00salmon committed Nov 24, 2023
1 parent 0ec3a3a commit 88f1b8e
Show file tree
Hide file tree
Showing 11 changed files with 11,510 additions and 15,457 deletions.
26,916 changes: 11,475 additions & 15,441 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions packages/react/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import { dirname, join } from "path";
module.exports = {
stories: ['../**/*.stories.@(ts|tsx|js|jsx)'],
addons: [],

// core: { builder: '@storybook/builder-vite' },
// https://storybook.js.org/docs/react/configure/typescript#mainjs-configuration
typescript: {
check: true, // type-check stories during Storybook build
},

framework: {
name: getAbsolutePath("@storybook/react-vite"),
options: {}
},

docs: {
autodocs: true
}
};

function getAbsolutePath(value) {
return dirname(require.resolve(join(value, "package.json")));
}
12 changes: 7 additions & 5 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"lint": "dts lint",
"size": "size-limit",
"analyze": "size-limit --why",
"storybook": "start-storybook -p 6007",
"build-storybook": "build-storybook"
"storybook": "storybook dev -p 6007 -c .storybook",
"storybook:build": "storybook build -c .storybook -o .out"
},
"peerDependencies": {
"react": "^16.13.0"
Expand Down Expand Up @@ -60,6 +60,7 @@
"dependencies": {
"@raisins/core": "^1.1.1",
"@raisins/schema": "^1.0.0",
"@storybook/cli": "^7.0.21",
"bunshi": "^2.0.2",
"css-tree": "^1.1.3",
"hotkeys-js": "^3.8.7",
Expand All @@ -82,9 +83,9 @@
"@babel/core": "^7.15.5",
"@mdx-js/react": "^2.1.1",
"@size-limit/preset-small-lib": "^5.0.4",
"@storybook/addons": "^6.4.22",
"@storybook/builder-vite": "^0.1.33",
"@storybook/react": "^6.4.22",
"@storybook/addons": "^7.0.21",
"@storybook/react": "^7.0.21",
"@storybook/react-vite": "^7.5.3",
"@testing-library/react-hooks": "^7.0.2",
"@types/css-tree": "^1.0.6",
"@types/jest": "^29.1.0",
Expand All @@ -110,6 +111,7 @@
"react-hooks-testing-library": "^0.6.0",
"react-is": "^17.0.2",
"size-limit": "^5.0.4",
"storybook": "^7.5.3",
"ts-jest": "^29.1.0",
"tslib": "^2.3.1",
"typescript": "^4.4.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/attributes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export {
} from './AttributeMolecule';
export {
AttributesController,
AttributesControllerProps,
} from './AttributesController';
export type { AttributesControllerProps,} from "./AttributesController"
export { AttributesMolecule } from './AttributesMolecule';
2 changes: 1 addition & 1 deletion packages/react/src/component-metamodel/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './ComponentModel';
export { modulesToDetails } from './convert/modulesToDetails';
export { Module, ModuleDetails } from './types';
export type { Module, ModuleDetails } from './types';
3 changes: 1 addition & 2 deletions packages/react/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ export { HistoryMolecule } from './editting/HistoryAtoms';
export {
ConfigMolecule,
ConfigScopeProvider,
RaisinConfig,
RaisinConfigMolecule,
RaisinsProvider,
} from './RaisinConfigScope';
export type { RaisinConfig, RaisinConfigMolecule } from './RaisinConfigScope';
export { SoulsMolecule } from './souls/Soul';
export { SoulsInDocMolecule } from './souls/SoulsInDocumentAtoms';
export * from './selection';
2 changes: 1 addition & 1 deletion packages/react/src/node/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export {
NodeChildrenEditor,
NodeChildrenEditorProps,
ChildrenEditorForAtoms,
} from './NodeChildrenEditor';
export type {NodeChildrenEditorProps} from './NodeChildrenEditor'
export { NodeMolecule } from './NodeMolecule';
export { NodeScopeMolecule, NodeScopeProvider } from './NodeScope';
export * from './slots';
2 changes: 2 additions & 0 deletions packages/react/src/node/slots/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export {
SlotChildrenController,
} from './SlotChildrenController';
export type {
SlotChildrenControllerProps,
} from './SlotChildrenController';
export {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/stylesheets/useStyleEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
} from '@raisins/core';
import * as css from 'css-tree';
import { useAtom } from 'jotai';
import { useMolecule } from 'bunshi/react';
import { useMemo, useState } from 'react';
import { CoreMolecule } from '../core/CoreAtoms';
import { StateUpdater } from '../util/NewState';
import { useMolecule } from 'bunshi/react';

const { IdentityVisitor, replace, visit } = htmlUtil;

Expand All @@ -28,7 +28,7 @@ export function useStyleEditor() {
const nodes: RaisinStyleNode[] = [];
visit(node, {
...IdentityVisitor,
onStyle: (n) => {
onStyle: n => {
nodes.push(n);
return n;
},
Expand All @@ -41,7 +41,7 @@ export function useStyleEditor() {
RaisinStyleNode | undefined
>(undefined);

const updateSelectedSheet: StateUpdater<css.CssNodePlain> = (next) => {
const updateSelectedSheet: StateUpdater<css.CssNodePlain> = next => {
setNode(
// @ts-ignore
(prev: RaisinDocumentNode) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/validation/ValidationMolecule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { molecule } from 'bunshi/react';
import { ComponentModelMolecule } from '../component-metamodel';
import { CoreMolecule } from '../core';

export const ValidationMolecule = molecule((getMol) => {
export const ValidationMolecule = molecule(getMol => {
const { RootNodeAtom } = getMol(CoreMolecule);
const MetaMolecule = getMol(ComponentModelMolecule);

const errorsAtom = atom((get) => {
const errorsAtom = atom(get => {
const root = get(RootNodeAtom);
const meta = get(MetaMolecule.ComponentsAtom);
const errorStack = validateNode(root, meta);
Expand Down
3 changes: 2 additions & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"forceConsistentCasingInFileNames": true,
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": true,
"downlevelIteration": true
"downlevelIteration": true,
"isolatedModules": true,
}
}

0 comments on commit 88f1b8e

Please sign in to comment.