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

Use Storyteller for handling all of our Story/Storybook needs #267

Merged
merged 25 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f2eb567
Switch to Storyteller for all story handling
vocksel Oct 27, 2024
45b13ff
Bump Storyteller to 0.2.0
vocksel Oct 31, 2024
4073010
Update stories.spec to be more like the e2e tests in Storyteller
vocksel Oct 31, 2024
a6d84e0
Storyteller 0.2.1
vocksel Oct 31, 2024
0adbbd2
Fix analysis errors
vocksel Nov 1, 2024
c640e6d
Fix story names getting cut off
vocksel Nov 2, 2024
3967950
Get controls largely working
vocksel Nov 2, 2024
c35c588
Revert some minor changes
vocksel Nov 2, 2024
1af8cd8
Bump to Storyteller 0.3.0
vocksel Nov 3, 2024
92f432c
Implicitly install packages on first build
vocksel Nov 3, 2024
38ca781
Fix giant gray box in story preview area
vocksel Nov 3, 2024
7e612d3
Remove unused hook
vocksel Nov 3, 2024
d42689d
Bump Storyteller to 0.4.0
vocksel Nov 3, 2024
a20077b
Revert a story change
vocksel Nov 3, 2024
fcd2400
Use Storyteller type sdirectly
vocksel Nov 3, 2024
bd6c8f2
Fix analysis errors
vocksel Nov 3, 2024
2a7486f
Merge remote-tracking branch 'origin/main' into storyteller
vocksel Nov 3, 2024
5834eba
WIP changes for getting controls working consistently
vocksel Nov 5, 2024
3745772
WIP changes for controls, need to cleanup prints later
vocksel Nov 7, 2024
8a43b16
Fix visual controls bug
vocksel Nov 9, 2024
dee5ca2
Remove debug prints
vocksel Nov 9, 2024
93e22cd
Bump Storyteller to 0.4.1
vocksel Nov 9, 2024
5958f00
Remove unused variable
vocksel Nov 9, 2024
8f76cfb
Remove some lingering artifacts
vocksel Nov 9, 2024
b6b2c79
Bump Storyteller to 0.4.2
vocksel Nov 9, 2024
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
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"@pkg": "./Packages",
"@root": "./src",
"@lune/": "~/.lune/.typedefs/0.8.3/"
},
"files.associations": {
"*.luau": "lua"
}
}
77 changes: 0 additions & 77 deletions src/Common/useDescendants.luau

This file was deleted.

108 changes: 0 additions & 108 deletions src/Common/useDescendants.spec.luau

This file was deleted.

4 changes: 2 additions & 2 deletions src/Explorer/types.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local storybookTypes = require("@root/Storybook/types")
local Storyteller = require("@pkg/Storyteller")

type Storybook = storybookTypes.Storybook
type Storybook = Storyteller.Storybook

export type ComponentTreeNode = {
name: string,
Expand Down
8 changes: 4 additions & 4 deletions src/Navigation/Screen.luau
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
local ModuleLoader = require("@pkg/ModuleLoader")
local React = require("@pkg/React")
local Storyteller = require("@pkg/Storyteller")

local AboutView = require("@root/About/AboutView")
local NavigationContext = require("@root/Navigation/NavigationContext")
local SettingsView = require("@root/UserSettings/SettingsView")
local StoryCanvas = require("@root/Storybook/StoryCanvas")
local storybookTypes = require("@root/Storybook/types")

local useMemo = React.useMemo

type Story = storybookTypes.Story
type Storybook = storybookTypes.Storybook
type ModuleLoader = ModuleLoader.ModuleLoader
type Storybook = Storyteller.Storybook

export type Props = {
loader: ModuleLoader.ModuleLoader,
loader: ModuleLoader,
story: ModuleScript?,
storybook: Storybook?,
}
Expand Down
7 changes: 4 additions & 3 deletions src/Panels/Sidebar.luau
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
local React = require("@pkg/React")
local Storyteller = require("@pkg/Storyteller")

local Branding = require("@root/Common/Branding")
local ComponentTree = require("@root/Explorer")
local React = require("@pkg/React")
local ScrollingFrame = require("@root/Common/ScrollingFrame")
local Searchbar = require("@root/Forms/Searchbar")
local constants = require("@root/constants")
local createStoryNodes = require("@root/Storybook/createStoryNodes")
local explorerTypes = require("@root/Explorer/types")
local storybookTypes = require("@root/Storybook/types")
local useTheme = require("@root/Common/useTheme")

type Storybook = storybookTypes.Storybook
type Storybook = Storyteller.Storybook
type ComponentTreeNode = explorerTypes.ComponentTreeNode

local e = React.createElement
Expand Down
5 changes: 3 additions & 2 deletions src/Plugin/PluginApp.luau
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local ModuleLoader = require("@pkg/ModuleLoader")
local React = require("@pkg/React")
local Storyteller = require("@pkg/Storyteller")

local NavigationContext = require("@root/Navigation/NavigationContext")
local ResizablePanel = require("@root/Panels/ResizablePanel")
Expand All @@ -9,7 +10,6 @@ local Sidebar = require("@root/Panels/Sidebar")
local Topbar = require("@root/Panels/Topbar")
local constants = require("@root/constants")
local nextLayoutOrder = require("@root/Common/nextLayoutOrder")
local useStorybooks = require("@root/Storybook/useStorybooks")
local useTheme = require("@root/Common/useTheme")

local TOPBAR_HEIGHT_PX = 32
Expand All @@ -21,7 +21,7 @@ export type Props = {
local function App(props: Props)
local theme = useTheme()
local settingsContext = SettingsContext.use()
local storybooks = useStorybooks(game, props.loader)
local storybooks = Storyteller.useStorybooks(game, props.loader)
local story: ModuleScript?, setStory = React.useState(nil :: ModuleScript?)
local storybook, selectStorybook = React.useState(nil :: ModuleScript?)
local initialSidebarWidth = settingsContext.getSetting("sidebarWidth")
Expand Down Expand Up @@ -71,6 +71,7 @@ local function App(props: Props)
MainWrapper = React.createElement("Frame", {
LayoutOrder = nextLayoutOrder(),
Size = UDim2.fromScale(1, 1) - UDim2.fromOffset(sidebarWidth, 0),
BackgroundTransparency = 1,
}, {
Layout = React.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
Expand Down
9 changes: 6 additions & 3 deletions src/Storybook/StoryCanvas.luau
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
local ModuleLoader = require("@pkg/ModuleLoader")
local React = require("@pkg/React")
local Storyteller = require("@pkg/Storyteller")

local NoStorySelected = require("@root/Storybook/NoStorySelected")
local StoryView = require("@root/Storybook/StoryView")
local types = require("@root/Storybook/types")
local useTheme = require("@root/Common/useTheme")

local e = React.createElement

type ModuleLoader = ModuleLoader.ModuleLoader
type Storybook = Storyteller.Storybook

type Props = {
story: ModuleScript,
loader: ModuleLoader.ModuleLoader,
storybook: types.Storybook,
loader: ModuleLoader,
storybook: Storybook,
layoutOrder: number?,
}

Expand Down
9 changes: 7 additions & 2 deletions src/Storybook/StoryControls.luau
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ local function StoryControls(props: Props)
TextTruncate = Enum.TextTruncate.AtEnd,
}),

Option = e("Frame", {
OptionWrapper = e("Frame", {
LayoutOrder = 2,
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 0),
Expand All @@ -120,7 +120,12 @@ local function StoryControls(props: Props)
Flex = e("UIFlexItem", {
FlexMode = Enum.UIFlexMode.Shrink,
}),
}, option),
}, {
-- Keying by the identity of sortedControls fixes a bug where
-- the options visually do not update when two stories have the
-- exact same controls
[`Option_{sortedControls}`] = option,
}),
})
end

Expand Down
9 changes: 6 additions & 3 deletions src/Storybook/StoryMeta.luau
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
local React = require("@pkg/React")
local types = require("@root/Storybook/types")
local Storyteller = require("@pkg/Storyteller")

local useTheme = require("@root/Common/useTheme")

local MAX_SUMMARY_SIZE = 600

local e = React.createElement

type Story = Storyteller.Story<unknown>

export type Props = {
story: types.Story,
story: Story,
layoutOrder: number?,
}

Expand All @@ -31,7 +34,7 @@ local function StoryMeta(props: Props)
BackgroundTransparency = 1,
Font = theme.headerFont,
Size = UDim2.fromScale(0, 0),
Text = props.story.name:sub(1, #props.story.name - 6),
Text = props.story.name,
TextColor3 = theme.text,
TextSize = theme.headerTextSize,
}),
Expand Down
4 changes: 4 additions & 0 deletions src/Storybook/StoryMeta.story.luau
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ return {
story = {
name = "Story",
summary = "Story summary",
source = Instance.new("ModuleScript"),
storybook = {
storyRoots = {},
},
},
}),
}),
Expand Down
Loading
Loading