@dxos/storybook-utils 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +10 -43
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +10 -43
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/decorators/index.d.ts +0 -1
- package/dist/types/src/decorators/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -10
- package/src/components/index.ts +0 -2
- package/src/decorators/index.ts +0 -1
- package/src/decorators/withLayout.tsx +1 -1
- package/src/index.ts +0 -2
- package/src/stories/test/Test.stories.tsx +1 -1
- package/dist/types/src/components/ThemeEditor.d.ts +0 -5
- package/dist/types/src/components/ThemeEditor.d.ts.map +0 -1
- package/dist/types/src/decorators/withThemeEditor.d.ts +0 -6
- package/dist/types/src/decorators/withThemeEditor.d.ts.map +0 -1
- package/dist/types/src/util.d.ts +0 -6
- package/dist/types/src/util.d.ts.map +0 -1
- package/src/components/ThemeEditor.tsx +0 -18
- package/src/decorators/withThemeEditor.tsx +0 -28
- package/src/util.tsx +0 -15
|
@@ -1,62 +1,29 @@
|
|
|
1
|
-
// src/components/ThemeEditor.tsx
|
|
2
|
-
import React, { memo } from "react";
|
|
3
|
-
import { DxThemeEditor as NaturalDxThemeEditor } from "@dxos/lit-theme-editor";
|
|
4
|
-
import { createComponent } from "@dxos/lit-ui/react";
|
|
5
|
-
import "@dxos/lit-theme-editor/dx-theme-editor.pcss";
|
|
6
|
-
var DxThemeEditor = createComponent({
|
|
7
|
-
tagName: "dx-theme-editor",
|
|
8
|
-
elementClass: NaturalDxThemeEditor,
|
|
9
|
-
react: React
|
|
10
|
-
});
|
|
11
|
-
var ThemeEditor = /* @__PURE__ */ memo(DxThemeEditor);
|
|
12
|
-
|
|
13
1
|
// src/decorators/withLayout.tsx
|
|
14
|
-
import
|
|
2
|
+
import React from "react";
|
|
15
3
|
var withLayout = (Story, context) => {
|
|
16
4
|
switch (context.parameters.layout) {
|
|
17
5
|
case "fullscreen":
|
|
18
|
-
return /* @__PURE__ */
|
|
6
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
19
7
|
role: "none",
|
|
20
|
-
className: "fixed inset-0 flex flex-col overflow-hidden bg-
|
|
21
|
-
}, /* @__PURE__ */
|
|
8
|
+
className: "fixed inset-0 flex flex-col overflow-hidden bg-base-surface"
|
|
9
|
+
}, /* @__PURE__ */ React.createElement(Story, null));
|
|
22
10
|
default:
|
|
23
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Story, null);
|
|
24
12
|
}
|
|
25
13
|
};
|
|
26
14
|
|
|
27
15
|
// src/decorators/withRegistry.tsx
|
|
28
16
|
import { Registry, RegistryContext } from "@effect-atom/atom-react";
|
|
29
|
-
import
|
|
17
|
+
import React2, { memo, useMemo } from "react";
|
|
30
18
|
var withRegistry = (Story) => {
|
|
31
19
|
const registry = useMemo(() => Registry.make(), []);
|
|
32
|
-
const MemoizedStory = /* @__PURE__ */
|
|
33
|
-
return /* @__PURE__ */
|
|
20
|
+
const MemoizedStory = /* @__PURE__ */ memo(Story);
|
|
21
|
+
return /* @__PURE__ */ React2.createElement(RegistryContext.Provider, {
|
|
34
22
|
value: registry
|
|
35
|
-
}, /* @__PURE__ */
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// src/decorators/withThemeEditor.tsx
|
|
39
|
-
import React4, { memo as memo3 } from "react";
|
|
40
|
-
var withThemeEditor = (Story, context) => {
|
|
41
|
-
const MemoizedStory = /* @__PURE__ */ memo3(Story);
|
|
42
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(MemoizedStory, null), /* @__PURE__ */ React4.createElement("div", {
|
|
43
|
-
className: "absolute top-4 bottom-4 right-4 z-10"
|
|
44
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
45
|
-
className: "bs-full is-[35rem] overflow-auto bg-baseSurface border border-separator rounded"
|
|
46
|
-
}, /* @__PURE__ */ React4.createElement(ThemeEditor, null))));
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// src/util.tsx
|
|
50
|
-
import React5 from "react";
|
|
51
|
-
var render = (Story) => (args) => {
|
|
52
|
-
const result = /* @__PURE__ */ React5.createElement(Story, args);
|
|
53
|
-
return result ?? /* @__PURE__ */ React5.createElement("div", null);
|
|
23
|
+
}, /* @__PURE__ */ React2.createElement(MemoizedStory, null));
|
|
54
24
|
};
|
|
55
25
|
export {
|
|
56
|
-
ThemeEditor,
|
|
57
|
-
render,
|
|
58
26
|
withLayout,
|
|
59
|
-
withRegistry
|
|
60
|
-
withThemeEditor
|
|
27
|
+
withRegistry
|
|
61
28
|
};
|
|
62
29
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": ["React", "
|
|
3
|
+
"sources": ["../../../src/decorators/withLayout.tsx", "../../../src/decorators/withRegistry.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React from 'react';\n\nexport const withLayout: Decorator = (Story, context) => {\n switch (context.parameters.layout) {\n case 'fullscreen':\n return (\n <div role='none' className='fixed inset-0 flex flex-col overflow-hidden bg-base-surface'>\n <Story />\n </div>\n );\n\n default:\n return <Story />;\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Registry, RegistryContext } from '@effect-atom/atom-react';\nimport { type Decorator } from '@storybook/react';\nimport React, { memo, useMemo } from 'react';\n\n/**\n * Adds Effect Atom registry context for storybook.\n */\nexport const withRegistry: Decorator = (Story) => {\n const registry = useMemo(() => Registry.make(), []);\n\n // Prevent re-rendering of the story.\n const MemoizedStory = memo(Story);\n\n return (\n <RegistryContext.Provider value={registry}>\n <MemoizedStory />\n </RegistryContext.Provider>\n );\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,OAAOA,WAAW;AAEX,IAAMC,aAAwB,CAACC,OAAOC,YAAAA;AAC3C,UAAQA,QAAQC,WAAWC,QAAM;IAC/B,KAAK;AACH,aACE,sBAAA,cAACC,OAAAA;QAAIC,MAAK;QAAOC,WAAU;SACzB,sBAAA,cAACN,OAAAA,IAAAA,CAAAA;IAIP;AACE,aAAO,sBAAA,cAACA,OAAAA,IAAAA;EACZ;AACF;;;ACfA,SAASO,UAAUC,uBAAuB;AAE1C,OAAOC,UAASC,MAAMC,eAAe;AAK9B,IAAMC,eAA0B,CAACC,UAAAA;AACtC,QAAMC,WAAWC,QAAQ,MAAMC,SAASC,KAAI,GAAI,CAAA,CAAE;AAGlD,QAAMC,gBAAgBC,qBAAKN,KAAAA;AAE3B,SACE,gBAAAO,OAAA,cAACC,gBAAgBC,UAAQ;IAACC,OAAOT;KAC/B,gBAAAM,OAAA,cAACF,eAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["React", "withLayout", "Story", "context", "parameters", "layout", "div", "role", "className", "Registry", "RegistryContext", "React", "memo", "useMemo", "withRegistry", "Story", "registry", "useMemo", "Registry", "make", "MemoizedStory", "memo", "React", "RegistryContext", "Provider", "value"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/
|
|
1
|
+
{"inputs":{"src/decorators/withLayout.tsx":{"bytes":1804,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/decorators/withRegistry.tsx":{"bytes":2217,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/decorators/index.ts":{"bytes":575,"imports":[{"path":"src/decorators/withLayout.tsx","kind":"import-statement","original":"./withLayout"},{"path":"src/decorators/withRegistry.tsx","kind":"import-statement","original":"./withRegistry"}],"format":"esm"},"src/index.ts":{"bytes":464,"imports":[{"path":"src/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2027},"dist/lib/browser/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["withLayout","withRegistry"],"entryPoint":"src/index.ts","inputs":{"src/decorators/withLayout.tsx":{"bytesInOutput":432},"src/decorators/index.ts":{"bytesInOutput":0},"src/decorators/withRegistry.tsx":{"bytesInOutput":418},"src/index.ts":{"bytesInOutput":0}},"bytes":995}}}
|
|
@@ -1,64 +1,31 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// src/components/ThemeEditor.tsx
|
|
4
|
-
import React, { memo } from "react";
|
|
5
|
-
import { DxThemeEditor as NaturalDxThemeEditor } from "@dxos/lit-theme-editor";
|
|
6
|
-
import { createComponent } from "@dxos/lit-ui/react";
|
|
7
|
-
import "@dxos/lit-theme-editor/dx-theme-editor.pcss";
|
|
8
|
-
var DxThemeEditor = createComponent({
|
|
9
|
-
tagName: "dx-theme-editor",
|
|
10
|
-
elementClass: NaturalDxThemeEditor,
|
|
11
|
-
react: React
|
|
12
|
-
});
|
|
13
|
-
var ThemeEditor = /* @__PURE__ */ memo(DxThemeEditor);
|
|
14
|
-
|
|
15
3
|
// src/decorators/withLayout.tsx
|
|
16
|
-
import
|
|
4
|
+
import React from "react";
|
|
17
5
|
var withLayout = (Story, context) => {
|
|
18
6
|
switch (context.parameters.layout) {
|
|
19
7
|
case "fullscreen":
|
|
20
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
21
9
|
role: "none",
|
|
22
|
-
className: "fixed inset-0 flex flex-col overflow-hidden bg-
|
|
23
|
-
}, /* @__PURE__ */
|
|
10
|
+
className: "fixed inset-0 flex flex-col overflow-hidden bg-base-surface"
|
|
11
|
+
}, /* @__PURE__ */ React.createElement(Story, null));
|
|
24
12
|
default:
|
|
25
|
-
return /* @__PURE__ */
|
|
13
|
+
return /* @__PURE__ */ React.createElement(Story, null);
|
|
26
14
|
}
|
|
27
15
|
};
|
|
28
16
|
|
|
29
17
|
// src/decorators/withRegistry.tsx
|
|
30
18
|
import { Registry, RegistryContext } from "@effect-atom/atom-react";
|
|
31
|
-
import
|
|
19
|
+
import React2, { memo, useMemo } from "react";
|
|
32
20
|
var withRegistry = (Story) => {
|
|
33
21
|
const registry = useMemo(() => Registry.make(), []);
|
|
34
|
-
const MemoizedStory = /* @__PURE__ */
|
|
35
|
-
return /* @__PURE__ */
|
|
22
|
+
const MemoizedStory = /* @__PURE__ */ memo(Story);
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(RegistryContext.Provider, {
|
|
36
24
|
value: registry
|
|
37
|
-
}, /* @__PURE__ */
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// src/decorators/withThemeEditor.tsx
|
|
41
|
-
import React4, { memo as memo3 } from "react";
|
|
42
|
-
var withThemeEditor = (Story, context) => {
|
|
43
|
-
const MemoizedStory = /* @__PURE__ */ memo3(Story);
|
|
44
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(MemoizedStory, null), /* @__PURE__ */ React4.createElement("div", {
|
|
45
|
-
className: "absolute top-4 bottom-4 right-4 z-10"
|
|
46
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
47
|
-
className: "bs-full is-[35rem] overflow-auto bg-baseSurface border border-separator rounded"
|
|
48
|
-
}, /* @__PURE__ */ React4.createElement(ThemeEditor, null))));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// src/util.tsx
|
|
52
|
-
import React5 from "react";
|
|
53
|
-
var render = (Story) => (args) => {
|
|
54
|
-
const result = /* @__PURE__ */ React5.createElement(Story, args);
|
|
55
|
-
return result ?? /* @__PURE__ */ React5.createElement("div", null);
|
|
25
|
+
}, /* @__PURE__ */ React2.createElement(MemoizedStory, null));
|
|
56
26
|
};
|
|
57
27
|
export {
|
|
58
|
-
ThemeEditor,
|
|
59
|
-
render,
|
|
60
28
|
withLayout,
|
|
61
|
-
withRegistry
|
|
62
|
-
withThemeEditor
|
|
29
|
+
withRegistry
|
|
63
30
|
};
|
|
64
31
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;
|
|
6
|
-
"names": ["React", "
|
|
3
|
+
"sources": ["../../../src/decorators/withLayout.tsx", "../../../src/decorators/withRegistry.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React from 'react';\n\nexport const withLayout: Decorator = (Story, context) => {\n switch (context.parameters.layout) {\n case 'fullscreen':\n return (\n <div role='none' className='fixed inset-0 flex flex-col overflow-hidden bg-base-surface'>\n <Story />\n </div>\n );\n\n default:\n return <Story />;\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Registry, RegistryContext } from '@effect-atom/atom-react';\nimport { type Decorator } from '@storybook/react';\nimport React, { memo, useMemo } from 'react';\n\n/**\n * Adds Effect Atom registry context for storybook.\n */\nexport const withRegistry: Decorator = (Story) => {\n const registry = useMemo(() => Registry.make(), []);\n\n // Prevent re-rendering of the story.\n const MemoizedStory = memo(Story);\n\n return (\n <RegistryContext.Provider value={registry}>\n <MemoizedStory />\n </RegistryContext.Provider>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;AAKA,OAAOA,WAAW;AAEX,IAAMC,aAAwB,CAACC,OAAOC,YAAAA;AAC3C,UAAQA,QAAQC,WAAWC,QAAM;IAC/B,KAAK;AACH,aACE,sBAAA,cAACC,OAAAA;QAAIC,MAAK;QAAOC,WAAU;SACzB,sBAAA,cAACN,OAAAA,IAAAA,CAAAA;IAIP;AACE,aAAO,sBAAA,cAACA,OAAAA,IAAAA;EACZ;AACF;;;ACfA,SAASO,UAAUC,uBAAuB;AAE1C,OAAOC,UAASC,MAAMC,eAAe;AAK9B,IAAMC,eAA0B,CAACC,UAAAA;AACtC,QAAMC,WAAWC,QAAQ,MAAMC,SAASC,KAAI,GAAI,CAAA,CAAE;AAGlD,QAAMC,gBAAgBC,qBAAKN,KAAAA;AAE3B,SACE,gBAAAO,OAAA,cAACC,gBAAgBC,UAAQ;IAACC,OAAOT;KAC/B,gBAAAM,OAAA,cAACF,eAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["React", "withLayout", "Story", "context", "parameters", "layout", "div", "role", "className", "Registry", "RegistryContext", "React", "memo", "useMemo", "withRegistry", "Story", "registry", "useMemo", "Registry", "make", "MemoizedStory", "memo", "React", "RegistryContext", "Provider", "value"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/
|
|
1
|
+
{"inputs":{"src/decorators/withLayout.tsx":{"bytes":1804,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/decorators/withRegistry.tsx":{"bytes":2217,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/decorators/index.ts":{"bytes":575,"imports":[{"path":"src/decorators/withLayout.tsx","kind":"import-statement","original":"./withLayout"},{"path":"src/decorators/withRegistry.tsx","kind":"import-statement","original":"./withRegistry"}],"format":"esm"},"src/index.ts":{"bytes":464,"imports":[{"path":"src/decorators/index.ts","kind":"import-statement","original":"./decorators"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2029},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["withLayout","withRegistry"],"entryPoint":"src/index.ts","inputs":{"src/decorators/withLayout.tsx":{"bytesInOutput":432},"src/decorators/index.ts":{"bytesInOutput":0},"src/decorators/withRegistry.tsx":{"bytesInOutput":418},"src/index.ts":{"bytesInOutput":0}},"bytes":1088}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/decorators/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
|