@cntrl-site/components 0.1.33 → 1.0.0

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.
@@ -1,8 +1,10 @@
1
1
  import { default as React } from 'react';
2
+ import { ComponentSchemaV1 } from './SchemaV1';
2
3
  export type Component = {
3
4
  element: (props: any) => React.ReactElement;
4
5
  id: string;
5
6
  name: string;
7
+ version?: number;
6
8
  defaultSize?: {
7
9
  width?: number | string;
8
10
  height?: number | string;
@@ -12,17 +14,6 @@ export type Component = {
12
14
  type: 'image' | 'video';
13
15
  url: string;
14
16
  };
15
- assetsPaths: {
16
- content: Path[];
17
- parameters: Path[];
18
- };
19
- fontSettingsPaths: {
20
- content: Path[];
21
- parameters: Path[];
22
- };
23
- };
24
- type Path = {
25
- path: string;
26
- placeholderEnabled?: boolean;
17
+ sourceCode?: string;
27
18
  };
28
- export {};
19
+ export declare function isSchemaV1(schema: any): schema is ComponentSchemaV1;
@@ -0,0 +1,58 @@
1
+ export type PropertyScope = 'common' | 'layout';
2
+ export type SchemaDisplay = {
3
+ type: string;
4
+ [key: string]: unknown;
5
+ };
6
+ export type SchemaProperty = {
7
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'fields';
8
+ scope?: PropertyScope;
9
+ title?: string;
10
+ icon?: string;
11
+ tooltip?: string;
12
+ display?: SchemaDisplay;
13
+ enum?: Array<string | number>;
14
+ properties?: Record<string, SchemaProperty>;
15
+ layout?: LayoutItem[];
16
+ items?: SchemaProperty;
17
+ default?: unknown;
18
+ min?: number;
19
+ max?: number;
20
+ };
21
+ export type LayoutRow = {
22
+ type: 'row';
23
+ items: LayoutItem[];
24
+ };
25
+ export type LayoutGroup = {
26
+ type: 'group';
27
+ title: string;
28
+ items: LayoutItem[];
29
+ };
30
+ export type LayoutSwitcher = {
31
+ type: 'switcher';
32
+ title: string;
33
+ options: Record<string, LayoutItem[]>;
34
+ };
35
+ export type LayoutItem = string | LayoutRow | LayoutGroup | LayoutSwitcher;
36
+ export type SchemaSection = {
37
+ sizing?: string;
38
+ properties: Record<string, SchemaProperty>;
39
+ layout?: LayoutItem[];
40
+ defaults: Record<string, unknown>;
41
+ };
42
+ export type SchemaPanel = {
43
+ id: string;
44
+ icon: string;
45
+ title: string;
46
+ tooltip?: string;
47
+ layout: LayoutItem[];
48
+ };
49
+ export type ComponentSchemaV1 = {
50
+ type: 'object';
51
+ version: 1;
52
+ settings: SchemaSection;
53
+ panels?: SchemaPanel[];
54
+ content?: SchemaSection;
55
+ allowedPlugins?: AllowedPlugin;
56
+ };
57
+ type AllowedPlugin = 'newsletter';
58
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react");function n(c,e=!1){return e?`calc(var(--cntrl-article-width) * ${c})`:`${c*100}vw`}function r(){const e=`cf-${s.useId().replace(/:/g,"")}`;return{prefix:e,cls:t=>`${e}-${t}`}}exports.scalingValue=n;exports.useScopedStyles=r;
@@ -0,0 +1,15 @@
1
+ import { useId as t } from "react";
2
+ function n(e, c = !1) {
3
+ return c ? `calc(var(--cntrl-article-width) * ${e})` : `${e * 100}vw`;
4
+ }
5
+ function i() {
6
+ const c = `cf-${t().replace(/:/g, "")}`;
7
+ return {
8
+ prefix: c,
9
+ cls: (r) => `${c}-${r}`
10
+ };
11
+ }
12
+ export {
13
+ n as s,
14
+ i as u
15
+ };
package/dist/utils.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useScopedStyles-b8cb4EW8.js");exports.scalingValue=e.scalingValue;exports.useScopedStyles=e.useScopedStyles;
package/dist/utils.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import { s as a, u as l } from "./useScopedStyles-c-B_XeP_.mjs";
2
+ export {
3
+ a as scalingValue,
4
+ l as useScopedStyles
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "0.1.33",
3
+ "version": "1.0.0",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,10 +15,22 @@
15
15
  "import": "./dist/index.mjs",
16
16
  "require": "./dist/index.js"
17
17
  },
18
+ "./utils": {
19
+ "types": "./dist/Components/utils/index.d.ts",
20
+ "import": "./dist/utils.mjs",
21
+ "require": "./dist/utils.js"
22
+ },
18
23
  "./style/components.css": {
19
24
  "default": "./dist/components.css"
20
25
  }
21
26
  },
27
+ "typesVersions": {
28
+ "*": {
29
+ "utils": [
30
+ "./dist/Components/utils/index.d.ts"
31
+ ]
32
+ }
33
+ },
22
34
  "scripts": {
23
35
  "test": "jest",
24
36
  "dev": "vite development",