@orunelle/theme-sdk 0.0.0-stage → 2.0.0-alpha.14
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/commerce.d.ts +3093 -0
- package/dist/commerce.d.ts.map +1 -0
- package/dist/commerce.js +468 -0
- package/dist/composition.d.ts +36 -0
- package/dist/composition.d.ts.map +1 -0
- package/dist/composition.js +137 -0
- package/dist/image.d.ts +49 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/image.js +58 -0
- package/dist/index.d.ts +237 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +271 -0
- package/dist/product.d.ts +40 -0
- package/dist/product.d.ts.map +1 -0
- package/dist/product.js +106 -0
- package/dist/query.d.ts +6 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +25 -0
- package/dist/reference.d.ts +4 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/reference.js +892 -0
- package/dist/session.d.ts +23 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +141 -0
- package/package.json +48 -3
- package/README.md +0 -3
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
const label = (en, ar) => ({ en, ar });
|
|
2
|
+
const localized = (en, ar, value) => ({
|
|
3
|
+
kind: "localizedText",
|
|
4
|
+
label: label(en, ar),
|
|
5
|
+
maxLength: 500,
|
|
6
|
+
default: value,
|
|
7
|
+
});
|
|
8
|
+
const locations = [
|
|
9
|
+
"template:home",
|
|
10
|
+
"template:product.default",
|
|
11
|
+
"template:collection.default",
|
|
12
|
+
"template:page.default",
|
|
13
|
+
"template:search",
|
|
14
|
+
"template:cart",
|
|
15
|
+
"template:not-found",
|
|
16
|
+
"group:header",
|
|
17
|
+
"group:footer",
|
|
18
|
+
];
|
|
19
|
+
const children = ["heading", "text", "button", "image", "container"];
|
|
20
|
+
/** Sections that only need their own settings; allowed on every page. */
|
|
21
|
+
const contentSections = [
|
|
22
|
+
"hero",
|
|
23
|
+
"image-banner",
|
|
24
|
+
"slideshow",
|
|
25
|
+
"rich-text",
|
|
26
|
+
"image-with-text",
|
|
27
|
+
"multicolumn",
|
|
28
|
+
"testimonials",
|
|
29
|
+
"faq",
|
|
30
|
+
"video",
|
|
31
|
+
"logo-list",
|
|
32
|
+
];
|
|
33
|
+
/** Sections that load picked catalog data; the home page loads it. */
|
|
34
|
+
const dataSections = [
|
|
35
|
+
"featured-products",
|
|
36
|
+
"featured-collection",
|
|
37
|
+
"collection-list",
|
|
38
|
+
];
|
|
39
|
+
const homeLocation = ["template:home"];
|
|
40
|
+
const footerSections = ["hero", "rich-text", "multicolumn", "logo-list"];
|
|
41
|
+
const productBlockTypes = [
|
|
42
|
+
"product-title",
|
|
43
|
+
"product-price",
|
|
44
|
+
"product-options",
|
|
45
|
+
"product-buy",
|
|
46
|
+
"product-description",
|
|
47
|
+
"product-specs",
|
|
48
|
+
"product-collapsible",
|
|
49
|
+
"product-text",
|
|
50
|
+
];
|
|
51
|
+
/** The standard product page, in the order shoppers expect. */
|
|
52
|
+
const productPageBlocks = [
|
|
53
|
+
{ type: "product-title" },
|
|
54
|
+
{ type: "product-price" },
|
|
55
|
+
{ type: "product-options" },
|
|
56
|
+
{ type: "product-buy" },
|
|
57
|
+
{ type: "product-text" },
|
|
58
|
+
{ type: "product-description" },
|
|
59
|
+
{ type: "product-specs" },
|
|
60
|
+
{ type: "product-collapsible" },
|
|
61
|
+
];
|
|
62
|
+
const templates = Object.fromEntries([
|
|
63
|
+
["home", "home", "Home", "الرئيسية"],
|
|
64
|
+
["product.default", "product", "Product", "المنتج"],
|
|
65
|
+
["collection.default", "collection", "Collection", "المجموعة"],
|
|
66
|
+
["page.default", "page", "Page", "صفحة"],
|
|
67
|
+
["search", "search", "Search", "البحث"],
|
|
68
|
+
["cart", "cart", "Cart", "السلة"],
|
|
69
|
+
["not-found", "notFound", "Not found", "غير موجود"],
|
|
70
|
+
].map(([key, kind, en, ar]) => [
|
|
71
|
+
key,
|
|
72
|
+
{
|
|
73
|
+
kind,
|
|
74
|
+
label: label(en, ar),
|
|
75
|
+
allowedRootTypes: [
|
|
76
|
+
"products",
|
|
77
|
+
"product-detail",
|
|
78
|
+
...contentSections,
|
|
79
|
+
...(key === "home" ? dataSections : []),
|
|
80
|
+
...(key === "product.default" ? ["related-products"] : []),
|
|
81
|
+
],
|
|
82
|
+
maxRoots: 15,
|
|
83
|
+
},
|
|
84
|
+
]));
|
|
85
|
+
const link = (en, ar, href) => ({
|
|
86
|
+
label: label(en, ar),
|
|
87
|
+
href,
|
|
88
|
+
});
|
|
89
|
+
const color = (en, ar, value) => ({
|
|
90
|
+
kind: "color",
|
|
91
|
+
label: label(en, ar),
|
|
92
|
+
default: value,
|
|
93
|
+
});
|
|
94
|
+
/** Three palettes a section can pick from; the engine maps them to tokens. */
|
|
95
|
+
const schemes = [
|
|
96
|
+
["1", "Light", "فاتح", "#ffffff", "#241536", "#7042b0"],
|
|
97
|
+
["2", "Dark", "داكن", "#1d1429", "#f6f2fb", "#c9a7ff"],
|
|
98
|
+
["3", "Tinted", "ملوّن", "#f1e9fb", "#241536", "#58308e"],
|
|
99
|
+
];
|
|
100
|
+
const schemeSettings = Object.fromEntries(schemes.flatMap(([id, en, ar, background, text, accent]) => [
|
|
101
|
+
[
|
|
102
|
+
`scheme-${id}-background`,
|
|
103
|
+
color(`${en} scheme · background`, `نظام ${ar} · الخلفية`, background),
|
|
104
|
+
],
|
|
105
|
+
[
|
|
106
|
+
`scheme-${id}-text`,
|
|
107
|
+
color(`${en} scheme · text`, `نظام ${ar} · النص`, text),
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
`scheme-${id}-accent`,
|
|
111
|
+
color(`${en} scheme · accent`, `نظام ${ar} · اللون الأساسي`, accent),
|
|
112
|
+
],
|
|
113
|
+
]));
|
|
114
|
+
const schemeSetting = {
|
|
115
|
+
kind: "select",
|
|
116
|
+
label: label("Color scheme", "نظام الألوان"),
|
|
117
|
+
options: schemes.map(([id, en, ar]) => ({
|
|
118
|
+
value: `scheme-${id}`,
|
|
119
|
+
label: label(en, ar),
|
|
120
|
+
})),
|
|
121
|
+
default: "scheme-1",
|
|
122
|
+
};
|
|
123
|
+
const text = (en, ar, max = 200) => ({
|
|
124
|
+
kind: "localizedText",
|
|
125
|
+
label: label(en, ar),
|
|
126
|
+
maxLength: max,
|
|
127
|
+
default: label("", ""),
|
|
128
|
+
});
|
|
129
|
+
const optionsOf = (...items) => items.map(([value, en, ar]) => ({ value, label: label(en, ar) }));
|
|
130
|
+
const heightSetting = {
|
|
131
|
+
kind: "select",
|
|
132
|
+
label: label("Height", "الارتفاع"),
|
|
133
|
+
options: optionsOf(["small", "Small", "صغير"], ["medium", "Medium", "متوسط"], ["large", "Large", "كبير"]),
|
|
134
|
+
default: "medium",
|
|
135
|
+
};
|
|
136
|
+
const columnsSetting = (value) => ({
|
|
137
|
+
kind: "number",
|
|
138
|
+
label: label("Columns on desktop", "الأعمدة على الحاسوب"),
|
|
139
|
+
min: 1,
|
|
140
|
+
max: 6,
|
|
141
|
+
step: 1,
|
|
142
|
+
default: value,
|
|
143
|
+
});
|
|
144
|
+
const imageSetting = (en = "Image", ar = "الصورة") => ({
|
|
145
|
+
kind: "image",
|
|
146
|
+
label: label(en, ar),
|
|
147
|
+
default: null,
|
|
148
|
+
});
|
|
149
|
+
const linkSetting = (en = "Link", ar = "الرابط") => ({
|
|
150
|
+
kind: "link",
|
|
151
|
+
label: label(en, ar),
|
|
152
|
+
default: "",
|
|
153
|
+
});
|
|
154
|
+
const section = (en, ar, settings, extra = {}) => ({
|
|
155
|
+
kind: "section",
|
|
156
|
+
label: label(en, ar),
|
|
157
|
+
settings: { ...settings, scheme: schemeSetting },
|
|
158
|
+
allowedChildren: [],
|
|
159
|
+
maxChildren: 0,
|
|
160
|
+
allowedLocations: locations,
|
|
161
|
+
...extra,
|
|
162
|
+
});
|
|
163
|
+
const block = (en, ar, settings) => ({
|
|
164
|
+
kind: "block",
|
|
165
|
+
label: label(en, ar),
|
|
166
|
+
settings,
|
|
167
|
+
allowedChildren: [],
|
|
168
|
+
maxChildren: 0,
|
|
169
|
+
allowedLocations: locations,
|
|
170
|
+
});
|
|
171
|
+
const sampleText = (en, ar) => ({ en, ar });
|
|
172
|
+
/** Section and block types for the engine's default section library. */
|
|
173
|
+
const libraryNodeTypes = {
|
|
174
|
+
"announcement-bar": section("Announcement bar", "شريط الإعلان", {
|
|
175
|
+
text: {
|
|
176
|
+
...text("Text", "النص", 160),
|
|
177
|
+
default: label("Free shipping on orders over 1,000 EGP", "شحن مجاني للطلبات فوق 1000 جنيه"),
|
|
178
|
+
},
|
|
179
|
+
link: linkSetting(),
|
|
180
|
+
}, { allowedLocations: ["group:header"], maxInstances: 1 }),
|
|
181
|
+
"image-banner": section("Image banner", "بانر بصورة", {
|
|
182
|
+
image: imageSetting(),
|
|
183
|
+
height: heightSetting,
|
|
184
|
+
overlay: {
|
|
185
|
+
kind: "number",
|
|
186
|
+
label: label("Image overlay", "تعتيم الصورة"),
|
|
187
|
+
min: 0,
|
|
188
|
+
max: 90,
|
|
189
|
+
step: 10,
|
|
190
|
+
unit: "%",
|
|
191
|
+
default: 30,
|
|
192
|
+
},
|
|
193
|
+
align: {
|
|
194
|
+
kind: "select",
|
|
195
|
+
label: label("Content alignment", "محاذاة المحتوى"),
|
|
196
|
+
options: optionsOf(["start", "Start", "البداية"], ["center", "Center", "الوسط"]),
|
|
197
|
+
default: "center",
|
|
198
|
+
},
|
|
199
|
+
}, {
|
|
200
|
+
allowedChildren: ["heading", "text", "button"],
|
|
201
|
+
maxChildren: 6,
|
|
202
|
+
presets: [
|
|
203
|
+
{
|
|
204
|
+
label: label("Banner with heading and button", "بانر بعنوان وزر"),
|
|
205
|
+
blocks: [{ type: "heading" }, { type: "text" }, { type: "button" }],
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
}),
|
|
209
|
+
slideshow: section("Slideshow", "عرض الشرائح", {
|
|
210
|
+
height: heightSetting,
|
|
211
|
+
autoplay: {
|
|
212
|
+
kind: "boolean",
|
|
213
|
+
label: label("Change slides automatically", "تغيير الشرائح تلقائيًا"),
|
|
214
|
+
default: false,
|
|
215
|
+
},
|
|
216
|
+
interval: {
|
|
217
|
+
kind: "number",
|
|
218
|
+
label: label("Change every", "التغيير كل"),
|
|
219
|
+
min: 3,
|
|
220
|
+
max: 10,
|
|
221
|
+
step: 1,
|
|
222
|
+
unit: "s",
|
|
223
|
+
default: 5,
|
|
224
|
+
},
|
|
225
|
+
}, {
|
|
226
|
+
allowedChildren: ["slide"],
|
|
227
|
+
minChildren: 1,
|
|
228
|
+
maxChildren: 8,
|
|
229
|
+
presets: [
|
|
230
|
+
{
|
|
231
|
+
label: label("Two slides", "شريحتان"),
|
|
232
|
+
blocks: [{ type: "slide" }, { type: "slide" }],
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
}),
|
|
236
|
+
"rich-text": section("Rich text", "نص منسق", {
|
|
237
|
+
width: {
|
|
238
|
+
kind: "select",
|
|
239
|
+
label: label("Width", "العرض"),
|
|
240
|
+
options: optionsOf(["narrow", "Narrow", "ضيق"], ["wide", "Wide", "عريض"]),
|
|
241
|
+
default: "narrow",
|
|
242
|
+
},
|
|
243
|
+
align: {
|
|
244
|
+
kind: "select",
|
|
245
|
+
label: label("Alignment", "المحاذاة"),
|
|
246
|
+
options: optionsOf(["center", "Center", "الوسط"], ["start", "Start", "البداية"]),
|
|
247
|
+
default: "center",
|
|
248
|
+
},
|
|
249
|
+
}, {
|
|
250
|
+
allowedChildren: ["heading", "text", "button"],
|
|
251
|
+
maxChildren: 6,
|
|
252
|
+
presets: [
|
|
253
|
+
{
|
|
254
|
+
label: label("Heading and text", "عنوان ونص"),
|
|
255
|
+
blocks: [{ type: "heading" }, { type: "text" }],
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
}),
|
|
259
|
+
"image-with-text": section("Image with text", "صورة مع نص", {
|
|
260
|
+
image: imageSetting(),
|
|
261
|
+
layout: {
|
|
262
|
+
kind: "select",
|
|
263
|
+
label: label("Image position", "موضع الصورة"),
|
|
264
|
+
options: optionsOf(["image-start", "Image first", "الصورة أولًا"], ["image-end", "Image second", "الصورة ثانيًا"]),
|
|
265
|
+
default: "image-start",
|
|
266
|
+
},
|
|
267
|
+
}, {
|
|
268
|
+
allowedChildren: ["heading", "text", "button"],
|
|
269
|
+
maxChildren: 6,
|
|
270
|
+
presets: [
|
|
271
|
+
{
|
|
272
|
+
label: label("Story", "قصة"),
|
|
273
|
+
blocks: [{ type: "heading" }, { type: "text" }, { type: "button" }],
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
}),
|
|
277
|
+
multicolumn: section("Multicolumn", "أعمدة متعددة", { title: text("Heading", "العنوان"), columns: columnsSetting(3) }, {
|
|
278
|
+
allowedChildren: ["column"],
|
|
279
|
+
maxChildren: 12,
|
|
280
|
+
presets: [
|
|
281
|
+
{
|
|
282
|
+
label: label("Store benefits", "مزايا المتجر"),
|
|
283
|
+
blocks: [
|
|
284
|
+
{
|
|
285
|
+
type: "column",
|
|
286
|
+
settings: {
|
|
287
|
+
title: sampleText("Fast delivery", "توصيل سريع"),
|
|
288
|
+
text: sampleText("Delivered in 2–4 days.", "يصلك خلال 2–4 أيام."),
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
type: "column",
|
|
293
|
+
settings: {
|
|
294
|
+
title: sampleText("Easy returns", "إرجاع سهل"),
|
|
295
|
+
text: sampleText("14 days to change your mind.", "14 يومًا لتغيير رأيك."),
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
type: "column",
|
|
300
|
+
settings: {
|
|
301
|
+
title: sampleText("Secure payment", "دفع آمن"),
|
|
302
|
+
text: sampleText("Cards, wallets and cash on delivery.", "البطاقات والمحافظ والدفع عند الاستلام."),
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
}),
|
|
309
|
+
"featured-products": section("Featured products", "منتجات مختارة", {
|
|
310
|
+
title: {
|
|
311
|
+
...text("Heading", "العنوان"),
|
|
312
|
+
default: label("Featured products", "منتجات مختارة"),
|
|
313
|
+
},
|
|
314
|
+
products: {
|
|
315
|
+
kind: "resourceList",
|
|
316
|
+
label: label("Products", "المنتجات"),
|
|
317
|
+
resourceKind: "product",
|
|
318
|
+
maxItems: 12,
|
|
319
|
+
default: [],
|
|
320
|
+
},
|
|
321
|
+
columns: columnsSetting(4),
|
|
322
|
+
}, { allowedLocations: homeLocation }),
|
|
323
|
+
"featured-collection": section("Featured collection", "مجموعة مميزة", {
|
|
324
|
+
title: text("Heading (defaults to the collection name)", "العنوان (اسم المجموعة افتراضيًا)"),
|
|
325
|
+
collection: {
|
|
326
|
+
kind: "resource",
|
|
327
|
+
label: label("Collection", "المجموعة"),
|
|
328
|
+
resourceKind: "collection",
|
|
329
|
+
default: null,
|
|
330
|
+
},
|
|
331
|
+
limit: {
|
|
332
|
+
kind: "number",
|
|
333
|
+
label: label("Products to show", "عدد المنتجات"),
|
|
334
|
+
min: 1,
|
|
335
|
+
max: 12,
|
|
336
|
+
step: 1,
|
|
337
|
+
default: 4,
|
|
338
|
+
},
|
|
339
|
+
columns: columnsSetting(4),
|
|
340
|
+
}, { allowedLocations: homeLocation, maxInstances: 4 }),
|
|
341
|
+
"collection-list": section("Collection list", "قائمة المجموعات", {
|
|
342
|
+
title: {
|
|
343
|
+
...text("Heading", "العنوان"),
|
|
344
|
+
default: label("Shop by collection", "تسوق حسب المجموعة"),
|
|
345
|
+
},
|
|
346
|
+
collections: {
|
|
347
|
+
kind: "resourceList",
|
|
348
|
+
label: label("Collections", "المجموعات"),
|
|
349
|
+
resourceKind: "collection",
|
|
350
|
+
maxItems: 12,
|
|
351
|
+
default: [],
|
|
352
|
+
},
|
|
353
|
+
columns: columnsSetting(3),
|
|
354
|
+
}, { allowedLocations: homeLocation }),
|
|
355
|
+
testimonials: section("Testimonials", "آراء العملاء", {
|
|
356
|
+
title: {
|
|
357
|
+
...text("Heading", "العنوان"),
|
|
358
|
+
default: label("What customers say", "ماذا يقول عملاؤنا"),
|
|
359
|
+
},
|
|
360
|
+
columns: columnsSetting(3),
|
|
361
|
+
}, {
|
|
362
|
+
allowedChildren: ["testimonial"],
|
|
363
|
+
maxChildren: 12,
|
|
364
|
+
presets: [
|
|
365
|
+
{
|
|
366
|
+
label: label("Three reviews", "ثلاث مراجعات"),
|
|
367
|
+
blocks: [
|
|
368
|
+
{ type: "testimonial" },
|
|
369
|
+
{ type: "testimonial" },
|
|
370
|
+
{ type: "testimonial" },
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
}),
|
|
375
|
+
faq: section("FAQ", "الأسئلة الشائعة", {
|
|
376
|
+
title: {
|
|
377
|
+
...text("Heading", "العنوان"),
|
|
378
|
+
default: label("Frequently asked questions", "الأسئلة الشائعة"),
|
|
379
|
+
},
|
|
380
|
+
}, {
|
|
381
|
+
allowedChildren: ["faq-item"],
|
|
382
|
+
maxChildren: 30,
|
|
383
|
+
presets: [
|
|
384
|
+
{
|
|
385
|
+
label: label("Shipping and returns", "الشحن والإرجاع"),
|
|
386
|
+
blocks: [
|
|
387
|
+
{
|
|
388
|
+
type: "faq-item",
|
|
389
|
+
settings: {
|
|
390
|
+
question: sampleText("How long does delivery take?", "كم تستغرق مدة التوصيل؟"),
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
type: "faq-item",
|
|
395
|
+
settings: {
|
|
396
|
+
question: sampleText("Can I return an item?", "هل يمكنني إرجاع منتج؟"),
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
],
|
|
402
|
+
}),
|
|
403
|
+
video: section("Video", "فيديو", {
|
|
404
|
+
url: linkSetting("YouTube, Vimeo or MP4 link", "رابط يوتيوب أو فيميو أو MP4"),
|
|
405
|
+
poster: imageSetting("Cover image", "صورة الغلاف"),
|
|
406
|
+
title: text("Video title (for screen readers)", "عنوان الفيديو (لقارئات الشاشة)"),
|
|
407
|
+
}),
|
|
408
|
+
"logo-list": section("Logo list", "شعارات", { title: text("Heading", "العنوان") }, { allowedChildren: ["logo"], maxChildren: 16 }),
|
|
409
|
+
slide: block("Slide", "شريحة", {
|
|
410
|
+
image: imageSetting(),
|
|
411
|
+
heading: {
|
|
412
|
+
...text("Heading", "العنوان"),
|
|
413
|
+
default: label("New season", "الموسم الجديد"),
|
|
414
|
+
},
|
|
415
|
+
text: text("Text", "النص", 300),
|
|
416
|
+
"button-label": {
|
|
417
|
+
...text("Button label", "نص الزر", 60),
|
|
418
|
+
default: label("Shop now", "تسوق الآن"),
|
|
419
|
+
},
|
|
420
|
+
link: { ...linkSetting("Button link", "رابط الزر"), default: "/products" },
|
|
421
|
+
}),
|
|
422
|
+
column: block("Column", "عمود", {
|
|
423
|
+
image: imageSetting(),
|
|
424
|
+
title: { ...text("Heading", "العنوان"), default: label("Column", "عمود") },
|
|
425
|
+
text: text("Text", "النص", 500),
|
|
426
|
+
link: linkSetting(),
|
|
427
|
+
}),
|
|
428
|
+
testimonial: block("Testimonial", "رأي عميل", {
|
|
429
|
+
quote: {
|
|
430
|
+
...text("Quote", "الاقتباس", 600),
|
|
431
|
+
default: label("Great quality and fast delivery.", "جودة رائعة وتوصيل سريع."),
|
|
432
|
+
},
|
|
433
|
+
author: {
|
|
434
|
+
...text("Name", "الاسم", 80),
|
|
435
|
+
default: label("Customer", "عميل"),
|
|
436
|
+
},
|
|
437
|
+
rating: {
|
|
438
|
+
kind: "number",
|
|
439
|
+
label: label("Stars", "النجوم"),
|
|
440
|
+
min: 0,
|
|
441
|
+
max: 5,
|
|
442
|
+
step: 1,
|
|
443
|
+
default: 5,
|
|
444
|
+
},
|
|
445
|
+
}),
|
|
446
|
+
"faq-item": block("Question", "سؤال", {
|
|
447
|
+
question: {
|
|
448
|
+
...text("Question", "السؤال", 300),
|
|
449
|
+
default: label("Question", "سؤال"),
|
|
450
|
+
},
|
|
451
|
+
answer: {
|
|
452
|
+
kind: "richtext",
|
|
453
|
+
label: label("Answer", "الإجابة"),
|
|
454
|
+
default: [
|
|
455
|
+
{ type: "paragraph", children: [{ text: "Answer", marks: [] }] },
|
|
456
|
+
],
|
|
457
|
+
},
|
|
458
|
+
}),
|
|
459
|
+
logo: block("Logo", "شعار", {
|
|
460
|
+
image: imageSetting("Logo", "الشعار"),
|
|
461
|
+
link: linkSetting(),
|
|
462
|
+
}),
|
|
463
|
+
};
|
|
464
|
+
export const referenceEditor = {
|
|
465
|
+
settings: {
|
|
466
|
+
accent: {
|
|
467
|
+
kind: "color",
|
|
468
|
+
label: label("Accent color", "اللون الأساسي"),
|
|
469
|
+
default: "#7042b0",
|
|
470
|
+
},
|
|
471
|
+
"header-menu": {
|
|
472
|
+
kind: "menu",
|
|
473
|
+
label: label("Header menu", "قائمة الترويسة"),
|
|
474
|
+
maxItems: 30,
|
|
475
|
+
default: [
|
|
476
|
+
link("Products", "المنتجات", "/products"),
|
|
477
|
+
link("Categories", "الفئات", "/categories"),
|
|
478
|
+
link("Collections", "المجموعات", "/collections"),
|
|
479
|
+
link("Search", "البحث", "/search"),
|
|
480
|
+
],
|
|
481
|
+
},
|
|
482
|
+
"footer-menu": {
|
|
483
|
+
kind: "menu",
|
|
484
|
+
label: label("Footer menu", "قائمة التذييل"),
|
|
485
|
+
maxItems: 30,
|
|
486
|
+
default: [],
|
|
487
|
+
},
|
|
488
|
+
...schemeSettings,
|
|
489
|
+
font: {
|
|
490
|
+
kind: "font",
|
|
491
|
+
label: label("Text style", "نمط النص"),
|
|
492
|
+
options: [
|
|
493
|
+
{ value: "body", label: label("Body", "النص") },
|
|
494
|
+
{ value: "display", label: label("Display", "العناوين") },
|
|
495
|
+
],
|
|
496
|
+
default: "body",
|
|
497
|
+
},
|
|
498
|
+
featured: {
|
|
499
|
+
kind: "resource",
|
|
500
|
+
label: label("Featured product", "المنتج المميز"),
|
|
501
|
+
resourceKind: "product",
|
|
502
|
+
default: null,
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
nodeTypes: {
|
|
506
|
+
hero: {
|
|
507
|
+
kind: "section",
|
|
508
|
+
label: label("Introduction", "المقدمة"),
|
|
509
|
+
settings: {
|
|
510
|
+
scheme: schemeSetting,
|
|
511
|
+
// Optional override; when unset the color scheme's background applies.
|
|
512
|
+
background: {
|
|
513
|
+
kind: "color",
|
|
514
|
+
label: label("Custom background", "خلفية مخصصة"),
|
|
515
|
+
},
|
|
516
|
+
padding: {
|
|
517
|
+
kind: "responsive",
|
|
518
|
+
label: label("Vertical spacing", "المسافة الرأسية"),
|
|
519
|
+
min: 0,
|
|
520
|
+
max: 96,
|
|
521
|
+
step: 4,
|
|
522
|
+
unit: "px",
|
|
523
|
+
default: { base: 32, lg: 64 },
|
|
524
|
+
},
|
|
525
|
+
align: {
|
|
526
|
+
kind: "select",
|
|
527
|
+
label: label("Text alignment", "محاذاة النص"),
|
|
528
|
+
options: [
|
|
529
|
+
{ value: "start", label: label("Start", "البداية") },
|
|
530
|
+
{ value: "center", label: label("Center", "الوسط") },
|
|
531
|
+
],
|
|
532
|
+
default: "start",
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
allowedChildren: children,
|
|
536
|
+
maxChildren: 12,
|
|
537
|
+
allowedLocations: locations,
|
|
538
|
+
presets: [
|
|
539
|
+
{
|
|
540
|
+
label: label("Banner with button", "بانر مع زر"),
|
|
541
|
+
blocks: [{ type: "heading" }, { type: "text" }, { type: "button" }],
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
label: label("Announcement", "إعلان"),
|
|
545
|
+
settings: {
|
|
546
|
+
scheme: "scheme-2",
|
|
547
|
+
align: "center",
|
|
548
|
+
padding: { base: 12 },
|
|
549
|
+
},
|
|
550
|
+
blocks: [
|
|
551
|
+
{
|
|
552
|
+
type: "heading",
|
|
553
|
+
settings: {
|
|
554
|
+
text: label("Free delivery this week", "توصيل مجاني هذا الأسبوع"),
|
|
555
|
+
},
|
|
556
|
+
},
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
label: label("Image with text", "صورة مع نص"),
|
|
561
|
+
blocks: [
|
|
562
|
+
{ type: "image" },
|
|
563
|
+
{
|
|
564
|
+
type: "container",
|
|
565
|
+
blocks: [
|
|
566
|
+
{ type: "heading" },
|
|
567
|
+
{ type: "text" },
|
|
568
|
+
{ type: "button" },
|
|
569
|
+
],
|
|
570
|
+
},
|
|
571
|
+
],
|
|
572
|
+
},
|
|
573
|
+
],
|
|
574
|
+
},
|
|
575
|
+
products: {
|
|
576
|
+
kind: "section",
|
|
577
|
+
label: label("Product grid", "شبكة المنتجات"),
|
|
578
|
+
settings: {
|
|
579
|
+
title: localized("Heading", "العنوان", label("Explore products", "اكتشف المنتجات")),
|
|
580
|
+
"show-prices": {
|
|
581
|
+
kind: "boolean",
|
|
582
|
+
label: label("Show prices", "إظهار الأسعار"),
|
|
583
|
+
default: true,
|
|
584
|
+
},
|
|
585
|
+
scheme: schemeSetting,
|
|
586
|
+
},
|
|
587
|
+
allowedChildren: [],
|
|
588
|
+
maxChildren: 0,
|
|
589
|
+
allowedLocations: locations,
|
|
590
|
+
},
|
|
591
|
+
"product-detail": {
|
|
592
|
+
kind: "section",
|
|
593
|
+
label: label("Product information", "معلومات المنتج"),
|
|
594
|
+
settings: {
|
|
595
|
+
gallery: {
|
|
596
|
+
kind: "select",
|
|
597
|
+
label: label("Gallery layout", "شكل معرض الصور"),
|
|
598
|
+
options: [
|
|
599
|
+
{
|
|
600
|
+
value: "thumbnails",
|
|
601
|
+
label: label("Large image with thumbnails", "صورة كبيرة مع مصغرات"),
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
value: "grid",
|
|
605
|
+
label: label("All images in a grid", "كل الصور في شبكة"),
|
|
606
|
+
},
|
|
607
|
+
],
|
|
608
|
+
default: "thumbnails",
|
|
609
|
+
},
|
|
610
|
+
zoom: {
|
|
611
|
+
kind: "boolean",
|
|
612
|
+
label: label("Zoom images on click", "تكبير الصور عند النقر"),
|
|
613
|
+
default: true,
|
|
614
|
+
},
|
|
615
|
+
sticky: {
|
|
616
|
+
kind: "boolean",
|
|
617
|
+
label: label("Keep details visible while scrolling", "إبقاء التفاصيل ظاهرة أثناء التمرير"),
|
|
618
|
+
default: true,
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
// Without blocks the theme's own product page renders instead.
|
|
622
|
+
allowedChildren: productBlockTypes,
|
|
623
|
+
maxChildren: 16,
|
|
624
|
+
maxInstances: 1,
|
|
625
|
+
allowedLocations: ["template:product.default"],
|
|
626
|
+
presets: [
|
|
627
|
+
{
|
|
628
|
+
label: label("Standard product page", "صفحة منتج قياسية"),
|
|
629
|
+
blocks: productPageBlocks,
|
|
630
|
+
},
|
|
631
|
+
],
|
|
632
|
+
},
|
|
633
|
+
"related-products": {
|
|
634
|
+
kind: "section",
|
|
635
|
+
label: label("Related products", "منتجات مشابهة"),
|
|
636
|
+
settings: {
|
|
637
|
+
title: text("Heading (optional)", "العنوان (اختياري)"),
|
|
638
|
+
limit: {
|
|
639
|
+
kind: "number",
|
|
640
|
+
label: label("Products to show", "عدد المنتجات"),
|
|
641
|
+
min: 2,
|
|
642
|
+
max: 8,
|
|
643
|
+
step: 1,
|
|
644
|
+
default: 4,
|
|
645
|
+
},
|
|
646
|
+
columns: columnsSetting(4),
|
|
647
|
+
},
|
|
648
|
+
allowedChildren: [],
|
|
649
|
+
maxChildren: 0,
|
|
650
|
+
maxInstances: 1,
|
|
651
|
+
allowedLocations: ["template:product.default"],
|
|
652
|
+
},
|
|
653
|
+
"product-title": block("Title", "العنوان", {}),
|
|
654
|
+
"product-price": block("Price", "السعر", {
|
|
655
|
+
"show-badge": {
|
|
656
|
+
kind: "boolean",
|
|
657
|
+
label: label("Show sale badge", "إظهار شارة التخفيض"),
|
|
658
|
+
default: true,
|
|
659
|
+
},
|
|
660
|
+
}),
|
|
661
|
+
"product-options": block("Options (color, size…)", "الخيارات (اللون، المقاس…)", {}),
|
|
662
|
+
"product-buy": block("Buy buttons", "أزرار الشراء", {
|
|
663
|
+
quantity: {
|
|
664
|
+
kind: "boolean",
|
|
665
|
+
label: label("Show quantity", "إظهار الكمية"),
|
|
666
|
+
default: true,
|
|
667
|
+
},
|
|
668
|
+
"buy-now": {
|
|
669
|
+
kind: "boolean",
|
|
670
|
+
label: label("Show Buy now", "إظهار اشترِ الآن"),
|
|
671
|
+
default: true,
|
|
672
|
+
},
|
|
673
|
+
"low-stock": {
|
|
674
|
+
kind: "number",
|
|
675
|
+
label: label("Low stock warning at", "تنبيه انخفاض المخزون عند"),
|
|
676
|
+
min: 0,
|
|
677
|
+
max: 50,
|
|
678
|
+
step: 1,
|
|
679
|
+
default: 5,
|
|
680
|
+
},
|
|
681
|
+
}),
|
|
682
|
+
"product-description": block("Description", "الوصف", {
|
|
683
|
+
collapsed: {
|
|
684
|
+
kind: "boolean",
|
|
685
|
+
label: label("Show as a collapsible tab", "عرض كقسم قابل للطي"),
|
|
686
|
+
default: false,
|
|
687
|
+
},
|
|
688
|
+
}),
|
|
689
|
+
"product-specs": block("Specifications (custom fields)", "المواصفات (الحقول المخصصة)", {
|
|
690
|
+
title: text("Heading (optional)", "العنوان (اختياري)"),
|
|
691
|
+
}),
|
|
692
|
+
"product-collapsible": block("Collapsible tab", "قسم قابل للطي", {
|
|
693
|
+
title: {
|
|
694
|
+
...text("Heading", "العنوان"),
|
|
695
|
+
default: label("Shipping & returns", "الشحن والإرجاع"),
|
|
696
|
+
},
|
|
697
|
+
body: {
|
|
698
|
+
kind: "richtext",
|
|
699
|
+
label: label("Content", "المحتوى"),
|
|
700
|
+
default: [
|
|
701
|
+
{
|
|
702
|
+
type: "paragraph",
|
|
703
|
+
children: [
|
|
704
|
+
{
|
|
705
|
+
text: "Free delivery on orders over 1,000 EGP. Returns within 14 days.",
|
|
706
|
+
marks: [],
|
|
707
|
+
},
|
|
708
|
+
],
|
|
709
|
+
},
|
|
710
|
+
],
|
|
711
|
+
},
|
|
712
|
+
open: {
|
|
713
|
+
kind: "boolean",
|
|
714
|
+
label: label("Open by default", "مفتوح افتراضيًا"),
|
|
715
|
+
default: false,
|
|
716
|
+
},
|
|
717
|
+
}),
|
|
718
|
+
"product-text": block("Text", "نص", {
|
|
719
|
+
text: {
|
|
720
|
+
...text("Text", "النص", 300),
|
|
721
|
+
default: label("Free delivery on orders over 1,000 EGP", "توصيل مجاني للطلبات فوق 1000 جنيه"),
|
|
722
|
+
},
|
|
723
|
+
style: {
|
|
724
|
+
kind: "select",
|
|
725
|
+
label: label("Style", "النمط"),
|
|
726
|
+
options: [
|
|
727
|
+
{ value: "plain", label: label("Plain", "عادي") },
|
|
728
|
+
{ value: "highlight", label: label("Highlighted", "مميز") },
|
|
729
|
+
],
|
|
730
|
+
default: "highlight",
|
|
731
|
+
},
|
|
732
|
+
}),
|
|
733
|
+
heading: {
|
|
734
|
+
kind: "block",
|
|
735
|
+
label: label("Heading", "العنوان"),
|
|
736
|
+
settings: {
|
|
737
|
+
text: localized("Heading text", "نص العنوان", label("Welcome to our store", "مرحبًا بك في متجرنا")),
|
|
738
|
+
},
|
|
739
|
+
allowedChildren: [],
|
|
740
|
+
maxChildren: 0,
|
|
741
|
+
allowedLocations: locations,
|
|
742
|
+
},
|
|
743
|
+
text: {
|
|
744
|
+
kind: "block",
|
|
745
|
+
label: label("Text", "النص"),
|
|
746
|
+
settings: {
|
|
747
|
+
body: {
|
|
748
|
+
kind: "richtext",
|
|
749
|
+
label: label("Content", "المحتوى"),
|
|
750
|
+
default: [
|
|
751
|
+
{
|
|
752
|
+
type: "paragraph",
|
|
753
|
+
children: [{ text: "Explore the collection.", marks: [] }],
|
|
754
|
+
},
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
},
|
|
758
|
+
allowedChildren: [],
|
|
759
|
+
maxChildren: 0,
|
|
760
|
+
allowedLocations: locations,
|
|
761
|
+
},
|
|
762
|
+
button: {
|
|
763
|
+
kind: "block",
|
|
764
|
+
label: label("Button", "الزر"),
|
|
765
|
+
settings: {
|
|
766
|
+
label: localized("Button label", "نص الزر", label("Browse products", "تصفح المنتجات")),
|
|
767
|
+
href: {
|
|
768
|
+
kind: "link",
|
|
769
|
+
label: label("Destination", "الوجهة"),
|
|
770
|
+
default: "/products",
|
|
771
|
+
},
|
|
772
|
+
},
|
|
773
|
+
allowedChildren: [],
|
|
774
|
+
maxChildren: 0,
|
|
775
|
+
allowedLocations: locations,
|
|
776
|
+
},
|
|
777
|
+
image: {
|
|
778
|
+
kind: "block",
|
|
779
|
+
label: label("Image", "الصورة"),
|
|
780
|
+
settings: {
|
|
781
|
+
image: {
|
|
782
|
+
kind: "image",
|
|
783
|
+
label: label("Image", "الصورة"),
|
|
784
|
+
default: null,
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
allowedChildren: [],
|
|
788
|
+
maxChildren: 0,
|
|
789
|
+
allowedLocations: locations,
|
|
790
|
+
},
|
|
791
|
+
...libraryNodeTypes,
|
|
792
|
+
container: {
|
|
793
|
+
kind: "block",
|
|
794
|
+
label: label("Group", "المجموعة"),
|
|
795
|
+
settings: {},
|
|
796
|
+
allowedChildren: children,
|
|
797
|
+
maxChildren: 12,
|
|
798
|
+
allowedLocations: locations,
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
templates,
|
|
802
|
+
groups: {
|
|
803
|
+
header: {
|
|
804
|
+
label: label("Header", "الترويسة"),
|
|
805
|
+
allowedRootTypes: ["hero", "announcement-bar"],
|
|
806
|
+
maxRoots: 3,
|
|
807
|
+
},
|
|
808
|
+
footer: {
|
|
809
|
+
label: label("Footer", "التذييل"),
|
|
810
|
+
allowedRootTypes: footerSections,
|
|
811
|
+
maxRoots: 4,
|
|
812
|
+
},
|
|
813
|
+
},
|
|
814
|
+
};
|
|
815
|
+
export function referenceDefaults(themeId) {
|
|
816
|
+
return {
|
|
817
|
+
schemaVersion: 2,
|
|
818
|
+
configurationVersion: 1,
|
|
819
|
+
themeId,
|
|
820
|
+
settings: {},
|
|
821
|
+
groups: { header: { roots: [] }, footer: { roots: [] } },
|
|
822
|
+
templates: Object.fromEntries(Object.keys(templates).map((key) => [
|
|
823
|
+
key,
|
|
824
|
+
{
|
|
825
|
+
roots: key === "home"
|
|
826
|
+
? ["home.hero", "home.products"]
|
|
827
|
+
: key === "product.default"
|
|
828
|
+
? ["product.detail", "product.related"]
|
|
829
|
+
: [],
|
|
830
|
+
},
|
|
831
|
+
])),
|
|
832
|
+
nodes: [
|
|
833
|
+
{
|
|
834
|
+
id: "home.hero",
|
|
835
|
+
type: "hero",
|
|
836
|
+
parent: null,
|
|
837
|
+
children: ["home.heading", "home.text", "home.button"],
|
|
838
|
+
settings: {},
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
id: "home.heading",
|
|
842
|
+
type: "heading",
|
|
843
|
+
parent: "home.hero",
|
|
844
|
+
children: [],
|
|
845
|
+
settings: {},
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
id: "home.text",
|
|
849
|
+
type: "text",
|
|
850
|
+
parent: "home.hero",
|
|
851
|
+
children: [],
|
|
852
|
+
settings: {},
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
id: "home.button",
|
|
856
|
+
type: "button",
|
|
857
|
+
parent: "home.hero",
|
|
858
|
+
children: [],
|
|
859
|
+
settings: {},
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
id: "home.products",
|
|
863
|
+
type: "products",
|
|
864
|
+
parent: null,
|
|
865
|
+
children: [],
|
|
866
|
+
settings: {},
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
id: "product.detail",
|
|
870
|
+
type: "product-detail",
|
|
871
|
+
parent: null,
|
|
872
|
+
children: productPageBlocks.map((_, index) => `product.block.${index}`),
|
|
873
|
+
settings: {},
|
|
874
|
+
},
|
|
875
|
+
...productPageBlocks.map((block, index) => ({
|
|
876
|
+
id: `product.block.${index}`,
|
|
877
|
+
type: block.type,
|
|
878
|
+
parent: "product.detail",
|
|
879
|
+
children: [],
|
|
880
|
+
settings: {},
|
|
881
|
+
})),
|
|
882
|
+
{
|
|
883
|
+
id: "product.related",
|
|
884
|
+
type: "related-products",
|
|
885
|
+
parent: null,
|
|
886
|
+
children: [],
|
|
887
|
+
settings: {},
|
|
888
|
+
},
|
|
889
|
+
],
|
|
890
|
+
assignments: [],
|
|
891
|
+
};
|
|
892
|
+
}
|