@dxos/react-ui-stack 0.6.11-staging.e6894a4 → 0.6.12-main.5cc132e
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 +2 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +2 -2
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +375 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +159 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/CaretDownUp.d.ts.map +1 -1
- package/dist/types/src/components/ContentTypes.stories.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/TableContent.d.ts.map +1 -1
- package/package.json +22 -19
- package/src/components/CaretDownUp.tsx +1 -0
- package/src/components/ContentTypes.stories.tsx +11 -14
- package/src/components/Section.tsx +3 -3
- package/src/components/Stack.stories.tsx +3 -3
- package/src/playwright/playwright.config.ts +13 -2
- package/src/playwright/smoke.spec.ts +9 -17
- package/src/testing/EditorContent.tsx +1 -1
- package/src/testing/TableContent.tsx +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/testing/generator.ts", "../../../../src/testing/stack-manager.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\n// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/react-ui/testing.\n\n// TODO(burdon): Bug when adding stale objects to space (e.g., static objects already added in previous story invocation).\n\nimport { S, create, type EchoReactiveObject } from '@dxos/echo-schema';\nimport { faker } from '@dxos/random';\n\n// TODO(burdon): Util.\nexport const range = <T>(fn: (i: number) => T | undefined, length: number): T[] =>\n Array.from({ length })\n .map((_, i) => fn(i))\n .filter(Boolean) as T[];\n\n// TODO(burdon): Commit to using ECHO to generate all test data? Or convert from raw data?\nexport type TestItem = { id: string; type: string } & Record<string, any>;\n\ntype ObjectDataGenerator = {\n createSchema?: () => S.Schema<any>;\n createData: () => any;\n};\n\ntype ObjectFactory<T extends EchoReactiveObject<any>> = {\n schema?: S.Schema<any>; // TODO(burdon): Support both typed and expando schema.\n createObject: () => T;\n};\n\ntype ObjectFactoryMap = { [type: string]: ObjectFactory<any> };\n\nconst createFactory = ({ createSchema, createData }: ObjectDataGenerator) => {\n const schema = createSchema?.();\n return {\n schema,\n createObject: () => (schema ? create(schema, createData()) : create(createData())),\n };\n};\n\n// TODO(burdon): Handle restricted values.\nexport const Status = ['pending', 'active', 'done'];\nexport const Priority = [1, 2, 3, 4, 5];\n\nexport const defaultGenerators: { [type: string]: ObjectDataGenerator } = {\n document: {\n createData: () => ({\n title: faker.lorem.sentence(3),\n body: faker.lorem.sentences({ min: 1, max: faker.number.int({ min: 1, max: 3 }) }),\n }),\n },\n\n image: {\n createData: () => ({\n title: faker.lorem.sentence(3),\n image: faker.helpers.arrayElement(data.images),\n body: faker.datatype.boolean() ? faker.lorem.sentences() : undefined,\n }),\n },\n\n project: {\n createSchema: () =>\n S.Struct({\n title: S.String,\n repo: S.String,\n status: S.String,\n priority: S.Number,\n }),\n createData: () => ({\n title: faker.commerce.productName(),\n repo: faker.datatype.boolean({ probability: 0.3 }) ? faker.internet.url() : undefined,\n status: faker.helpers.arrayElement(Status),\n priority: faker.helpers.arrayElement(Priority),\n }),\n },\n};\n\n/**\n * Typed object generator.\n * @deprecated\n */\n// TODO(wittjosiah): Remove.\nexport class TestObjectGenerator {\n public readonly factories: ObjectFactoryMap;\n\n constructor({ types, factories }: { types?: string[]; factories?: ObjectFactoryMap } = {}) {\n this.factories =\n factories ??\n (types ?? Object.keys(defaultGenerators)).reduce<ObjectFactoryMap>((acc, type) => {\n acc[type] = createFactory(defaultGenerators[type]);\n return acc;\n }, {});\n }\n\n get schema(): S.Schema<any>[] {\n return Object.values(this.factories).map((f) => f.schema!);\n }\n\n createObject({ types }: { types?: string[] } = {}) {\n const type = faker.helpers.arrayElement(types ?? Object.keys(this.factories));\n const factory = this.factories[type];\n return factory?.createObject();\n }\n\n createObjects({ types, length }: { types?: string[]; length: number }) {\n return range(() => this.createObject({ types }), length);\n }\n}\n\n// https://unsplash.com\n// TODO(burdon): Use https://picsum.photos?\nconst data = {\n images: [\n '/images/image-1.png',\n '/images/image-2.png',\n '/images/image-3.png',\n '/images/image-4.png',\n '/images/image-5.png',\n '/images/image-6.png',\n ],\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Locator, Page } from '@playwright/test';\n\nexport class StackManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n empty() {\n return this.locator.getByTestId('stack.empty');\n }\n\n sections() {\n return this.locator.locator('li');\n }\n\n order() {\n return this.locator.locator('li').evaluateAll((els) => els.map((el) => el.getAttribute('id')));\n }\n\n section(index: number) {\n return new SectionManager(this.locator.locator('li').nth(index));\n }\n}\n\nexport class SectionManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n async id() {\n return this.locator.getAttribute('id');\n }\n\n async remove() {\n await this.locator.getByTestId('section.drag-handle-menu-trigger').click();\n await this._page.getByTestId('section.remove').click();\n }\n\n async navigateTo() {\n await this.locator.getByTestId('section.drag-handle-menu-trigger').click();\n await this._page.getByTestId('section.navigate-to').click();\n }\n\n async dragTo(target: Locator, offset: { x: number; y: number } = { x: 0, y: 0 }) {\n const active = this.locator.getByTestId('section.drag-handle-menu-trigger');\n const box = await target.boundingBox();\n if (box) {\n await active.hover();\n await this._page.mouse.down();\n // Timeouts are for input discretization in WebKit\n await this._page.waitForTimeout(100);\n await this._page.pause();\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n await this._page.pause();\n await this._page.waitForTimeout(100);\n await this._page.mouse.up();\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAQA,SAASA,GAAGC,cAAuC;AACnD,SAASC,aAAa;AAGf,IAAMC,QAAQ,CAAIC,IAAkCC,WACzDC,MAAMC,KAAK;EAAEF;AAAO,CAAA,EACjBG,IAAI,CAACC,GAAGC,MAAMN,GAAGM,CAAAA,CAAAA,EACjBC,OAAOC,OAAAA;AAiBZ,IAAMC,gBAAgB,CAAC,EAAEC,cAAcC,WAAU,MAAuB;AACtE,QAAMC,SAASF,eAAAA;AACf,SAAO;IACLE;IACAC,cAAc,MAAOD,SAASE,OAAOF,QAAQD,WAAAA,CAAAA,IAAgBG,OAAOH,WAAAA,CAAAA;EACtE;AACF;AAGO,IAAMI,SAAS;EAAC;EAAW;EAAU;;AACrC,IAAMC,WAAW;EAAC;EAAG;EAAG;EAAG;EAAG;;AAE9B,IAAMC,oBAA6D;EACxEC,UAAU;IACRP,YAAY,OAAO;MACjBQ,OAAOC,MAAMC,MAAMC,SAAS,CAAA;MAC5BC,MAAMH,MAAMC,MAAMG,UAAU;QAAEC,KAAK;QAAGC,KAAKN,MAAMO,OAAOC,IAAI;UAAEH,KAAK;UAAGC,KAAK;QAAE,CAAA;MAAG,CAAA;IAClF;EACF;EAEAG,OAAO;IACLlB,YAAY,OAAO;MACjBQ,OAAOC,MAAMC,MAAMC,SAAS,CAAA;MAC5BO,OAAOT,MAAMU,QAAQC,aAAaC,KAAKC,MAAM;MAC7CV,MAAMH,MAAMc,SAASC,QAAO,IAAKf,MAAMC,MAAMG,UAAS,IAAKY;IAC7D;EACF;EAEAC,SAAS;IACP3B,cAAc,MACZ4B,EAAEC,OAAO;MACPpB,OAAOmB,EAAEE;MACTC,MAAMH,EAAEE;MACRE,QAAQJ,EAAEE;MACVG,UAAUL,EAAEM;IACd,CAAA;IACFjC,YAAY,OAAO;MACj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AM,KAAKnC,MAAM+B,MAAK;AACtB,YAAM,KAAK/B,MAAM8B,eAAe,GAAA;AAChC,YAAM,KAAK9B,MAAM4B,MAAMQ,GAAE;IAC3B;EACF;AACF;",
|
|
6
|
+
"names": ["S", "create", "faker", "range", "fn", "length", "Array", "from", "map", "_", "i", "filter", "Boolean", "createFactory", "createSchema", "createData", "schema", "createObject", "create", "Status", "Priority", "defaultGenerators", "document", "title", "faker", "lorem", "sentence", "body", "sentences", "min", "max", "number", "int", "image", "helpers", "arrayElement", "data", "images", "datatype", "boolean", "undefined", "project", "S", "Struct", "String", "repo", "status", "priority", "Number", "commerce", "productName", "probability", "internet", "url", "TestObjectGenerator", "constructor", "types", "factories", "Object", "keys", "reduce", "acc", "type", "values", "f", "factory", "createObjects", "StackManager", "constructor", "locator", "_page", "page", "empty", "getByTestId", "sections", "order", "evaluateAll", "els", "map", "el", "getAttribute", "section", "index", "SectionManager", "nth", "id", "remove", "click", "navigateTo", "dragTo", "target", "offset", "x", "y", "active", "box", "boundingBox", "hover", "mouse", "down", "waitForTimeout", "pause", "move", "width", "height", "steps", "up"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaretDownUp.d.ts","sourceRoot":"","sources":["../../../../src/components/CaretDownUp.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaretDownUp.d.ts","sourceRoot":"","sources":["../../../../src/components/CaretDownUp.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,WAAW,mCAAoC,SAAS,sBAuBpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentTypes.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ContentTypes.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ContentTypes.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ContentTypes.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,WAAW,CAAC;;;2BAiB5B;QAAE,KAAK,EAAE,gBAAgB,EAAE,CAAA;KAAE;;;AAcxE,wBAIE;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;CAUnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAelB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyB5B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export default
|
|
1
|
+
declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
|
|
2
|
+
export default _default;
|
|
3
3
|
//# sourceMappingURL=playwright.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableContent.d.ts","sourceRoot":"","sources":["../../../../src/testing/TableContent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TableContent.d.ts","sourceRoot":"","sources":["../../../../src/testing/TableContent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AA8BF,eAAO,MAAM,WAAW,cAAe,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,KAAG,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,EAqCzF,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,MAAM,WAWtC,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,CAAC;AAEjG,eAAO,MAAM,YAAY,gCAAiC;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,sBAMpF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-stack",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12-main.5cc132e",
|
|
4
4
|
"description": "A stack component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,14 +10,16 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"node": {
|
|
13
|
-
"
|
|
13
|
+
"require": "./dist/lib/node/index.cjs",
|
|
14
|
+
"default": "./dist/lib/node-esm/index.mjs"
|
|
14
15
|
},
|
|
15
16
|
"types": "./dist/types/src/index.d.ts"
|
|
16
17
|
},
|
|
17
18
|
"./testing": {
|
|
18
19
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
19
20
|
"node": {
|
|
20
|
-
"
|
|
21
|
+
"require": "./dist/lib/node/testing/index.cjs",
|
|
22
|
+
"default": "./dist/lib/node-esm/testing/index.mjs"
|
|
21
23
|
},
|
|
22
24
|
"types": "./dist/types/src/testing/index.d.ts"
|
|
23
25
|
}
|
|
@@ -43,11 +45,11 @@
|
|
|
43
45
|
"@radix-ui/react-menu": "^2.0.6",
|
|
44
46
|
"@radix-ui/react-use-controllable-state": "^1.0.0",
|
|
45
47
|
"react-resize-detector": "^11.0.1",
|
|
46
|
-
"@dxos/react-ui": "0.6.
|
|
47
|
-
"@dxos/react-ui-
|
|
48
|
-
"@dxos/react-ui-
|
|
49
|
-
"@dxos/react-ui-
|
|
50
|
-
"@dxos/react-ui-
|
|
48
|
+
"@dxos/react-ui": "0.6.12-main.5cc132e",
|
|
49
|
+
"@dxos/react-ui-deck": "0.6.12-main.5cc132e",
|
|
50
|
+
"@dxos/react-ui-attention": "0.6.12-main.5cc132e",
|
|
51
|
+
"@dxos/react-ui-mosaic": "0.6.12-main.5cc132e",
|
|
52
|
+
"@dxos/react-ui-theme": "0.6.12-main.5cc132e"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -55,22 +57,23 @@
|
|
|
55
57
|
"@types/react-dom": "~18.2.0",
|
|
56
58
|
"react": "~18.2.0",
|
|
57
59
|
"react-dom": "~18.2.0",
|
|
58
|
-
"vite": "
|
|
59
|
-
"@dxos/client": "0.6.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui-
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
60
|
+
"vite": "5.4.7",
|
|
61
|
+
"@dxos/client": "0.6.12-main.5cc132e",
|
|
62
|
+
"@dxos/random": "0.6.12-main.5cc132e",
|
|
63
|
+
"@dxos/echo-schema": "0.6.12-main.5cc132e",
|
|
64
|
+
"@dxos/react-ui-editor": "0.6.12-main.5cc132e",
|
|
65
|
+
"@dxos/react-ui-table": "0.6.12-main.5cc132e",
|
|
66
|
+
"@dxos/test-utils": "0.6.12-main.5cc132e",
|
|
67
|
+
"@dxos/storybook-utils": "0.6.12-main.5cc132e",
|
|
68
|
+
"@dxos/util": "0.6.12-main.5cc132e"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
68
71
|
"@phosphor-icons/react": "^2.1.5",
|
|
69
72
|
"react": "^18.0.0",
|
|
70
73
|
"react-dom": "^18.0.0",
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/random": "0.6.
|
|
74
|
+
"@dxos/echo-schema": "0.6.12-main.5cc132e",
|
|
75
|
+
"@dxos/client": "0.6.12-main.5cc132e",
|
|
76
|
+
"@dxos/random": "0.6.12-main.5cc132e"
|
|
74
77
|
},
|
|
75
78
|
"publishConfig": {
|
|
76
79
|
"access": "public"
|
|
@@ -7,9 +7,8 @@ import '@dxos-theme';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
|
|
9
9
|
import { faker } from '@dxos/random';
|
|
10
|
-
import { Tooltip } from '@dxos/react-ui';
|
|
11
10
|
import { Mosaic } from '@dxos/react-ui-mosaic';
|
|
12
|
-
import { withTheme } from '@dxos/storybook-utils';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
13
12
|
|
|
14
13
|
import type { StackSectionContent, StackSectionItem } from './Section';
|
|
15
14
|
import { Stack, type StackProps } from './Stack';
|
|
@@ -30,24 +29,22 @@ const ContentTypeDelegator: StackProps['SectionContent'] = (section: { data: Sta
|
|
|
30
29
|
|
|
31
30
|
const ContentTypesStoryStack = ({ items }: { items: StackSectionItem[] }) => {
|
|
32
31
|
return (
|
|
33
|
-
<
|
|
34
|
-
<Mosaic.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</Mosaic.Root>
|
|
43
|
-
</Tooltip.Provider>
|
|
32
|
+
<Mosaic.Root>
|
|
33
|
+
<Mosaic.DragOverlay />
|
|
34
|
+
<Stack
|
|
35
|
+
id='stack-editors'
|
|
36
|
+
SectionContent={ContentTypeDelegator}
|
|
37
|
+
items={items}
|
|
38
|
+
classNames='max-is-[min(100dvw,60rem)]'
|
|
39
|
+
/>
|
|
40
|
+
</Mosaic.Root>
|
|
44
41
|
);
|
|
45
42
|
};
|
|
46
43
|
|
|
47
44
|
export default {
|
|
48
45
|
title: 'react-ui-stack/ContentTypes',
|
|
49
46
|
component: ContentTypesStoryStack,
|
|
50
|
-
decorators: [withTheme],
|
|
47
|
+
decorators: [withTheme, withLayout({ tooltips: true })],
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
export const Editors = {
|
|
@@ -158,7 +158,7 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
158
158
|
});
|
|
159
159
|
const sectionContentGroup = useFocusableGroup({});
|
|
160
160
|
const attendableAttrs = createAttendableAttributes(id);
|
|
161
|
-
const
|
|
161
|
+
const hasAttention = useHasAttention(id);
|
|
162
162
|
|
|
163
163
|
return (
|
|
164
164
|
<CollapsiblePrimitive.Root
|
|
@@ -180,10 +180,10 @@ export const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTM
|
|
|
180
180
|
role='none'
|
|
181
181
|
className={mx(
|
|
182
182
|
'grid col-span-2 grid-cols-subgrid',
|
|
183
|
-
'bg-base focus-within:border-separator focus-within:
|
|
183
|
+
'bg-base focus-within:border-separator focus-within:attention-within',
|
|
184
184
|
hoverableControls,
|
|
185
185
|
hoverableFocusedWithinControls,
|
|
186
|
-
(active ||
|
|
186
|
+
(active || hasAttention) && 'attention-surface border-separator',
|
|
187
187
|
(active === 'origin' || active === 'rearrange' || active === 'destination') && 'opacity-0',
|
|
188
188
|
)}
|
|
189
189
|
>
|
|
@@ -11,7 +11,7 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
11
11
|
|
|
12
12
|
import { faker } from '@dxos/random';
|
|
13
13
|
import { Mosaic, type MosaicDropEvent, type MosaicMoveEvent, type MosaicOperation, Path } from '@dxos/react-ui-mosaic';
|
|
14
|
-
import {
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
15
15
|
|
|
16
16
|
import { type StackSectionContent, type StackSectionItem } from './Section';
|
|
17
17
|
import { Stack, type StackProps } from './Stack';
|
|
@@ -95,7 +95,7 @@ export const Transfer = {
|
|
|
95
95
|
</Mosaic.Root>
|
|
96
96
|
);
|
|
97
97
|
},
|
|
98
|
-
decorators: [withTheme,
|
|
98
|
+
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
export const Copy = {
|
|
@@ -117,7 +117,7 @@ export const Copy = {
|
|
|
117
117
|
</Mosaic.Root>
|
|
118
118
|
);
|
|
119
119
|
},
|
|
120
|
-
decorators: [withTheme,
|
|
120
|
+
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
export type DemoStackProps = StackProps & {
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
6
|
+
import { defineConfig } from '@playwright/test';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
import { e2ePreset } from '@dxos/test-utils/playwright';
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
...nxE2EPreset(__filename, { testDir: __dirname }),
|
|
12
|
+
...e2ePreset(__dirname),
|
|
13
|
+
webServer: {
|
|
14
|
+
command: 'pnpm -w nx storybook-e2e stories',
|
|
15
|
+
port: 9009,
|
|
16
|
+
reuseExistingServer: !process.env.CI,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { expect, test } from '@playwright/test';
|
|
6
6
|
|
|
7
|
-
import { setupPage } from '@dxos/test/playwright';
|
|
7
|
+
import { setupPage } from '@dxos/test-utils/playwright';
|
|
8
8
|
|
|
9
9
|
import { StackManager } from '../testing';
|
|
10
10
|
|
|
@@ -13,10 +13,8 @@ const storybookUrl = (storyId: string) => `http://localhost:9009/iframe.html?id=
|
|
|
13
13
|
|
|
14
14
|
test.describe('Stack', () => {
|
|
15
15
|
test('remove', async ({ browser }) => {
|
|
16
|
-
const { page } = await setupPage(browser, {
|
|
17
|
-
|
|
18
|
-
waitFor: (page) => page.getByTestId('stack-transfer').isVisible(),
|
|
19
|
-
});
|
|
16
|
+
const { page } = await setupPage(browser, { url: storybookUrl('react-ui-stack-stack--transfer') });
|
|
17
|
+
await page.getByTestId('stack-transfer').waitFor({ state: 'visible' });
|
|
20
18
|
|
|
21
19
|
const stack = new StackManager(page.getByTestId('stack-1'));
|
|
22
20
|
await expect(stack.sections()).toHaveCount(8);
|
|
@@ -28,10 +26,8 @@ test.describe('Stack', () => {
|
|
|
28
26
|
});
|
|
29
27
|
|
|
30
28
|
test('rearrange', async ({ browser }) => {
|
|
31
|
-
const { page } = await setupPage(browser, {
|
|
32
|
-
|
|
33
|
-
waitFor: (page) => page.getByTestId('stack-transfer').isVisible(),
|
|
34
|
-
});
|
|
29
|
+
const { page } = await setupPage(browser, { url: storybookUrl('react-ui-stack-stack--transfer') });
|
|
30
|
+
await page.getByTestId('stack-transfer').waitFor({ state: 'visible' });
|
|
35
31
|
|
|
36
32
|
const stack = new StackManager(page.getByTestId('stack-1'));
|
|
37
33
|
const sectionText = await stack.section(0).locator.innerText();
|
|
@@ -47,10 +43,8 @@ test.describe('Stack', () => {
|
|
|
47
43
|
test.skip();
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
const { page } = await setupPage(browser, {
|
|
51
|
-
|
|
52
|
-
waitFor: (page) => page.getByTestId('stack-transfer').isVisible(),
|
|
53
|
-
});
|
|
46
|
+
const { page } = await setupPage(browser, { url: storybookUrl('react-ui-stack-stack--transfer') });
|
|
47
|
+
await page.getByTestId('stack-transfer').waitFor({ state: 'visible' });
|
|
54
48
|
|
|
55
49
|
const stack1 = new StackManager(page.getByTestId('stack-1'));
|
|
56
50
|
const stack2 = new StackManager(page.getByTestId('stack-2'));
|
|
@@ -69,10 +63,8 @@ test.describe('Stack', () => {
|
|
|
69
63
|
});
|
|
70
64
|
|
|
71
65
|
test('copy', async ({ browser }) => {
|
|
72
|
-
const { page } = await setupPage(browser, {
|
|
73
|
-
|
|
74
|
-
waitFor: (page) => page.getByTestId('stack-copy').isVisible(),
|
|
75
|
-
});
|
|
66
|
+
const { page } = await setupPage(browser, { url: storybookUrl('react-ui-stack-stack--copy') });
|
|
67
|
+
await page.getByTestId('stack-copy').waitFor({ state: 'visible' });
|
|
76
68
|
|
|
77
69
|
const stack1 = new StackManager(page.getByTestId('stack-1'));
|
|
78
70
|
const stack2 = new StackManager(page.getByTestId('stack-2'));
|
|
@@ -34,7 +34,7 @@ export const EditorContent = ({ data: { content = '' } }: { data: StackSectionCo
|
|
|
34
34
|
formattingObserver,
|
|
35
35
|
createBasicExtensions(),
|
|
36
36
|
createMarkdownExtensions({ themeMode }),
|
|
37
|
-
createThemeExtensions({ themeMode, slots: { editor: { className: 'p-2' } } }),
|
|
37
|
+
createThemeExtensions({ themeMode, syntaxHighlighting: true, slots: { editor: { className: 'p-2' } } }),
|
|
38
38
|
decorateMarkdown(),
|
|
39
39
|
formattingKeymap(),
|
|
40
40
|
],
|