@blinkk/root-cms 1.0.0-alpha.9 → 1.0.0-beta.1
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/bin/root-cms.js +35 -0
- package/dist/app.js +190 -0
- package/dist/cli.js +228 -0
- package/dist/core.d.ts +33 -0
- package/dist/core.js +138 -0
- package/dist/plugin.d.ts +38 -4
- package/dist/plugin.js +203 -7
- package/dist/project.d.ts +16 -0
- package/dist/project.js +18 -0
- package/dist/schema-f8000274.d.ts +191 -0
- package/dist/ui/signin.css +171 -0
- package/dist/ui/signin.js +8394 -0
- package/dist/ui/ui.css +989 -0
- package/dist/ui/ui.js +43534 -0
- package/package.json +66 -8
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -6
- package/dist/index.js.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/schema.d.ts +0 -83
- package/dist/schema.js +0 -54
- package/dist/schema.js.map +0 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { FunctionalComponent } from 'preact';
|
|
2
|
+
|
|
3
|
+
interface CommonFieldProps {
|
|
4
|
+
type: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
help?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
default?: any;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
deprecated?: boolean;
|
|
12
|
+
}
|
|
13
|
+
type StringField = CommonFieldProps & {
|
|
14
|
+
type: 'string';
|
|
15
|
+
default?: string;
|
|
16
|
+
translate?: boolean;
|
|
17
|
+
variant?: 'input' | 'textarea';
|
|
18
|
+
};
|
|
19
|
+
declare function string(field: Omit<StringField, 'type'>): StringField;
|
|
20
|
+
type NumberField = CommonFieldProps & {
|
|
21
|
+
type: 'number';
|
|
22
|
+
default?: number;
|
|
23
|
+
};
|
|
24
|
+
declare function number(field: Omit<NumberField, 'type'>): NumberField;
|
|
25
|
+
type DateField = CommonFieldProps & {
|
|
26
|
+
type: 'date';
|
|
27
|
+
default?: string;
|
|
28
|
+
};
|
|
29
|
+
declare function date(field: Omit<DateField, 'type'>): DateField;
|
|
30
|
+
type DateTimeField = CommonFieldProps & {
|
|
31
|
+
type: 'datetime';
|
|
32
|
+
default?: string;
|
|
33
|
+
};
|
|
34
|
+
declare function datetime(field: Omit<DateTimeField, 'type'>): DateTimeField;
|
|
35
|
+
type BooleanField = CommonFieldProps & {
|
|
36
|
+
type: 'boolean';
|
|
37
|
+
default?: boolean;
|
|
38
|
+
};
|
|
39
|
+
declare function boolean(field: Omit<BooleanField, 'type'>): BooleanField;
|
|
40
|
+
type SelectField = CommonFieldProps & {
|
|
41
|
+
type: 'select';
|
|
42
|
+
default?: string;
|
|
43
|
+
options?: Array<{
|
|
44
|
+
value: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
}> | string[];
|
|
47
|
+
};
|
|
48
|
+
declare function select(field: Omit<SelectField, 'type'>): SelectField;
|
|
49
|
+
type MultiSelectField = Omit<SelectField, 'type'> & {
|
|
50
|
+
type: 'multiselect';
|
|
51
|
+
/** Set to `true` to allow users to create arbitrary values. */
|
|
52
|
+
creatable?: boolean;
|
|
53
|
+
};
|
|
54
|
+
declare function multiselect(field: Omit<MultiSelectField, 'type'>): MultiSelectField;
|
|
55
|
+
type ImageField = CommonFieldProps & {
|
|
56
|
+
type: 'image';
|
|
57
|
+
};
|
|
58
|
+
declare function image(field: Omit<ImageField, 'type'>): ImageField;
|
|
59
|
+
type ObjectField = CommonFieldProps & {
|
|
60
|
+
type: 'object';
|
|
61
|
+
fields: FieldWithId[];
|
|
62
|
+
};
|
|
63
|
+
declare function object(field: Omit<ObjectField, 'type'>): ObjectField;
|
|
64
|
+
type ArrayField = CommonFieldProps & {
|
|
65
|
+
type: 'array';
|
|
66
|
+
default?: any[];
|
|
67
|
+
/**
|
|
68
|
+
* String format for the preview line of an item in the array. Placeholder
|
|
69
|
+
* values should use brackets, e.g. `m{_index:02}: {_type}`.
|
|
70
|
+
*
|
|
71
|
+
* Multiple values can be provided, in which case the first preview line with
|
|
72
|
+
* no missing placeholder values will be used.
|
|
73
|
+
*
|
|
74
|
+
* System added placeholder values:
|
|
75
|
+
*
|
|
76
|
+
* - _index: The 0-based index.
|
|
77
|
+
* - _index:02: A left-padded version of _index to 2 digits.
|
|
78
|
+
* - _index:03: A left-padded version of _index to 3 digits.
|
|
79
|
+
* - _type: For array of one-of fields, the type of the selected field.
|
|
80
|
+
*/
|
|
81
|
+
preview?: string | string[];
|
|
82
|
+
of: ObjectLikeField;
|
|
83
|
+
};
|
|
84
|
+
declare function array(field: Omit<ArrayField, 'type'>): ArrayField;
|
|
85
|
+
type OneOfField = CommonFieldProps & {
|
|
86
|
+
type: 'oneof';
|
|
87
|
+
types: Schema[];
|
|
88
|
+
};
|
|
89
|
+
declare function oneOf(field: Omit<OneOfField, 'type'>): OneOfField;
|
|
90
|
+
type Field = StringField | NumberField | DateField | DateTimeField | BooleanField | SelectField | MultiSelectField | ImageField | ObjectField | ArrayField | OneOfField;
|
|
91
|
+
/**
|
|
92
|
+
* Similar to {@link Field} but with a required `id`.
|
|
93
|
+
* TODO(stevenle): fix this.
|
|
94
|
+
*/
|
|
95
|
+
type FieldWithId = Field;
|
|
96
|
+
type ObjectLikeField = ImageField | ObjectField | OneOfField;
|
|
97
|
+
interface Schema {
|
|
98
|
+
name: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
fields: FieldWithId[];
|
|
101
|
+
}
|
|
102
|
+
declare function defineSchema(schema: Schema): Schema;
|
|
103
|
+
/** Defines the schema for a collection or reusable component. */
|
|
104
|
+
declare const define: typeof defineSchema;
|
|
105
|
+
type Collection = Schema & {
|
|
106
|
+
/** URL path where the collection serves from. */
|
|
107
|
+
url?: string;
|
|
108
|
+
/** Page component to render the collection for instant previews */
|
|
109
|
+
Component?: FunctionalComponent;
|
|
110
|
+
/**
|
|
111
|
+
* Defines the fields to use for document preview. Defaults to "title" and
|
|
112
|
+
* "image". Use dot notation for nested fields, e.g. "meta.title".
|
|
113
|
+
*/
|
|
114
|
+
preview?: {
|
|
115
|
+
title?: string;
|
|
116
|
+
image?: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
declare function defineCollection(collection: Collection): Collection;
|
|
120
|
+
declare const collection: typeof defineCollection;
|
|
121
|
+
|
|
122
|
+
type schema_CommonFieldProps = CommonFieldProps;
|
|
123
|
+
type schema_StringField = StringField;
|
|
124
|
+
declare const schema_string: typeof string;
|
|
125
|
+
type schema_NumberField = NumberField;
|
|
126
|
+
declare const schema_number: typeof number;
|
|
127
|
+
type schema_DateField = DateField;
|
|
128
|
+
declare const schema_date: typeof date;
|
|
129
|
+
type schema_DateTimeField = DateTimeField;
|
|
130
|
+
declare const schema_datetime: typeof datetime;
|
|
131
|
+
type schema_BooleanField = BooleanField;
|
|
132
|
+
declare const schema_boolean: typeof boolean;
|
|
133
|
+
type schema_SelectField = SelectField;
|
|
134
|
+
declare const schema_select: typeof select;
|
|
135
|
+
type schema_MultiSelectField = MultiSelectField;
|
|
136
|
+
declare const schema_multiselect: typeof multiselect;
|
|
137
|
+
type schema_ImageField = ImageField;
|
|
138
|
+
declare const schema_image: typeof image;
|
|
139
|
+
type schema_ObjectField = ObjectField;
|
|
140
|
+
declare const schema_object: typeof object;
|
|
141
|
+
type schema_ArrayField = ArrayField;
|
|
142
|
+
declare const schema_array: typeof array;
|
|
143
|
+
type schema_OneOfField = OneOfField;
|
|
144
|
+
declare const schema_oneOf: typeof oneOf;
|
|
145
|
+
type schema_Field = Field;
|
|
146
|
+
type schema_FieldWithId = FieldWithId;
|
|
147
|
+
type schema_ObjectLikeField = ObjectLikeField;
|
|
148
|
+
type schema_Schema = Schema;
|
|
149
|
+
declare const schema_defineSchema: typeof defineSchema;
|
|
150
|
+
declare const schema_define: typeof define;
|
|
151
|
+
type schema_Collection = Collection;
|
|
152
|
+
declare const schema_defineCollection: typeof defineCollection;
|
|
153
|
+
declare const schema_collection: typeof collection;
|
|
154
|
+
declare namespace schema {
|
|
155
|
+
export {
|
|
156
|
+
schema_CommonFieldProps as CommonFieldProps,
|
|
157
|
+
schema_StringField as StringField,
|
|
158
|
+
schema_string as string,
|
|
159
|
+
schema_NumberField as NumberField,
|
|
160
|
+
schema_number as number,
|
|
161
|
+
schema_DateField as DateField,
|
|
162
|
+
schema_date as date,
|
|
163
|
+
schema_DateTimeField as DateTimeField,
|
|
164
|
+
schema_datetime as datetime,
|
|
165
|
+
schema_BooleanField as BooleanField,
|
|
166
|
+
schema_boolean as boolean,
|
|
167
|
+
schema_SelectField as SelectField,
|
|
168
|
+
schema_select as select,
|
|
169
|
+
schema_MultiSelectField as MultiSelectField,
|
|
170
|
+
schema_multiselect as multiselect,
|
|
171
|
+
schema_ImageField as ImageField,
|
|
172
|
+
schema_image as image,
|
|
173
|
+
schema_ObjectField as ObjectField,
|
|
174
|
+
schema_object as object,
|
|
175
|
+
schema_ArrayField as ArrayField,
|
|
176
|
+
schema_array as array,
|
|
177
|
+
schema_OneOfField as OneOfField,
|
|
178
|
+
schema_oneOf as oneOf,
|
|
179
|
+
schema_Field as Field,
|
|
180
|
+
schema_FieldWithId as FieldWithId,
|
|
181
|
+
schema_ObjectLikeField as ObjectLikeField,
|
|
182
|
+
schema_Schema as Schema,
|
|
183
|
+
schema_defineSchema as defineSchema,
|
|
184
|
+
schema_define as define,
|
|
185
|
+
schema_Collection as Collection,
|
|
186
|
+
schema_defineCollection as defineCollection,
|
|
187
|
+
schema_collection as collection,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { Schema as S, schema as s };
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* signin/styles/global.css */
|
|
2
|
+
:root {
|
|
3
|
+
--font-family-default: "Inter", sans-serif;
|
|
4
|
+
--font-family-mono:
|
|
5
|
+
ui-monospace,
|
|
6
|
+
SFMono-Regular,
|
|
7
|
+
Menlo,
|
|
8
|
+
Monaco,
|
|
9
|
+
Consolas,
|
|
10
|
+
monospace;
|
|
11
|
+
--color-text-default: #333333;
|
|
12
|
+
--color-border: #EFEFEF;
|
|
13
|
+
--button-background-hover: #F5F5F5;
|
|
14
|
+
--button-background-active: #E5E5E5;
|
|
15
|
+
}
|
|
16
|
+
html {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
overflow-x: hidden;
|
|
19
|
+
font-size: 16px;
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
}
|
|
22
|
+
*,
|
|
23
|
+
*:before,
|
|
24
|
+
*:after {
|
|
25
|
+
box-sizing: inherit;
|
|
26
|
+
}
|
|
27
|
+
html,
|
|
28
|
+
body {
|
|
29
|
+
font-family: var(--font-family-default);
|
|
30
|
+
color: var(--color-text-default);
|
|
31
|
+
height: 100%;
|
|
32
|
+
margin: 0;
|
|
33
|
+
-webkit-font-smoothing: antialiased;
|
|
34
|
+
-moz-osx-font-smoothing: grayscale;
|
|
35
|
+
scroll-behavior: smooth;
|
|
36
|
+
}
|
|
37
|
+
img,
|
|
38
|
+
picture,
|
|
39
|
+
figure,
|
|
40
|
+
video,
|
|
41
|
+
canvas,
|
|
42
|
+
svg,
|
|
43
|
+
iframe {
|
|
44
|
+
display: block;
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
height: auto;
|
|
47
|
+
margin: 0;
|
|
48
|
+
}
|
|
49
|
+
a {
|
|
50
|
+
color: inherit;
|
|
51
|
+
}
|
|
52
|
+
select {
|
|
53
|
+
color-scheme: light;
|
|
54
|
+
}
|
|
55
|
+
h1,
|
|
56
|
+
h2,
|
|
57
|
+
h3,
|
|
58
|
+
h4,
|
|
59
|
+
h5,
|
|
60
|
+
p {
|
|
61
|
+
margin: 0;
|
|
62
|
+
}
|
|
63
|
+
body.menu\:open {
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
}
|
|
66
|
+
#root {
|
|
67
|
+
margin: 0 auto;
|
|
68
|
+
min-height: 100vh;
|
|
69
|
+
position: relative;
|
|
70
|
+
}
|
|
71
|
+
.bootstrap {
|
|
72
|
+
font-size: 48px;
|
|
73
|
+
font-weight: 900;
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100vh;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
align-items: center;
|
|
80
|
+
text-align: center;
|
|
81
|
+
padding: 40px;
|
|
82
|
+
gap: 36px;
|
|
83
|
+
position: relative;
|
|
84
|
+
}
|
|
85
|
+
.bootstrap-error {
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
font-weight: 400;
|
|
88
|
+
position: absolute;
|
|
89
|
+
bottom: 100px;
|
|
90
|
+
left: 0;
|
|
91
|
+
right: 0;
|
|
92
|
+
text-align: center;
|
|
93
|
+
animation: 0.5s forwards bootstrap-loading-error;
|
|
94
|
+
animation-delay: 1s;
|
|
95
|
+
opacity: 0;
|
|
96
|
+
}
|
|
97
|
+
@keyframes bootstrap-loading-error {
|
|
98
|
+
0% {
|
|
99
|
+
opacity: 0;
|
|
100
|
+
}
|
|
101
|
+
100% {
|
|
102
|
+
opacity: 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* signin/styles/signin.css */
|
|
107
|
+
.signin {
|
|
108
|
+
background: #F5F5F5;
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 20px;
|
|
112
|
+
width: 100%;
|
|
113
|
+
min-height: 100vh;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
align-items: center;
|
|
116
|
+
}
|
|
117
|
+
.signin__card {
|
|
118
|
+
background: #FFFFFF;
|
|
119
|
+
border-radius: 12px;
|
|
120
|
+
width: 400px;
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-direction: column;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
gap: 48px;
|
|
126
|
+
padding: 150px 24px;
|
|
127
|
+
}
|
|
128
|
+
.signin__card__header {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
text-align: center;
|
|
134
|
+
gap: 8px;
|
|
135
|
+
}
|
|
136
|
+
.signin__card__header__icon {
|
|
137
|
+
padding: 8px;
|
|
138
|
+
border: 2px solid black;
|
|
139
|
+
border-radius: 50%;
|
|
140
|
+
}
|
|
141
|
+
.signin__button {
|
|
142
|
+
align-items: center;
|
|
143
|
+
-webkit-appearance: none;
|
|
144
|
+
-moz-appearance: none;
|
|
145
|
+
appearance: none;
|
|
146
|
+
background: #1a73e8;
|
|
147
|
+
border: 0;
|
|
148
|
+
border-radius: 2px;
|
|
149
|
+
color: #fff !important;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
display: flex;
|
|
152
|
+
font-family:
|
|
153
|
+
"Google Sans",
|
|
154
|
+
Arial,
|
|
155
|
+
Helvetica,
|
|
156
|
+
sans-serif;
|
|
157
|
+
font-size: 16px;
|
|
158
|
+
font-weight: 500;
|
|
159
|
+
letter-spacing: 0.25px;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
line-height: 1.625;
|
|
162
|
+
padding: 8px 48px;
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
gap: 16px;
|
|
165
|
+
}
|
|
166
|
+
.signin__button__icon {
|
|
167
|
+
width: 32px;
|
|
168
|
+
height: 32px;
|
|
169
|
+
background-color: white;
|
|
170
|
+
padding: 4px;
|
|
171
|
+
}
|