@builder.io/sdk-qwik 0.0.31 → 0.0.32
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/lib/index.qwik.cjs +27 -6
- package/lib/index.qwik.mjs +27 -6
- package/package.json +7 -1
- package/types/blocks/avatar/avatar.d.ts +267 -0
- package/types/blocks/avatar/avatar.model.d.ts +19 -0
- package/types/functions/get-block-bindings.d.ts +2 -0
- package/types/functions/get-block-styles.d.ts +1 -5
- package/types-hacks.d.ts +0 -13
package/lib/index.qwik.cjs
CHANGED
|
@@ -374,6 +374,28 @@ function getBlockActions(options) {
|
|
|
374
374
|
return obj;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
function getBlockBindings(state, block) {
|
|
378
|
+
const props = {};
|
|
379
|
+
const bindings = block.bindings;
|
|
380
|
+
if (bindings) for(const key in bindings){
|
|
381
|
+
if (key.startsWith('component.')) ;
|
|
382
|
+
else if (key.startsWith('style.')) {
|
|
383
|
+
const styleKey = key.substring(6);
|
|
384
|
+
const style = props.style || (props.style = {});
|
|
385
|
+
style[styleKey] = evaluate({
|
|
386
|
+
code: bindings[key],
|
|
387
|
+
state,
|
|
388
|
+
context: {}
|
|
389
|
+
});
|
|
390
|
+
} else props[key] = evaluate({
|
|
391
|
+
code: bindings[key],
|
|
392
|
+
state,
|
|
393
|
+
context: {}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
return props;
|
|
397
|
+
}
|
|
398
|
+
|
|
377
399
|
function getBlockComponentOptions(block) {
|
|
378
400
|
return {
|
|
379
401
|
...block.component?.options,
|
|
@@ -580,6 +602,7 @@ const useBlock = function useBlock(props, state) {
|
|
|
580
602
|
const attributes = function attributes(props, state) {
|
|
581
603
|
return {
|
|
582
604
|
...getBlockProperties(useBlock(props)),
|
|
605
|
+
...getBlockBindings(props.context.state, useBlock(props)),
|
|
583
606
|
...getBlockActions({
|
|
584
607
|
block: useBlock(props),
|
|
585
608
|
state: props.context.state,
|
|
@@ -1000,8 +1023,8 @@ const Image = /*#__PURE__*/ qwik.componentQrl(qwik.inlinedQrl((props)=>{
|
|
|
1000
1023
|
props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent) ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
1001
1024
|
class: "builder-image-sizer div-Image",
|
|
1002
1025
|
style: {
|
|
1003
|
-
|
|
1004
|
-
props.aspectRatio * 100 + "%"
|
|
1026
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1027
|
+
paddingTop: props.aspectRatio * 100 + "%"
|
|
1005
1028
|
}
|
|
1006
1029
|
}) : null,
|
|
1007
1030
|
props.builderBlock?.children?.length && props.fitContent ? /*#__PURE__*/ jsxRuntime.jsx(qwik.Slot, {}) : null,
|
|
@@ -2544,7 +2567,7 @@ const getCssFromFont = function getCssFromFont(props, state, font) {
|
|
|
2544
2567
|
if (font.files) for(const weight in font.files){
|
|
2545
2568
|
const isNumber = String(Number(weight)) === weight;
|
|
2546
2569
|
if (!isNumber) continue;
|
|
2547
|
-
|
|
2570
|
+
// TODO: maybe limit number loaded
|
|
2548
2571
|
const weightUrl = font.files[weight];
|
|
2549
2572
|
if (weightUrl && weightUrl !== url) str += `
|
|
2550
2573
|
@font-face {
|
|
@@ -2610,7 +2633,6 @@ const contextContext = function contextContext(props, state, elementRef) {
|
|
|
2610
2633
|
const allRegisteredComponents = function allRegisteredComponents(props, state, elementRef) {
|
|
2611
2634
|
const allComponentsArray = [
|
|
2612
2635
|
...getDefaultRegisteredComponents(),
|
|
2613
|
-
// While this `components` object is deprecated, we must maintain support for it.
|
|
2614
2636
|
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
2615
2637
|
// existing usage.
|
|
2616
2638
|
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
@@ -2757,8 +2779,7 @@ const RenderContent = /*#__PURE__*/ qwik.componentQrl(qwik.inlinedQrl((props)=>{
|
|
|
2757
2779
|
apiKey: props.apiKey,
|
|
2758
2780
|
variationId: variationId !== contentId ? variationId : undefined
|
|
2759
2781
|
});
|
|
2760
|
-
}
|
|
2761
|
-
// override normal content in preview mode
|
|
2782
|
+
} // override normal content in preview mode
|
|
2762
2783
|
if (isPreviewing()) {
|
|
2763
2784
|
const searchParams = new URL(location.href).searchParams;
|
|
2764
2785
|
if (props.model && searchParams.get("builder.preview") === props.model) {
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -370,6 +370,28 @@ function getBlockActions(options) {
|
|
|
370
370
|
return obj;
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
function getBlockBindings(state, block) {
|
|
374
|
+
const props = {};
|
|
375
|
+
const bindings = block.bindings;
|
|
376
|
+
if (bindings) for(const key in bindings){
|
|
377
|
+
if (key.startsWith('component.')) ;
|
|
378
|
+
else if (key.startsWith('style.')) {
|
|
379
|
+
const styleKey = key.substring(6);
|
|
380
|
+
const style = props.style || (props.style = {});
|
|
381
|
+
style[styleKey] = evaluate({
|
|
382
|
+
code: bindings[key],
|
|
383
|
+
state,
|
|
384
|
+
context: {}
|
|
385
|
+
});
|
|
386
|
+
} else props[key] = evaluate({
|
|
387
|
+
code: bindings[key],
|
|
388
|
+
state,
|
|
389
|
+
context: {}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
return props;
|
|
393
|
+
}
|
|
394
|
+
|
|
373
395
|
function getBlockComponentOptions(block) {
|
|
374
396
|
return {
|
|
375
397
|
...block.component?.options,
|
|
@@ -576,6 +598,7 @@ const useBlock = function useBlock(props, state) {
|
|
|
576
598
|
const attributes = function attributes(props, state) {
|
|
577
599
|
return {
|
|
578
600
|
...getBlockProperties(useBlock(props)),
|
|
601
|
+
...getBlockBindings(props.context.state, useBlock(props)),
|
|
579
602
|
...getBlockActions({
|
|
580
603
|
block: useBlock(props),
|
|
581
604
|
state: props.context.state,
|
|
@@ -996,8 +1019,8 @@ const Image = /*#__PURE__*/ componentQrl(inlinedQrl((props)=>{
|
|
|
996
1019
|
props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent) ? /*#__PURE__*/ jsx("div", {
|
|
997
1020
|
class: "builder-image-sizer div-Image",
|
|
998
1021
|
style: {
|
|
999
|
-
|
|
1000
|
-
props.aspectRatio * 100 + "%"
|
|
1022
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1023
|
+
paddingTop: props.aspectRatio * 100 + "%"
|
|
1001
1024
|
}
|
|
1002
1025
|
}) : null,
|
|
1003
1026
|
props.builderBlock?.children?.length && props.fitContent ? /*#__PURE__*/ jsx(Slot, {}) : null,
|
|
@@ -2540,7 +2563,7 @@ const getCssFromFont = function getCssFromFont(props, state, font) {
|
|
|
2540
2563
|
if (font.files) for(const weight in font.files){
|
|
2541
2564
|
const isNumber = String(Number(weight)) === weight;
|
|
2542
2565
|
if (!isNumber) continue;
|
|
2543
|
-
|
|
2566
|
+
// TODO: maybe limit number loaded
|
|
2544
2567
|
const weightUrl = font.files[weight];
|
|
2545
2568
|
if (weightUrl && weightUrl !== url) str += `
|
|
2546
2569
|
@font-face {
|
|
@@ -2606,7 +2629,6 @@ const contextContext = function contextContext(props, state, elementRef) {
|
|
|
2606
2629
|
const allRegisteredComponents = function allRegisteredComponents(props, state, elementRef) {
|
|
2607
2630
|
const allComponentsArray = [
|
|
2608
2631
|
...getDefaultRegisteredComponents(),
|
|
2609
|
-
// While this `components` object is deprecated, we must maintain support for it.
|
|
2610
2632
|
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
2611
2633
|
// existing usage.
|
|
2612
2634
|
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
@@ -2753,8 +2775,7 @@ const RenderContent = /*#__PURE__*/ componentQrl(inlinedQrl((props)=>{
|
|
|
2753
2775
|
apiKey: props.apiKey,
|
|
2754
2776
|
variationId: variationId !== contentId ? variationId : undefined
|
|
2755
2777
|
});
|
|
2756
|
-
}
|
|
2757
|
-
// override normal content in preview mode
|
|
2778
|
+
} // override normal content in preview mode
|
|
2758
2779
|
if (isPreviewing()) {
|
|
2759
2780
|
const searchParams = new URL(location.href).searchParams;
|
|
2760
2781
|
if (props.model && searchParams.get("builder.preview") === props.model) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-qwik",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Builder.io Qwik SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.qwik.cjs",
|
|
7
7
|
"module": "./lib/index.qwik.mjs",
|
|
8
8
|
"qwik": "./lib/index.qwik.mjs",
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"lib",
|
|
12
|
+
"types",
|
|
13
|
+
"README.md",
|
|
14
|
+
"package.json"
|
|
15
|
+
],
|
|
10
16
|
"exports": {
|
|
11
17
|
".": {
|
|
12
18
|
"import": "./lib/index.qwik.mjs",
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
export declare const avatarService: any;
|
|
2
|
+
export declare const Avatar: import("@builder.io/qwik").Component<any>;
|
|
3
|
+
export default Avatar;
|
|
4
|
+
export declare const COMPONENT: {
|
|
5
|
+
"@type": string;
|
|
6
|
+
children: {
|
|
7
|
+
"@type": string;
|
|
8
|
+
bindings: {
|
|
9
|
+
when: {
|
|
10
|
+
code: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
children: ({
|
|
14
|
+
"@type": string;
|
|
15
|
+
bindings: {
|
|
16
|
+
class?: undefined;
|
|
17
|
+
title?: undefined;
|
|
18
|
+
};
|
|
19
|
+
children: never[];
|
|
20
|
+
meta: {};
|
|
21
|
+
name: string;
|
|
22
|
+
properties: {
|
|
23
|
+
_text: string;
|
|
24
|
+
};
|
|
25
|
+
scope: {};
|
|
26
|
+
} | {
|
|
27
|
+
"@type": string;
|
|
28
|
+
bindings: {
|
|
29
|
+
class: {
|
|
30
|
+
code: string;
|
|
31
|
+
};
|
|
32
|
+
title: {
|
|
33
|
+
code: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
children: ({
|
|
37
|
+
"@type": string;
|
|
38
|
+
bindings: {
|
|
39
|
+
when?: undefined;
|
|
40
|
+
};
|
|
41
|
+
children: never[];
|
|
42
|
+
meta: {};
|
|
43
|
+
name: string;
|
|
44
|
+
properties: {
|
|
45
|
+
_text: string;
|
|
46
|
+
};
|
|
47
|
+
scope: {};
|
|
48
|
+
} | {
|
|
49
|
+
"@type": string;
|
|
50
|
+
bindings: {
|
|
51
|
+
when: {
|
|
52
|
+
code: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
children: ({
|
|
56
|
+
"@type": string;
|
|
57
|
+
bindings: {
|
|
58
|
+
class?: undefined;
|
|
59
|
+
style?: undefined;
|
|
60
|
+
};
|
|
61
|
+
children: never[];
|
|
62
|
+
meta: {};
|
|
63
|
+
name: string;
|
|
64
|
+
properties: {
|
|
65
|
+
_text: string;
|
|
66
|
+
};
|
|
67
|
+
scope: {};
|
|
68
|
+
} | {
|
|
69
|
+
"@type": string;
|
|
70
|
+
bindings: {
|
|
71
|
+
class: {
|
|
72
|
+
code: string;
|
|
73
|
+
};
|
|
74
|
+
style: {
|
|
75
|
+
code: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
children: ({
|
|
79
|
+
"@type": string;
|
|
80
|
+
bindings: {
|
|
81
|
+
when?: undefined;
|
|
82
|
+
};
|
|
83
|
+
children: never[];
|
|
84
|
+
meta: {};
|
|
85
|
+
name: string;
|
|
86
|
+
properties: {
|
|
87
|
+
_text: string;
|
|
88
|
+
};
|
|
89
|
+
scope: {};
|
|
90
|
+
} | {
|
|
91
|
+
"@type": string;
|
|
92
|
+
bindings: {
|
|
93
|
+
when: {
|
|
94
|
+
code: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
children: ({
|
|
98
|
+
"@type": string;
|
|
99
|
+
bindings: {
|
|
100
|
+
alt?: undefined;
|
|
101
|
+
src?: undefined;
|
|
102
|
+
};
|
|
103
|
+
children: never[];
|
|
104
|
+
meta: {};
|
|
105
|
+
name: string;
|
|
106
|
+
properties: {
|
|
107
|
+
_text: string;
|
|
108
|
+
class?: undefined;
|
|
109
|
+
};
|
|
110
|
+
scope: {};
|
|
111
|
+
} | {
|
|
112
|
+
"@type": string;
|
|
113
|
+
bindings: {
|
|
114
|
+
alt: {
|
|
115
|
+
code: string;
|
|
116
|
+
};
|
|
117
|
+
src: {
|
|
118
|
+
code: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
children: never[];
|
|
122
|
+
meta: {};
|
|
123
|
+
name: string;
|
|
124
|
+
properties: {
|
|
125
|
+
class: string;
|
|
126
|
+
_text?: undefined;
|
|
127
|
+
};
|
|
128
|
+
scope: {};
|
|
129
|
+
})[];
|
|
130
|
+
meta: {};
|
|
131
|
+
name: string;
|
|
132
|
+
properties: {
|
|
133
|
+
_text?: undefined;
|
|
134
|
+
};
|
|
135
|
+
scope: {};
|
|
136
|
+
} | {
|
|
137
|
+
"@type": string;
|
|
138
|
+
bindings: {
|
|
139
|
+
when: {
|
|
140
|
+
code: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
children: ({
|
|
144
|
+
"@type": string;
|
|
145
|
+
bindings: {};
|
|
146
|
+
children: never[];
|
|
147
|
+
meta: {};
|
|
148
|
+
name: string;
|
|
149
|
+
properties: {
|
|
150
|
+
_text: string;
|
|
151
|
+
};
|
|
152
|
+
scope: {};
|
|
153
|
+
} | {
|
|
154
|
+
"@type": string;
|
|
155
|
+
bindings: {};
|
|
156
|
+
children: {
|
|
157
|
+
"@type": string;
|
|
158
|
+
bindings: {
|
|
159
|
+
_text: {
|
|
160
|
+
code: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
children: never[];
|
|
164
|
+
meta: {};
|
|
165
|
+
name: string;
|
|
166
|
+
properties: {};
|
|
167
|
+
scope: {};
|
|
168
|
+
}[];
|
|
169
|
+
meta: {};
|
|
170
|
+
name: string;
|
|
171
|
+
properties: {
|
|
172
|
+
_text?: undefined;
|
|
173
|
+
};
|
|
174
|
+
scope: {};
|
|
175
|
+
})[];
|
|
176
|
+
meta: {};
|
|
177
|
+
name: string;
|
|
178
|
+
properties: {
|
|
179
|
+
_text?: undefined;
|
|
180
|
+
};
|
|
181
|
+
scope: {};
|
|
182
|
+
})[];
|
|
183
|
+
meta: {};
|
|
184
|
+
name: string;
|
|
185
|
+
properties: {
|
|
186
|
+
_text?: undefined;
|
|
187
|
+
};
|
|
188
|
+
scope: {};
|
|
189
|
+
})[];
|
|
190
|
+
meta: {};
|
|
191
|
+
name: string;
|
|
192
|
+
properties: {
|
|
193
|
+
_text?: undefined;
|
|
194
|
+
};
|
|
195
|
+
scope: {};
|
|
196
|
+
})[];
|
|
197
|
+
meta: {};
|
|
198
|
+
name: string;
|
|
199
|
+
properties: {
|
|
200
|
+
_text?: undefined;
|
|
201
|
+
};
|
|
202
|
+
scope: {};
|
|
203
|
+
})[];
|
|
204
|
+
meta: {};
|
|
205
|
+
name: string;
|
|
206
|
+
properties: {};
|
|
207
|
+
scope: {};
|
|
208
|
+
}[];
|
|
209
|
+
context: {
|
|
210
|
+
get: {};
|
|
211
|
+
set: {};
|
|
212
|
+
};
|
|
213
|
+
exports: {
|
|
214
|
+
avatarService: {
|
|
215
|
+
code: string;
|
|
216
|
+
isFunction: boolean;
|
|
217
|
+
usedInLocal: boolean;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
hooks: {
|
|
221
|
+
onMount: {
|
|
222
|
+
code: string;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
imports: {
|
|
226
|
+
imports: {};
|
|
227
|
+
path: string;
|
|
228
|
+
}[];
|
|
229
|
+
inputs: never[];
|
|
230
|
+
meta: {
|
|
231
|
+
useMetadata: {
|
|
232
|
+
isAttachedToShadowDom: boolean;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
name: string;
|
|
236
|
+
propsTypeRef: string;
|
|
237
|
+
refs: {};
|
|
238
|
+
state: {
|
|
239
|
+
classes: {
|
|
240
|
+
code: {
|
|
241
|
+
base: string;
|
|
242
|
+
container: string;
|
|
243
|
+
};
|
|
244
|
+
type: string;
|
|
245
|
+
};
|
|
246
|
+
initials: {
|
|
247
|
+
code: null;
|
|
248
|
+
type: string;
|
|
249
|
+
};
|
|
250
|
+
loaded: {
|
|
251
|
+
code: boolean;
|
|
252
|
+
type: string;
|
|
253
|
+
};
|
|
254
|
+
source: {
|
|
255
|
+
code: null;
|
|
256
|
+
type: string;
|
|
257
|
+
};
|
|
258
|
+
styles: {
|
|
259
|
+
code: {
|
|
260
|
+
container: null;
|
|
261
|
+
};
|
|
262
|
+
type: string;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
subComponents: never[];
|
|
266
|
+
types: string[];
|
|
267
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseProps, BaseState, CSS, Dynamic, Variant } from '~/models';
|
|
2
|
+
export declare type AvatarProps = {
|
|
3
|
+
variant?: Dynamic<Variant>;
|
|
4
|
+
name?: string;
|
|
5
|
+
unavatar?: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
} & BaseProps;
|
|
9
|
+
export declare type AvatarState = {
|
|
10
|
+
classes: {
|
|
11
|
+
base: string;
|
|
12
|
+
container: string;
|
|
13
|
+
};
|
|
14
|
+
styles: {
|
|
15
|
+
container: CSS;
|
|
16
|
+
};
|
|
17
|
+
initials: string;
|
|
18
|
+
source: string;
|
|
19
|
+
} & BaseState;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import type { BuilderContextInterface } from '../context/types.js';
|
|
2
1
|
import type { BuilderBlock } from '../types/builder-block.js';
|
|
3
|
-
export declare function getBlockStyles(
|
|
4
|
-
block: BuilderBlock;
|
|
5
|
-
context: BuilderContextInterface;
|
|
6
|
-
}): Partial<CSSStyleDeclaration>;
|
|
2
|
+
export declare function getBlockStyles(block: BuilderBlock): Partial<CSSStyleDeclaration>;
|
package/types-hacks.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type Dictionary<T> = Record<string, T>;
|
|
2
|
-
type BuilderContent = any;
|
|
3
|
-
type BuilderBlock = any;
|
|
4
|
-
type RegisteredComponent = any;
|
|
5
|
-
type RegisteredComponents = any;
|
|
6
|
-
declare const builder: { env: 'dev'; apiKey: string };
|
|
7
|
-
// TODO(misko): HACKS to be removed
|
|
8
|
-
declare const get: (obj: any, key: string) => any;
|
|
9
|
-
declare const set: (obj: any, key: string, value: any) => void;
|
|
10
|
-
interface CSSProperties {
|
|
11
|
-
flexDirection: any;
|
|
12
|
-
}
|
|
13
|
-
declare const BuilderBlocks: (props: any) => any;
|