Skip to content

Commit e3b4c61

Browse files
committed
wip: rename to builder
1 parent 5223f43 commit e3b4c61

Some content is hidden

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

60 files changed

+437
-395
lines changed

.npmpackagejsonlintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"repository-type": "error",
2626
"scripts-type": "error",
2727
"version-type": "error",
28-
"valid-values-author": ["error", ["Supereon"]],
28+
"valid-values-author": ["error", ["Fiction"]],
2929

3030
"no-restricted-dependencies": ["error", ["gulping-npm-package-json-lint"]],
3131
"no-restricted-pre-release-dependencies": [

@fiction/core/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
}
1414
],
1515
"dependencies": {
16-
"@aws-sdk/client-cloudfront": "^3.540.0",
17-
"@aws-sdk/client-s3": "^3.540.0",
16+
"@aws-sdk/client-cloudfront": "^3.549.0",
17+
"@aws-sdk/client-s3": "^3.549.0",
1818
"@faker-js/faker": "^8.4.1",
1919
"@iconify-json/carbon": "^1.1.31",
2020
"@iconify-json/clarity": "^1.1.12",
21-
"@iconify-json/flag": "^1.1.49",
21+
"@iconify-json/flag": "^1.1.50",
2222
"@iconify-json/heroicons": "^1.1.20",
2323
"@iconify-json/logos": "^1.1.42",
2424
"@iconify-json/tabler": "^1.1.109",
@@ -72,7 +72,7 @@
7272
"google-auth-library": "^9.7.0",
7373
"google-one-tap": "^1.0.6",
7474
"handlebars": "^4.7.8",
75-
"happy-dom": "^14.4.0",
75+
"happy-dom": "^14.5.1",
7676
"helmet": "^7.1.0",
7777
"highlight.js": "^11.9.0",
7878
"html-minifier": "^4.0.0",
@@ -87,7 +87,7 @@
8787
"knex": "^3.1.0",
8888
"knex-stringcase": "^1.4.6",
8989
"less": "^4.2.0",
90-
"magic-string": "^0.30.8",
90+
"magic-string": "^0.30.9",
9191
"marked": "^12.0.1",
9292
"marked-gfm-heading-id": "^3.1.3",
9393
"mime": "^4.0.1",
@@ -125,7 +125,7 @@
125125
"tailwindcss": "^3.4.3",
126126
"ts-node": "^10.9.2",
127127
"tsup": "^8.0.2",
128-
"typescript": "^5.4.3",
128+
"typescript": "^5.4.4",
129129
"unhead": "^1.9.4",
130130
"unocss": "^0.58.9",
131131
"uuid-apikey": "^1.5.3",
@@ -139,7 +139,7 @@
139139
},
140140
"devDependencies": {
141141
"@babel/parser": "^7.24.4",
142-
"@playwright/test": "^1.42.1",
142+
"@playwright/test": "^1.43.0",
143143
"@tailwindcss/forms": "^0.5.7",
144144
"@types/bcrypt": "^5.0.2",
145145
"@types/body-parser": "^1.19.5",
@@ -171,7 +171,7 @@
171171
"deep-object-diff": "^1.1.9",
172172
"fake-indexeddb": "^5.0.2",
173173
"ngrok": "5.0.0-beta.2",
174-
"playwright": "^1.42.1",
174+
"playwright": "^1.43.0",
175175
"react-dom": "^18.2.0",
176176
"rollup": "^4.14.0",
177177
"rollup-plugin-visualizer": "^5.12.0",

@fiction/plugins/plugin-ai/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@fiction/core": "workspace:*",
44
"@fiction/plugin-unsplash": "workspace:*",
55
"@pinecone-database/pinecone": "^2.2.0",
6-
"openai": "^4.32.1",
6+
"openai": "^4.32.2",
77
"tailwindcss": "^3.4.3",
88
"vue": "^3.4.21"
99
},

@fiction/plugins/plugin-contact/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fiction/plugin-contact",
33
"type": "module",
44
"version": "6.0.25",
5-
"author": "Supereon",
5+
"author": "Fiction",
66
"license": "GPL-2.0-only",
77
"main": "index.ts",
88
"dependencies": {

@fiction/plugins/plugin-monitor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fiction/plugin-monitor",
33
"type": "module",
44
"version": "6.0.25",
5-
"author": "Supereon",
5+
"author": "Fiction",
66
"license": "GPL-2.0-only",
77
"main": "index.ts",
88
"dependencies": {

@fiction/plugins/plugin-notify/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"type": "module",
44
"version": "6.0.25",
55
"description": "Notify allows you to add toast notifications to your app with ease.",
6-
"author": "Supereon",
6+
"author": "Fiction",
77
"license": "GPL-2.0-only",
88
"main": "index.ts",
99
"dependencies": {

@fiction/plugins/plugin-stripe/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@fiction/core": "workspace:*",
44
"@stripe/stripe-js": "^3.2.0",
55
"express": "^4.19.2",
6-
"stripe": "^14.23.0"
6+
"stripe": "^14.24.0"
77
},
88
"devDependencies": {
99
"dotenv": "^16.4.5"

@fiction/plugins/plugin-subscribe/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fiction/plugin-subscribe",
33
"type": "module",
44
"version": "6.0.25",
5-
"author": "Supereon",
5+
"author": "Fiction",
66
"license": "GPL-2.0-only",
77
"main": "index.ts",
88
"dependencies": {

@fiction/site/cards/hero/ElHero.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ActionItem } from '@fiction/core'
33
import { vue } from '@fiction/core'
44
import XElement from '../../engine/XElement.vue'
55
import type { Card } from '../../card'
6-
import XText from '../../el/XText.vue'
6+
import XText from '../../plugin-builder/XText.vue'
77
88
export type UserConfig = {
99
heading?: string

@fiction/site/cards/inputSets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import type { Refinement } from '@fiction/ui'
44
import { InputOption, OptionSet } from '@fiction/ui'
5-
import InputAi from '../el/InputAi.vue'
5+
import InputAi from '../plugin-builder/InputAi.vue'
66

77
type StandardSetArgs = { label?: string, parentKey?: string, inputs?: string[], prefix?: string }
88

@fiction/site/cards/quote/ElQuote.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { MediaDisplayObject } from '@fiction/core'
33
import { vue } from '@fiction/core'
44
import ElImage from '@fiction/ui/ElImage.vue'
55
import type { Card } from '../../card'
6-
import XText from '../../el/XText.vue'
6+
import XText from '../../plugin-builder/XText.vue'
77
import franklin from './franklin.jpg'
88
99
type Quote = {

@fiction/site/index.ts

+27-23
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import type { FictionMonitor } from '@fiction/plugin-monitor'
1010
import { ManageIndex, ManagePage, ManageSite } from './endpoint'
1111
import { tables } from './tables'
1212
import { Site } from './site'
13-
import type { ToolKeys } from './el/tools'
14-
import { tools } from './el/tools'
13+
import type { ToolKeys } from './plugin-builder/tools'
14+
import { tools } from './plugin-builder/tools'
1515
import { ManageCert } from './endpoint-certs'
1616
import { getRoutes } from './routes'
1717
import type { Theme } from './theme'
18+
import { FictionSiteBuilder } from './plugin-builder'
1819

1920
export * from './site'
2021

@@ -41,6 +42,9 @@ export type SitesPluginSettings = {
4142
export class FictionSites extends FictionPlugin<SitesPluginSettings> {
4243
adminBaseRoute = this.settings.adminBaseRoute || '/admin'
4344
themes = vue.shallowRef(this.settings.themes)
45+
46+
builder = new FictionSiteBuilder({ ...this.settings, fictionSites: this })
47+
4448
queries = {
4549
ManageSite: new ManageSite({ ...this.settings, fictionSites: this }),
4650
ManageIndex: new ManageIndex({ ...this.settings, fictionSites: this }),
@@ -65,27 +69,27 @@ export class FictionSites extends FictionPlugin<SitesPluginSettings> {
6569

6670
activeSite = vue.shallowRef<Site | undefined>(undefined)
6771

68-
activeToolId = {
69-
left: vue.ref<ToolKeys | ''>(),
70-
right: vue.ref<ToolKeys | ''>(),
71-
}
72-
73-
activeTool = {
74-
left: vue.computed(() => tools().find(t => t.toolId === this.activeToolId.left.value)),
75-
right: vue.computed(() => tools().find(t => t.toolId === (this.activeToolId.right.value ? this.activeToolId.right.value : 'editCard'))),
76-
}
77-
78-
useTool(args: { toolId: ToolKeys | '' }) {
79-
const { toolId } = args
80-
const t = tools().find(t => t.toolId === toolId)
81-
const location = t?.location || 'left'
82-
this.activeToolId[location].value = toolId
83-
}
84-
85-
isUsingTool(args: { toolId?: ToolKeys | '', locations?: ('left' | 'right')[] } = {}) {
86-
const { toolId, locations = ['left', 'right'] } = args
87-
return locations.some(l => this.activeToolId[l].value === toolId)
88-
}
72+
// activeToolId = {
73+
// left: vue.ref<ToolKeys | ''>(),
74+
// right: vue.ref<ToolKeys | ''>(),
75+
// }
76+
77+
// activeTool = {
78+
// left: vue.computed(() => tools().find(t => t.toolId === this.activeToolId.left.value)),
79+
// right: vue.computed(() => tools().find(t => t.toolId === (this.activeToolId.right.value ? this.activeToolId.right.value : 'editCard'))),
80+
// }
81+
82+
// useTool(args: { toolId: ToolKeys | '' }) {
83+
// const { toolId } = args
84+
// const t = tools().find(t => t.toolId === toolId)
85+
// const location = t?.location || 'left'
86+
// this.activeToolId[location].value = toolId
87+
// }
88+
89+
// isUsingTool(args: { toolId?: ToolKeys | '', locations?: ('left' | 'right')[] } = {}) {
90+
// const { toolId, locations = ['left', 'right'] } = args
91+
// return locations.some(l => this.activeToolId[l].value === toolId)
92+
// }
8993

9094
async requestIndex(
9195
args: { limit?: number, offset?: number, filters?: DataFilter[], imageId?: string } = {},
File renamed without changes.
File renamed without changes.

@fiction/site/el/ElTool.vue @fiction/site/plugin-builder/ElTool.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ico = iconStyle[props.iconTheme]
2626
<div
2727

2828
class="inline-block text-[10px] rounded-md py-0.5 px-2 bg-theme-50 dark:bg-theme-600 uppercase font-semibold tracking-wide cursor-pointer text-theme-400 dark:text-theme-0 hover:bg-theme-100"
29-
@click.stop="back.onClick?.({ event: $event })"
29+
@click.stop="back?.onClick?.({ event: $event })"
3030
>
3131
&larr; {{ back?.name || "Back" }}
3232
</div>
File renamed without changes.

@fiction/site/el/InputAi.vue @fiction/site/plugin-builder/InputAi.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import TransitionSlide from '@fiction/ui/TransitionSlide.vue'
1010
import ElModal from '@fiction/ui/ElModal.vue'
1111
import ElProgress from '@fiction/ui/ElProgress.vue'
1212
import type { Site } from '../site'
13+
import type { Card } from '../card'
1314
1415
const props = defineProps({
1516
modelValue: { type: String, default: '' },
1617
site: { type: Object as vue.PropType<Site>, default: () => ({}) },
1718
})
1819
1920
const loading = vue.ref(false)
20-
const card = vue.computed(() => props.site.activeCard.value)
21+
const card = vue.computed<Card | undefined>(() => props.site.activeCard.value)
2122
2223
async function generateCard() {
2324
loading.value = true
@@ -74,7 +75,7 @@ const numFields = vue.computed(() => {
7475
size="xs"
7576
tag="div"
7677
wrap-class="gap-1 cursor-pointer"
77-
@click.stop="site.fictionSites.useTool({ toolId: 'ai' })"
78+
@click.stop="site.fictionSites.builder.useTool({ toolId: 'ai' })"
7879
>
7980
<span class="i-tabler-world text-base" />
8081
</ElButton>
@@ -84,13 +85,14 @@ const numFields = vue.computed(() => {
8485
<TransitionSlide>
8586
<div v-if="showAdvancedOptions" class="space-y-3">
8687
<ElInput
88+
v-if="card"
8789
v-bind="$attrs"
8890
label="Overall Generation Goal"
8991
description="Enter a sentence or two about what you want to achieve with this card. Contextual information will be added automatically."
9092
:model-value="card.generation.prompt.value"
9193
input="InputTextarea"
9294
placeholder="This section should..."
93-
@update:model-value="card.generation.userPrompt.value = $event"
95+
@update:model-value="card && (card.generation.userPrompt.value = $event)"
9496
/>
9597
<div class="space-y-2 mt-2 bg-theme-50 dark:bg-theme-700 rounded-md p-3">
9698
<div class="flex justify-between">
File renamed without changes.

@fiction/site/el/LayoutTool.vue @fiction/site/plugin-builder/LayoutTool.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const actions: ActionItem[] = [
2828
icon: 'i-tabler-new-section',
2929
onClick: () => {
3030
props.site.activeRegionKey.value = 'main'
31-
control.useTool({ toolId: 'add' })
31+
control.builder.useTool({ toolId: 'add' })
3232
},
3333
},
3434
]
@@ -50,7 +50,7 @@ const pageList = vue.computed<ListItem[]>(() => {
5050
<div class=" rounded-md space-y-1">
5151
<div class="relative flex justify-between items-center">
5252
<span class="text-[10px] uppercase text-theme-400/40 font-semibold tracking-wide">Current Page</span>
53-
<ElButton size="xxs" @click="control.useTool({ toolId: 'pages' })">
53+
<ElButton size="xxs" @click="control.builder.useTool({ toolId: 'pages' })">
5454
Change Page
5555
</ElButton>
5656
</div>

@fiction/site/el/LayoutToolRegion.vue @fiction/site/plugin-builder/LayoutToolRegion.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function getCardHandle(card: Card): Handle {
7373
v-if="!card.cards.value.length"
7474
key="add"
7575
class="hidden border-3 border-dashed border-theme-200 dark:border-theme-700 rounded-lg mt-2 p-4 text-xs text-center hover:border-theme-300 cursor-pointer text-theme-300 hover:text-theme-400 font-semibold"
76-
@click="site.activeRegionKey.value = regionId; control.useTool({ toolId: 'add' })"
76+
@click="site.activeRegionKey.value = regionId; control.builder.useTool({ toolId: 'add' })"
7777
>
7878
Add Element
7979
</div>
File renamed without changes.

@fiction/site/el/SiteEditorEditMode.vue @fiction/site/plugin-builder/SiteEditorEditMode.vue

+13-13
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ const { fictionSites } = useService<{ fictionSites: FictionSites, fictionRouterS
3535
class=" space-x-2 cursor-pointer p-2 justify-end w-[40px] h-[40px] rounded-lg transition-all"
3636
:title="toLabel(tool.title || tool.toolId)"
3737
:class="
38-
fictionSites.isUsingTool({ toolId: tool.toolId })
38+
fictionSites.builder.isUsingTool({ toolId: tool.toolId })
3939
? 'bg-primary-100 dark:bg-primary-700 text-primary-600 dark:text-primary-50'
4040
: 'text-theme-700 dark:text-theme-0 dark:hover:bg-theme-600 hover:bg-theme-100 d'"
41-
@click="fictionSites.useTool({ toolId: tool.toolId })"
41+
@click="fictionSites.builder.useTool({ toolId: tool.toolId })"
4242
>
4343
<div class="text-2xl" :class="tool.icon" />
4444
</div>
@@ -54,23 +54,23 @@ const { fictionSites } = useService<{ fictionSites: FictionSites, fictionRouterS
5454
leave-to-class="transform -translate-x-10 opacity-0"
5555
>
5656
<div
57-
v-if="fictionSites.activeTool.left.value"
58-
:key="fictionSites.activeTool.left.value.toolId"
57+
v-if="fictionSites.builder.activeTool.left.value"
58+
:key="fictionSites.builder.activeTool.left.value.toolId"
5959
class="absolute left-full h-full bg-theme-0 dark:bg-theme-900 top-0 z-30 border-r shadow-[10px_0_18px_-15px_rgba(0,0,0,0.6)] border-theme-300 dark:border-theme-600 overflow-scroll no-scrollbar "
60-
:class="fictionSites.activeTool.left.value.widthClasses || 'w-[300px]'"
60+
:class="fictionSites.builder.activeTool.left.value.widthClasses || 'w-[300px]'"
6161
>
6262
<component
63-
:is="fictionSites.activeTool.left.value.el"
63+
:is="fictionSites.builder.activeTool.left.value.el"
6464
v-bind="{
6565
site,
66-
tool: fictionSites.activeTool.left.value,
67-
...fictionSites.activeTool.left.value.props?.(site).value,
66+
tool: fictionSites.builder.activeTool.left.value,
67+
...fictionSites.builder.activeTool.left.value.props?.(site).value,
6868
}"
6969
/>
7070
</div>
7171
</transition>
7272
</div>
73-
<div @click="fictionSites.useTool({ toolId: '' })">
73+
<div @click="fictionSites.builder.useTool({ toolId: '' })">
7474
<div class="h-full min-h-0 grid grid-flow-dense relative grid-rows-[minmax(0,1fr)] grid-cols-[1fr_300px] xl:grid-cols-[1fr_400px]">
7575
<div
7676

@@ -90,13 +90,13 @@ const { fictionSites } = useService<{ fictionSites: FictionSites, fictionRouterS
9090
leave-to-class="transform scale-80 translate-y-4 opacity-0"
9191
>
9292
<component
93-
:is="fictionSites.activeTool.right.value.el"
94-
v-if="fictionSites.activeTool.right.value"
93+
:is="fictionSites.builder.activeTool.right.value.el"
94+
v-if="fictionSites.builder.activeTool.right.value"
9595
:key="site.activeCard.value?.cardId"
9696
v-bind="{
9797
site,
98-
tool: fictionSites.activeTool.right.value,
99-
...fictionSites.activeTool.right.value.props?.(site).value,
98+
tool: fictionSites.builder.activeTool.right.value,
99+
...fictionSites.builder.activeTool.right.value.props?.(site).value,
100100
}"
101101
/>
102102
</transition>

@fiction/site/el/SiteEditorFrame.vue @fiction/site/plugin-builder/SiteEditorFrame.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ vue.watch(
4747
frame-id="site-builder-iframe"
4848
:display-url="site.frame.displayUrl.value"
4949
:browser-bar="true"
50-
@update:url="site.frame.updateFrameUrl($event)"
51-
@message="site.frame.processFrameMessage({ scope: 'parent', msg: $event as FramePostMessageList })"
50+
@update:url="site?.frame.updateFrameUrl($event)"
51+
@message="site?.frame.processFrameMessage({ scope: 'parent', msg: $event as FramePostMessageList })"
5252
/>
5353
<div
5454
class="mt-4 flex justify-center space-x-2 "

@fiction/site/el/ToolAdd.vue @fiction/site/plugin-builder/ToolAdd.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const groupTemplates = vue.computed(() => {
4747
function addCard(args: { templateId: string }) {
4848
const { templateId = 'page' } = args
4949
props.site.addCard({ templateId, delay: 400 })
50-
control.useTool({ toolId: 'layout' })
50+
control.builder.useTool({ toolId: 'layout' })
5151
}
5252
5353
function ic(item: CardTemplate) {
File renamed without changes.

0 commit comments

Comments
 (0)