Skip to content

Commit

Permalink
V1 (#397)
Browse files Browse the repository at this point in the history
* Try typing a plain query object

* Interim

* Interim

* Interim

* Interim

* Remove deprecations

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Interim

* Rename entryId => id

* Use pr.pkg.new

* Update package with repository

* Use node 20

* Remove comment until stackblitz-labs/pkg.pr.new#264 is available

* Fix expr calls

* Interim

* Fix tabs

* Minor

* Update query docs

* Update page api, update init command

* Update madge config

* Don't use report in browser context

* Run build before packaging prs

* Undefined parameters effectively remove the filter

* Update page api

* Default to string

* Warn on duplicate entities

* Rename entries => children

* Always included bundled fields

* Fix incorrect paths

* Rename phase => status

* Interim

* Update locale null check

* Cleanup

* Assign fields to objectfield

* Add Field.create utility function

* Update getting started

* Minor

* Update to Next 15

* Introduce withAlinea to work around turbopack failing to throw a runtime error if dynamic imports are not found. Compile to cjs because Next is stuck in the past.

* Interim

* Update changelog

* Provide entry id in translations

* Detect Next.js for init cmd. This should really just be a selection prompt which we'll get to.

* Don't fail here

* Provide types for query with multiple content types

* Strip apostrophe

* The mutate call marks the entry as dirty but that's not necessary here

* Infer non-null if initialValue is set on select field

* Use Field initial values on entry creation

* Implement notIn

* Add button to open references

* More entryId renaming

* Link to files directly

* Fix rich text toolbar not in bottom position if page length is smaller than viewport height

* Allow markup in help option

* Limit image uploads to select file types

* Replace i18nId with id + locale

* Attempt at recovering linked ids

* Use values

* Await fix

* Allow uppcase in locale names

* Remove debug log

* Bundle both config and views in one entrypoint in dev mode

* Remove ts buildinfo so all declarations are regenerated

* Collate locale column to nocase

* Pass locale in preview payload

* Don't suspend on preview payload changes because it becomes very visible if used with react 19

* Improve expanded types

* Add entry fields to inferred types

* Add links, lists and objects to query filter operations

* Fix type
  • Loading branch information
benmerckx authored Nov 18, 2024
1 parent 6d8f270 commit 26414a2
Show file tree
Hide file tree
Showing 255 changed files with 4,514 additions and 5,296 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: {node-version: '18', cache: 'yarn'}
with: {node-version: '20', cache: 'yarn'}
- run: yarn
- name: Check cycles for server target
run: yarn cycles:server
- name: Check cycles for browser target
run: yarn cycles:browser
- run: yarn test --report
- run: yarn build && npx pkg-pr-new publish --comment=off
- uses: nowsprinting/check-version-format-action@v3
id: version
with: {prefix: 'v'}
- if: steps.version.outputs.is_valid == 'true'
run: |
rm -r dist
rm -r dist && rm tsconfig.tsbuildinfo
yarn bump ${GITHUB_REF#refs/tags/v}
npm config set //registry.npmjs.org/:_authToken ${{secrets.NPM_AUTH_TOKEN}}
- if: steps.version.outputs.is_valid == 'true' && !steps.version.outputs.prerelease
Expand Down
3 changes: 0 additions & 3 deletions .madgerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"excludeRegExp": [
"CreateSelection"
],
"detectiveOptions": {
"ts": {
"skipTypeImports": true
Expand Down
6 changes: 4 additions & 2 deletions apps/dev/content/primary/fields/examples/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
"text": "",
"hello": "",
"richText": [],
"number": 12,
"metadata": {
"title": "",
"description": "",
"openGraph": {
"title": "",
"siteName": "",
"image": {},
"title": "",
"description": ""
}
}
}
}
7 changes: 6 additions & 1 deletion apps/dev/content/primary/fields/examples/custom-fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
"_index": "Zz",
"_i18nId": "2dgfifVas5J2u6x1UdOnS7yMDTB",
"title": "Custom fields",
"position": {
"x": 0.5766666666666667,
"y": 0.16333333333333333
},
"metadata": {
"title": "",
"description": "",
"openGraph": {
"title": "",
"siteName": "",
"image": {},
"title": "",
"description": ""
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"_type": "Page",
"_index": "Zz",
"_i18nId": "2dgeccRswr67Tr7c5S4cphuEz6I",
"_seeded": "/nl/seededpath.json",
"_seeded": "/nl-be/seededpath.json",
"_root": "pages"
}
}
17 changes: 17 additions & 0 deletions apps/dev/content/primary/pages/nl-nl/root-page.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"_id": "2U6iFE1EOpe6RnrFORP7l8TFTCl",
"_type": "Page",
"_index": "a0",
"_root": "pages",
"title": "Root page",
"metadata": {
"title": "",
"description": "",
"openGraph": {
"siteName": "",
"image": {},
"title": "",
"description": ""
}
}
}
7 changes: 7 additions & 0 deletions apps/dev/content/primary/pages/nl-nl/seededpath.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"_id": "2dgeccRswr67Tr7c5S4cphuEz6I",
"_type": "Page",
"_index": "a0",
"_seeded": "/nl-nl/seededpath.json",
"_root": "pages"
}
13 changes: 7 additions & 6 deletions apps/dev/src/cms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ export const cms = createCMS({
pages: Config.root('Languages', {
icon: IcRoundTranslate,
i18n: {
locales: ['en', 'fr', 'nl']
locales: ['en', 'fr', 'nl-BE', 'nl-NL']
},
entries: {
seededPath: Config.page(
schema.Page({
children: {
seededPath: Config.page({
type: schema.Page,
fields: {
title: 'Seeded page'
})
)
}
})
}
}),
custom: Config.root('Custom', {
Expand Down
19 changes: 8 additions & 11 deletions apps/dev/src/field/PositionField.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import {FieldOptions, ScalarField, WithoutLabel} from 'alinea/core'
import {Field} from 'alinea'

export interface PositionOptions extends FieldOptions<Position> {}

export interface Position {
export type PositionField = Field.Create<{
x: number | null
y: number | null
}

class PositionField extends ScalarField<Position, PositionOptions> {}
}>

export function position(
label: string,
options: WithoutLabel<PositionOptions> = {}
) {
return new PositionField({
options: {label, ...options},
options: Field.Options<PositionField> = {}
): PositionField {
return Field.create({
label,
options,
view: '@/field/PositionField.view#PositionInput'
})
}
11 changes: 1 addition & 10 deletions apps/dev/src/field/PositionField.view.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import {FieldOptions, ScalarField} from 'alinea/core'
import {InputLabel, useField} from 'alinea/dashboard'
import {HStack, VStack} from 'alinea/ui'
import {SVGProps, useState} from 'react'
import {PositionField} from './PositionField.js'
import css from './PositionField.module.css'

export interface PositionOptions extends FieldOptions<Position> {}

export interface Position {
x: number | null
y: number | null
}

class PositionField extends ScalarField<Position, PositionOptions> {}

interface PositionInputProps {
field: PositionField
}
Expand Down
5 changes: 3 additions & 2 deletions apps/dev/src/schema/Examples.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Config, Query} from 'alinea'
import {Config} from 'alinea'
import {Entry} from 'alinea/core'
import * as examples from './example'

export const Examples = Config.document('Examples', {
contains: Object.values(examples),
orderChildrenBy: Query.title.asc(),
orderChildrenBy: {asc: Entry.title},
fields: {}
})
2 changes: 1 addition & 1 deletion apps/dev/src/schema/Folder.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Config, Field} from 'alinea'

export const Folder = Config.type('Folder', {
isContainer: true,
contains: ['Page'],
fields: {
title: Field.text('Title', {
width: 0.5
Expand Down
7 changes: 6 additions & 1 deletion apps/dev/src/schema/example/BasicFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export const BasicFields = Config.document('Basic fields', {
}),
number: Field.number('Number field', {
minValue: 0,
maxValue: 10
maxValue: 10,
help: (
<p>
A help text can contain <b>markup</b>
</p>
)
}),
check: Field.check('Check field', {description: 'Check me please'}),
date: Field.date('Date field'),
Expand Down
6 changes: 3 additions & 3 deletions apps/dev/src/schema/example/LinkFields.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Config, Field, Query} from 'alinea'
import {Config, Field} from 'alinea'

export const LinkFields = Config.document('Link fields', {
fields: {
Expand All @@ -7,12 +7,12 @@ export const LinkFields = Config.document('Link fields', {
entryWithCondition: Field.entry('With condition', {
help: `Show only entries of type Fields in the main workspace`,
location: {workspace: 'primary', root: 'fields'},
condition: Query.type.is('Fields')
condition: {_type: 'BasicFields'}
}),
linkMultiple: Field.link.multiple('Mixed links, multiple'),
image: Field.image('Image link'),
images: Field.image.multiple('Image link (multiple)'),
file: Field.entry('File link'),
file: Field.file('File link'),
withFields: Field.entry('With extra fields', {
fields: {
fieldA: Field.text('Field A', {width: 0.5}),
Expand Down
Loading

0 comments on commit 26414a2

Please sign in to comment.