@teambit/schema 1.0.166 → 1.0.168
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/artifacts/__bit_junit.xml +3 -3
- package/artifacts/preview/teambit_semantics_schema-preview.js +1 -1
- package/artifacts/schema.json +5 -5
- package/dist/mock/button/index.d.ts +30 -0
- package/dist/mock/button/index.js +67 -2
- package/dist/mock/button/index.js.map +1 -1
- package/dist/mock/button-schemas.json +930 -0
- package/dist/preview-1708259356169.js +8 -0
- package/mock/button/index.ts +68 -0
- package/mock/button-schemas.json +930 -0
- package/package.json +11 -11
- package/dist/preview-1707880563763.js +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as compositions_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/95c2f3515392701f327019ce43202e7563a02128/teambit.semantics_schema@1.0.168/dist/schema.composition.js';
|
|
2
|
+
import * as compositions_1 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/95c2f3515392701f327019ce43202e7563a02128/teambit.semantics_schema@1.0.168/dist/mock/button/button.composition.js';
|
|
3
|
+
import * as overview_0 from '/Users/giladshoham/Library/Caches/Bit/capsules/root/95c2f3515392701f327019ce43202e7563a02128/teambit.semantics_schema@1.0.168/dist/schema.docs.mdx';
|
|
4
|
+
|
|
5
|
+
export const compositions = [compositions_0, compositions_1];
|
|
6
|
+
export const overview = [overview_0];
|
|
7
|
+
|
|
8
|
+
export const compositions_metadata = {"compositions":[{"displayName":"Logo","identifier":"Logo"},{"displayName":"Basic button","identifier":"BasicButton"},{"displayName":"Footer","identifier":"Footer"},{"displayName":"Button with custom styles","identifier":"ButtonWithCustomStyles"},{"displayName":"Button with icon","identifier":"ButtonWithIcon"},{"displayName":"Button as a link","identifier":"ButtonAsALink"}]};
|
package/mock/button/index.ts
CHANGED
|
@@ -131,3 +131,71 @@ export function genericFunction<T>(a: T) {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
export const gfnc2 = genericFunction<string>('');
|
|
134
|
+
|
|
135
|
+
export function LogMethod(message: string) {
|
|
136
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
137
|
+
const originalMethod = descriptor.value;
|
|
138
|
+
descriptor.value = function (...args: any[]) {
|
|
139
|
+
console.log(`Logging: ${message}`);
|
|
140
|
+
return originalMethod.apply(this, args);
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function CustomClassDecorator(config: {
|
|
146
|
+
name: string;
|
|
147
|
+
description: string;
|
|
148
|
+
fn?: () => string;
|
|
149
|
+
class?: ClassSomething;
|
|
150
|
+
arr?: [
|
|
151
|
+
string,
|
|
152
|
+
number,
|
|
153
|
+
boolean,
|
|
154
|
+
boolean,
|
|
155
|
+
number | undefined,
|
|
156
|
+
(a: string) => void,
|
|
157
|
+
{ a: string; b: number },
|
|
158
|
+
ClassSomething
|
|
159
|
+
];
|
|
160
|
+
}) {
|
|
161
|
+
return function (target: any) {
|
|
162
|
+
console.log(`Class ${config.name} - ${config.description}`);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@CustomClassDecorator({ name: 'ExampleClass2', description: 'This is an example class 2' })
|
|
167
|
+
export class ExampleDecoratorOne {
|
|
168
|
+
@LogMethod('This is a log message')
|
|
169
|
+
exampleMethod() {
|
|
170
|
+
// Method logic
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function ValidateArgs(config: { type: string; required: boolean }) {
|
|
175
|
+
return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
|
176
|
+
const originalMethod = descriptor.value;
|
|
177
|
+
descriptor.value = function (...args: any[]) {
|
|
178
|
+
if (args[0] && typeof args[0] !== config.type) {
|
|
179
|
+
throw new Error('Invalid argument type');
|
|
180
|
+
}
|
|
181
|
+
if (config.required && !args[0]) {
|
|
182
|
+
throw new Error('Argument is required');
|
|
183
|
+
}
|
|
184
|
+
return originalMethod.apply(this, args);
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@CustomClassDecorator({
|
|
190
|
+
name: 'ExampleClass',
|
|
191
|
+
description: 'This is an example class',
|
|
192
|
+
fn: () => 'hi',
|
|
193
|
+
class: new ClassSomething('dsa'),
|
|
194
|
+
arr: ['hi', 5, true, false, undefined, () => {}, { a: 'hi', b: 5 }, new ClassSomething('dsa')],
|
|
195
|
+
})
|
|
196
|
+
export class ExampleDecoratorTwo {
|
|
197
|
+
@ValidateArgs({ type: 'string', required: true })
|
|
198
|
+
exampleMethod(input: string) {
|
|
199
|
+
// Method logic
|
|
200
|
+
}
|
|
201
|
+
}
|