@pwfabric/authoring 0.0.0-stage → 1.0.0-rc.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.
- package/LICENSE +202 -0
- package/README.md +13 -2
- package/dist/define-block.d.ts +112 -0
- package/dist/define-block.d.ts.map +1 -0
- package/dist/define-block.js +297 -0
- package/dist/define-block.js.map +1 -0
- package/dist/define-factory.d.ts +114 -0
- package/dist/define-factory.d.ts.map +1 -0
- package/dist/define-factory.js +247 -0
- package/dist/define-factory.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +165 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +277 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +272 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/validation.d.ts +81 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +217 -0
- package/dist/validation.js.map +1 -0
- package/package.json +57 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pwfabric/authoring
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`defineBlock` and `defineFactory` — write your own blocks against the same contract the first-party ones use.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @pwfabric/authoring
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Part of [PWFabric](https://github.com/pwfabric/pwfabric). Documentation, the
|
|
10
|
+
other packages and the licensing model live in that repository.
|
|
11
|
+
|
|
12
|
+
## Licence
|
|
13
|
+
|
|
14
|
+
Apache-2.0 — see `LICENSE`.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineBlock API
|
|
3
|
+
*
|
|
4
|
+
* Create type-safe custom block definitions with Zod schemas.
|
|
5
|
+
*
|
|
6
|
+
* @module @pwfabric/authoring/define-block
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { defineBlock } from '@pwfabric/authoring'
|
|
11
|
+
* import { z } from 'zod'
|
|
12
|
+
*
|
|
13
|
+
* export const MyBlock = defineBlock({
|
|
14
|
+
* type: 'my-block',
|
|
15
|
+
* name: 'My Block',
|
|
16
|
+
* schema: z.object({ title: z.string() }),
|
|
17
|
+
* defaultProps: { title: 'Default' },
|
|
18
|
+
* component: ({ props }) => <div>{props.title}</div>
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import { type ZodSchema, type ZodTypeDef } from 'zod';
|
|
23
|
+
import type { CustomBlockOptions, CustomBlockDefinition } from './types.js';
|
|
24
|
+
/**
|
|
25
|
+
* Define a custom block with type-safe Zod schema validation
|
|
26
|
+
*
|
|
27
|
+
* Creates a reusable block definition that can be registered with
|
|
28
|
+
* CustomBlockRegistry and used with SurfaceRenderer.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Block definition options
|
|
31
|
+
* @returns A frozen, type-safe custom block definition
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* import { defineBlock } from '@pwfabric/authoring'
|
|
36
|
+
* import { z } from 'zod'
|
|
37
|
+
*
|
|
38
|
+
* // Define a pricing card block
|
|
39
|
+
* const PricingCard = defineBlock({
|
|
40
|
+
* type: 'pricing-card',
|
|
41
|
+
* name: 'Pricing Card',
|
|
42
|
+
* category: 'content',
|
|
43
|
+
* schema: z.object({
|
|
44
|
+
* title: z.string(),
|
|
45
|
+
* price: z.number(),
|
|
46
|
+
* currency: z.string().default('USD'),
|
|
47
|
+
* features: z.array(z.string()),
|
|
48
|
+
* highlighted: z.boolean().default(false),
|
|
49
|
+
* }),
|
|
50
|
+
* defaultProps: {
|
|
51
|
+
* title: 'Basic Plan',
|
|
52
|
+
* price: 9.99,
|
|
53
|
+
* currency: 'USD',
|
|
54
|
+
* features: ['Feature 1', 'Feature 2'],
|
|
55
|
+
* highlighted: false,
|
|
56
|
+
* },
|
|
57
|
+
* component: ({ props }) => (
|
|
58
|
+
* <div className={props.highlighted ? 'highlighted' : ''}>
|
|
59
|
+
* <h3>{props.title}</h3>
|
|
60
|
+
* <p>{props.currency} {props.price}</p>
|
|
61
|
+
* <ul>
|
|
62
|
+
* {props.features.map((f, i) => <li key={i}>{f}</li>)}
|
|
63
|
+
* </ul>
|
|
64
|
+
* </div>
|
|
65
|
+
* ),
|
|
66
|
+
* })
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function defineBlock<TProps extends Record<string, unknown>, TSchema extends ZodSchema<TProps, ZodTypeDef, unknown> = ZodSchema<TProps>>(options: CustomBlockOptions<TProps, TSchema>): CustomBlockDefinition<TProps>;
|
|
70
|
+
/** A reported issue from {@link validateBlockDefinition}. */
|
|
71
|
+
export interface BlockDefinitionIssue {
|
|
72
|
+
field: 'type' | 'name';
|
|
73
|
+
code: string;
|
|
74
|
+
severity: 'error' | 'warning';
|
|
75
|
+
message: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Single source of truth for block-definition field severity, used by
|
|
79
|
+
* the AUTHORING / INSTALL gate (packaging, manifest validation, host
|
|
80
|
+
* install). Non-throwing reporter — the SAME stitch defineBlock applies at
|
|
81
|
+
* runtime, surfaced as structured issues so callers can REJECT identity
|
|
82
|
+
* problems (`type`, severity=error) and merely WARN on cosmetic ones (`name`,
|
|
83
|
+
* severity=warning). Keeping this the one place the policy lives is what makes
|
|
84
|
+
* the treatment identical end-to-end (authoring → install → runtime → render).
|
|
85
|
+
*/
|
|
86
|
+
export declare function validateBlockDefinition(options: {
|
|
87
|
+
type?: unknown;
|
|
88
|
+
name?: unknown;
|
|
89
|
+
}): BlockDefinitionIssue[];
|
|
90
|
+
/**
|
|
91
|
+
* Check if a value is a custom block definition
|
|
92
|
+
*/
|
|
93
|
+
export declare function isCustomBlockDefinition(value: unknown): value is CustomBlockDefinition;
|
|
94
|
+
/**
|
|
95
|
+
* Create a block instance from a custom block definition
|
|
96
|
+
*
|
|
97
|
+
* @param definition - The block definition
|
|
98
|
+
* @param id - Unique block ID
|
|
99
|
+
* @param props - Optional props override (merged with defaults)
|
|
100
|
+
* @param children - Optional children blocks
|
|
101
|
+
*/
|
|
102
|
+
export declare function createBlockInstance<TProps extends Record<string, unknown>>(definition: CustomBlockDefinition<TProps>, id: string, props?: Partial<TProps>, children?: readonly {
|
|
103
|
+
id: string;
|
|
104
|
+
type: string;
|
|
105
|
+
props: Record<string, unknown>;
|
|
106
|
+
}[]): {
|
|
107
|
+
id: string;
|
|
108
|
+
type: string;
|
|
109
|
+
props: TProps;
|
|
110
|
+
children?: typeof children;
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=define-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-block.d.ts","sourceRoot":"","sources":["../src/define-block.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AA2H3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;A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CAAE,CA2BzE"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* defineBlock API
|
|
3
|
+
*
|
|
4
|
+
* Create type-safe custom block definitions with Zod schemas.
|
|
5
|
+
*
|
|
6
|
+
* @module @pwfabric/authoring/define-block
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { defineBlock } from '@pwfabric/authoring'
|
|
11
|
+
* import { z } from 'zod'
|
|
12
|
+
*
|
|
13
|
+
* export const MyBlock = defineBlock({
|
|
14
|
+
* type: 'my-block',
|
|
15
|
+
* name: 'My Block',
|
|
16
|
+
* schema: z.object({ title: z.string() }),
|
|
17
|
+
* defaultProps: { title: 'Default' },
|
|
18
|
+
* component: ({ props }) => <div>{props.title}</div>
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
import { createElement } from 'react';
|
|
24
|
+
// ============================================================
|
|
25
|
+
// VALIDATION
|
|
26
|
+
// ============================================================
|
|
27
|
+
/**
|
|
28
|
+
* Validate block type identifier
|
|
29
|
+
*
|
|
30
|
+
* Must be kebab-case, 2-50 characters, start with letter.
|
|
31
|
+
*/
|
|
32
|
+
function validateBlockType(type) {
|
|
33
|
+
if (typeof type !== 'string') {
|
|
34
|
+
throw new Error('Block type must be a string');
|
|
35
|
+
}
|
|
36
|
+
if (type.length < 2 || type.length > 50) {
|
|
37
|
+
throw new Error('Block type must be 2-50 characters');
|
|
38
|
+
}
|
|
39
|
+
const kebabCaseRegex = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
40
|
+
if (!kebabCaseRegex.test(type)) {
|
|
41
|
+
throw new Error(`Block type "${type}" must be kebab-case (lowercase letters, numbers, hyphens, starting with a letter)`);
|
|
42
|
+
}
|
|
43
|
+
// Reserved types (core block types)
|
|
44
|
+
const reservedTypes = [
|
|
45
|
+
'container',
|
|
46
|
+
'grid',
|
|
47
|
+
'text',
|
|
48
|
+
'heading',
|
|
49
|
+
'button',
|
|
50
|
+
'image',
|
|
51
|
+
'form',
|
|
52
|
+
'input',
|
|
53
|
+
'link',
|
|
54
|
+
'icon',
|
|
55
|
+
'badge',
|
|
56
|
+
'code',
|
|
57
|
+
'divider',
|
|
58
|
+
'list',
|
|
59
|
+
'table',
|
|
60
|
+
'avatar',
|
|
61
|
+
'tooltip',
|
|
62
|
+
'accordion',
|
|
63
|
+
'tabs',
|
|
64
|
+
'dropdown',
|
|
65
|
+
'modal',
|
|
66
|
+
];
|
|
67
|
+
if (reservedTypes.includes(type)) {
|
|
68
|
+
throw new Error(`Block type "${type}" is reserved. Use a unique type for custom blocks.`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* field-severity policy — `name` is a COSMETIC display label, NOT the
|
|
73
|
+
* block's identity. It must never be a hard/fatal error: coerce a missing or
|
|
74
|
+
* invalid name to the block `type` and warn. (`type` is the identity and stays
|
|
75
|
+
* HARD — see validateBlockType.) This is the runtime SOFT half of the end-to-end
|
|
76
|
+
* stitch; the authoring/install GATE applies the same policy via
|
|
77
|
+
* validateBlockDefinition() below. Matches the already-tolerant render meta path
|
|
78
|
+
* (installed-block-meta.descriptorToSnapshot), removing the "valid-but-not-
|
|
79
|
+
* renderable" divergence where this throw crashed a block at render.
|
|
80
|
+
*/
|
|
81
|
+
function coerceBlockName(name, type) {
|
|
82
|
+
if (typeof name === 'string' && name.length >= 1 && name.length <= 100) {
|
|
83
|
+
return name;
|
|
84
|
+
}
|
|
85
|
+
console.warn(`[pwfabric] block "${type}": invalid name (${typeof name}) — falling back to type. ` +
|
|
86
|
+
`Names are cosmetic; fix at authoring, never fatal at render.`);
|
|
87
|
+
return type;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Warn (never throw) when defaultProps don't satisfy the schema.
|
|
91
|
+
* the renderer degrades, it does not crash. A mismatch is an authoring defect
|
|
92
|
+
* to flag, not a render-time fatality (the registry already falls back to
|
|
93
|
+
* defaultProps on a failed parse).
|
|
94
|
+
*/
|
|
95
|
+
function warnOnSchemaMismatch(type, schema, defaultProps) {
|
|
96
|
+
const result = schema.safeParse(defaultProps);
|
|
97
|
+
if (!result.success) {
|
|
98
|
+
const errors = result.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ');
|
|
99
|
+
console.warn(`[pwfabric] block "${type}": defaultProps do not match schema (${errors}). Fix at authoring.`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* render-degrade fallback: a block whose `component` is missing must
|
|
104
|
+
* not white-screen the canvas. Render a visible placeholder instead of throwing.
|
|
105
|
+
*/
|
|
106
|
+
function placeholderComponent(type) {
|
|
107
|
+
return function MissingBlock() {
|
|
108
|
+
return createElement('div', {
|
|
109
|
+
'data-pw-placeholder': type,
|
|
110
|
+
style: {
|
|
111
|
+
padding: '8px 12px',
|
|
112
|
+
border: '1px dashed #c0392b',
|
|
113
|
+
borderRadius: '6px',
|
|
114
|
+
color: '#c0392b',
|
|
115
|
+
font: '12px system-ui, sans-serif',
|
|
116
|
+
},
|
|
117
|
+
}, `Block "${type}" has no component`);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// ============================================================
|
|
121
|
+
// DEFINE BLOCK
|
|
122
|
+
// ============================================================
|
|
123
|
+
/**
|
|
124
|
+
* Define a custom block with type-safe Zod schema validation
|
|
125
|
+
*
|
|
126
|
+
* Creates a reusable block definition that can be registered with
|
|
127
|
+
* CustomBlockRegistry and used with SurfaceRenderer.
|
|
128
|
+
*
|
|
129
|
+
* @param options - Block definition options
|
|
130
|
+
* @returns A frozen, type-safe custom block definition
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* import { defineBlock } from '@pwfabric/authoring'
|
|
135
|
+
* import { z } from 'zod'
|
|
136
|
+
*
|
|
137
|
+
* // Define a pricing card block
|
|
138
|
+
* const PricingCard = defineBlock({
|
|
139
|
+
* type: 'pricing-card',
|
|
140
|
+
* name: 'Pricing Card',
|
|
141
|
+
* category: 'content',
|
|
142
|
+
* schema: z.object({
|
|
143
|
+
* title: z.string(),
|
|
144
|
+
* price: z.number(),
|
|
145
|
+
* currency: z.string().default('USD'),
|
|
146
|
+
* features: z.array(z.string()),
|
|
147
|
+
* highlighted: z.boolean().default(false),
|
|
148
|
+
* }),
|
|
149
|
+
* defaultProps: {
|
|
150
|
+
* title: 'Basic Plan',
|
|
151
|
+
* price: 9.99,
|
|
152
|
+
* currency: 'USD',
|
|
153
|
+
* features: ['Feature 1', 'Feature 2'],
|
|
154
|
+
* highlighted: false,
|
|
155
|
+
* },
|
|
156
|
+
* component: ({ props }) => (
|
|
157
|
+
* <div className={props.highlighted ? 'highlighted' : ''}>
|
|
158
|
+
* <h3>{props.title}</h3>
|
|
159
|
+
* <p>{props.currency} {props.price}</p>
|
|
160
|
+
* <ul>
|
|
161
|
+
* {props.features.map((f, i) => <li key={i}>{f}</li>)}
|
|
162
|
+
* </ul>
|
|
163
|
+
* </div>
|
|
164
|
+
* ),
|
|
165
|
+
* })
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function defineBlock(options) {
|
|
169
|
+
// the renderer DEGRADES, it never throws. `type` is the identity
|
|
170
|
+
// → HARD (throws). Every other required field falls back + warns so a single
|
|
171
|
+
// malformed block can't white-screen the canvas. The authoring/publish gate is
|
|
172
|
+
// where these are rejected early; render stays graceful.
|
|
173
|
+
validateBlockType(options.type);
|
|
174
|
+
const safeName = coerceBlockName(options.name, options.type);
|
|
175
|
+
// schema — missing → passthrough (props pass through unvalidated) + warn.
|
|
176
|
+
let schema = options.schema;
|
|
177
|
+
if (!schema) {
|
|
178
|
+
console.warn(`[pwfabric] block "${options.type}": no schema — using a passthrough (props unvalidated). ` +
|
|
179
|
+
`Add a schema at authoring; this is degraded render, not a fix.`);
|
|
180
|
+
schema = z.object({}).passthrough();
|
|
181
|
+
}
|
|
182
|
+
// defaultProps — missing → {} + warn.
|
|
183
|
+
let defaultProps = options.defaultProps;
|
|
184
|
+
if (!defaultProps) {
|
|
185
|
+
console.warn(`[pwfabric] block "${options.type}": no defaultProps — using {}.`);
|
|
186
|
+
defaultProps = {};
|
|
187
|
+
}
|
|
188
|
+
// component — missing → visible placeholder + warn (not a thrown white-screen).
|
|
189
|
+
let component = options.component;
|
|
190
|
+
if (typeof component !== 'function') {
|
|
191
|
+
console.warn(`[pwfabric] block "${options.type}": no component — rendering a placeholder.`);
|
|
192
|
+
component = placeholderComponent(options.type);
|
|
193
|
+
}
|
|
194
|
+
// Defaults vs schema: warn, never throw.
|
|
195
|
+
warnOnSchemaMismatch(options.type, schema, defaultProps);
|
|
196
|
+
// Build the definition with defaults
|
|
197
|
+
const definition = {
|
|
198
|
+
type: options.type,
|
|
199
|
+
name: safeName,
|
|
200
|
+
category: options.category ?? 'content',
|
|
201
|
+
icon: options.icon ?? '◆',
|
|
202
|
+
schema,
|
|
203
|
+
defaultProps,
|
|
204
|
+
canHaveChildren: options.canHaveChildren ?? false,
|
|
205
|
+
component,
|
|
206
|
+
// Only include optional properties if they're defined
|
|
207
|
+
...(options.allowedChildren !== undefined && { allowedChildren: options.allowedChildren }),
|
|
208
|
+
...(options.allowedParents !== undefined && { allowedParents: options.allowedParents }),
|
|
209
|
+
...(options.traits !== undefined && { traits: options.traits }),
|
|
210
|
+
...(options.allowedChildTraits !== undefined && {
|
|
211
|
+
allowedChildTraits: options.allowedChildTraits,
|
|
212
|
+
}),
|
|
213
|
+
...(options.maxInstances !== undefined && { maxInstances: options.maxInstances }),
|
|
214
|
+
};
|
|
215
|
+
// Return a frozen definition to prevent mutations
|
|
216
|
+
return Object.freeze(definition);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Single source of truth for block-definition field severity, used by
|
|
220
|
+
* the AUTHORING / INSTALL gate (packaging, manifest validation, host
|
|
221
|
+
* install). Non-throwing reporter — the SAME stitch defineBlock applies at
|
|
222
|
+
* runtime, surfaced as structured issues so callers can REJECT identity
|
|
223
|
+
* problems (`type`, severity=error) and merely WARN on cosmetic ones (`name`,
|
|
224
|
+
* severity=warning). Keeping this the one place the policy lives is what makes
|
|
225
|
+
* the treatment identical end-to-end (authoring → install → runtime → render).
|
|
226
|
+
*/
|
|
227
|
+
export function validateBlockDefinition(options) {
|
|
228
|
+
const issues = [];
|
|
229
|
+
// type — block IDENTITY → HARD (error). Mirrors validateBlockType's rules.
|
|
230
|
+
const t = options.type;
|
|
231
|
+
if (typeof t !== 'string') {
|
|
232
|
+
issues.push({ field: 'type', code: 'BLOCK_TYPE_NOT_STRING', severity: 'error', message: 'Block type must be a string' });
|
|
233
|
+
}
|
|
234
|
+
else if (t.length < 2 || t.length > 50) {
|
|
235
|
+
issues.push({ field: 'type', code: 'BLOCK_TYPE_LENGTH', severity: 'error', message: 'Block type must be 2-50 characters' });
|
|
236
|
+
}
|
|
237
|
+
else if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(t)) {
|
|
238
|
+
issues.push({ field: 'type', code: 'BLOCK_TYPE_FORMAT', severity: 'error', message: `Block type "${t}" must be kebab-case` });
|
|
239
|
+
}
|
|
240
|
+
// name — cosmetic label → SOFT (warning). Never blocks; coerced to type at runtime.
|
|
241
|
+
const n = options.name;
|
|
242
|
+
if (typeof n !== 'string' || n.length < 1 || n.length > 100) {
|
|
243
|
+
issues.push({ field: 'name', code: 'BLOCK_NAME_INVALID', severity: 'warning', message: 'Block name should be a 1-100 char string; falls back to type' });
|
|
244
|
+
}
|
|
245
|
+
return issues;
|
|
246
|
+
}
|
|
247
|
+
// ============================================================
|
|
248
|
+
// UTILITY FUNCTIONS
|
|
249
|
+
// ============================================================
|
|
250
|
+
/**
|
|
251
|
+
* Check if a value is a custom block definition
|
|
252
|
+
*/
|
|
253
|
+
export function isCustomBlockDefinition(value) {
|
|
254
|
+
if (!value || typeof value !== 'object') {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
const def = value;
|
|
258
|
+
return (typeof def.type === 'string' &&
|
|
259
|
+
typeof def.name === 'string' &&
|
|
260
|
+
typeof def.category === 'string' &&
|
|
261
|
+
typeof def.schema === 'object' &&
|
|
262
|
+
typeof def.defaultProps === 'object' &&
|
|
263
|
+
typeof def.component === 'function');
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Create a block instance from a custom block definition
|
|
267
|
+
*
|
|
268
|
+
* @param definition - The block definition
|
|
269
|
+
* @param id - Unique block ID
|
|
270
|
+
* @param props - Optional props override (merged with defaults)
|
|
271
|
+
* @param children - Optional children blocks
|
|
272
|
+
*/
|
|
273
|
+
export function createBlockInstance(definition, id, props, children) {
|
|
274
|
+
const mergedProps = {
|
|
275
|
+
...definition.defaultProps,
|
|
276
|
+
...props,
|
|
277
|
+
};
|
|
278
|
+
// Validate merged props
|
|
279
|
+
const result = definition.schema.safeParse(mergedProps);
|
|
280
|
+
if (!result.success) {
|
|
281
|
+
const errors = result.error.errors.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ');
|
|
282
|
+
throw new Error(`Invalid block props: ${errors}`);
|
|
283
|
+
}
|
|
284
|
+
const instance = {
|
|
285
|
+
id,
|
|
286
|
+
type: definition.type,
|
|
287
|
+
props: result.data,
|
|
288
|
+
};
|
|
289
|
+
if (children && children.length > 0) {
|
|
290
|
+
if (!definition.canHaveChildren) {
|
|
291
|
+
throw new Error(`Block type "${definition.type}" cannot have children`);
|
|
292
|
+
}
|
|
293
|
+
instance.children = children;
|
|
294
|
+
}
|
|
295
|
+
return instance;
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=define-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-block.js","sourceRoot":"","sources":["../src/define-block.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAmC,MAAM,KAAK,CAAA;AACxD,OAAO,EAAE,aAA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