@plitzi/sdk-schema 0.38.16 → 0.38.18
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/CHANGELOG.md +115 -0
- package/dist/SchemaReducer.d.ts +2 -1
- package/dist/helpers/FlatMap.mjs +3 -3
- package/dist/helpers/elementId.mjs +5 -11
- package/dist/helpers/fitSnippet.mjs +2 -3
- package/dist/helpers/schemaValidator.mjs +30 -52
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +9 -6
- package/package.json +12 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,120 @@
|
|
|
1
1
|
# @plitzi/sdk-schema
|
|
2
2
|
|
|
3
|
+
## 0.38.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b3023c9: ## Security
|
|
8
|
+
|
|
9
|
+
- **A page of the same site on another origin is no longer this server's own** (`@plitzi/sdk-server`): the guard
|
|
10
|
+
against writes another page caused (`crossSiteWrites`, the sign-in's login-CSRF check and `createOriginGuardMiddleware`)
|
|
11
|
+
trusted `Sec-Fetch-Site: same-site` — and a site has no port and spans every sub-domain, so another port of the host
|
|
12
|
+
(where `createAuthoringHost` serves pages an agent wrote) or a sibling sub-domain (every space of a platform on one
|
|
13
|
+
domain) could write as if it were the server's own page. Now only `same-origin` (and `none`, a typed URL) is; `same-site`
|
|
14
|
+
is refused 403 `reason: 'foreign'` unless its origin is named (`crossSiteWrites.origins`, `identity.platformOrigins`),
|
|
15
|
+
and the `Origin` fallback compares host and port. In production an app and its spaces are already on different sites,
|
|
16
|
+
so a deployment that works there needs nothing; one that relied on a sibling sub-domain locally names it.
|
|
17
|
+
`createAuthoringHost`'s docs now say to serve on a host of its own — a cookie belongs to a host whatever its port.
|
|
18
|
+
|
|
19
|
+
## Server
|
|
20
|
+
- **An open page takes a new version of its space where it stands** (`@plitzi/sdk-server`, `@plitzi/plitzi-sdk`):
|
|
21
|
+
`server.updatePages(documents, { draft? })` hands the pages showing that space — or that draft — its new documents,
|
|
22
|
+
and each swaps them in place, its state, scroll and focus kept (`replaceSpace` on what the SDK's `render` returns;
|
|
23
|
+
`false`, and the page loads again, for a page with elements the server draws). The development loop of a project uses
|
|
24
|
+
it: a save to the space no longer reloads the open page. `createAuthoringHost`'s `put` over an id that pages show
|
|
25
|
+
hands them the new version and answers how many took it (`updated`), so a page an agent keeps improving is seen to
|
|
26
|
+
grow instead of reloading — no second iframe needed.
|
|
27
|
+
- **`devReload` is `livePages`** (`@plitzi/sdk-server`): the channel the open pages listen on now carries the space,
|
|
28
|
+
not only "load again", and a host that is not developing uses it too. Its address is `/__plitzi/live`; a draft's page
|
|
29
|
+
listens for its own changes alone (`?__pt=`). A plugin swapped where it is drawn stays a development server's
|
|
30
|
+
(`devMode`). `plitzi upgrade migrations --write` renames the option in a project's code (`livePagesOption`).
|
|
31
|
+
|
|
32
|
+
## Packages
|
|
33
|
+
- **`@plitzi/sdk-server` starts in half the time** (`@plitzi/sdk-shared`, `@plitzi/sdk-server`): importing it took
|
|
34
|
+
~310 ms, ~200 of them `date-fns` — 108 modules nothing on the server uses, brought by `@plitzi/sdk-shared/helpers` —
|
|
35
|
+
and loaded the browser's hooks and contexts of every folder of `@plitzi/sdk-shared` it read, `@plitzi/nexus/react`
|
|
36
|
+
with them. Now ~150 ms (`@plitzi/sdk-shared` 139 → 113 modules, `@plitzi/nexus` 53 → 31). What moved, each
|
|
37
|
+
rewritten by `plitzi upgrade migrations --write` (`movedExports`):
|
|
38
|
+
- the dates — `formatDate`, `formatDateUTC`, `formatFromNow`, `formatUTCToLocal`, `getDurationMs`, `isDate`,
|
|
39
|
+
`isValidFormat`, `parseDate`, `toUnixSeconds`, `SupportedLocale` — from `@plitzi/sdk-shared/helpers` to
|
|
40
|
+
`@plitzi/sdk-shared/dates`;
|
|
41
|
+
- React's bindings to an entry of their own beside each area, as `@plitzi/nexus/react` is: `useDisplayMode`,
|
|
42
|
+
`useElementSize` → `@plitzi/sdk-shared/style/react`; `SchemaContext` → `schema/react`; `PluginsContext` →
|
|
43
|
+
`plugins/react`; `DevToolsContext` → `devTools/react`; `useFlagResolution` → `flags/react` (`flagUserFrom` stays
|
|
44
|
+
in `flags`);
|
|
45
|
+
- `PROJECT_DATA_PREFIX` from `@plitzi/sdk-shared/server` to `@plitzi/sdk-shared/project/paths` — the project's
|
|
46
|
+
layout names, an entry a browser imports too (`@plitzi/sdk-shared/project` stays Node only and re-exports them).
|
|
47
|
+
The theme cookie's helpers (`themeFromCookies`…) are also `@plitzi/sdk-shared/theme/cookie`, still exported by
|
|
48
|
+
`@plitzi/sdk-shared/theme`.
|
|
49
|
+
|
|
50
|
+
`yarn check:server-footprint` (in CI after the build) holds what the server's root loads, package by package — Plitzi's
|
|
51
|
+
and every other — to a budget: a heavy library or a folder of hooks coming back fails with what came in.
|
|
52
|
+
|
|
53
|
+
## CLI
|
|
54
|
+
- **`plitzi upgrade migrations --write` writes a file import's new home when it has one** (`@plitzi/cli`): the
|
|
55
|
+
`folderImports` migration of 0.38.17 named every import of a package's FILE and wrote none. It now reads the installed
|
|
56
|
+
declarations with the project's own TypeScript and rewrites each `import` / `export … from` whose every name the folder
|
|
57
|
+
exports under one name — `import usePlitzi from '@plitzi/sdk-shared/hooks/usePlitzi'` →
|
|
58
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`, `type` modifiers and aliases kept. What has no one answer is
|
|
59
|
+
said with why (a namespace import, an `import()` or mock, a name the folder does not export, a project with no
|
|
60
|
+
TypeScript). The report says which places `--write` writes (`writable` in `--json`) instead of calling every one
|
|
61
|
+
"yours to change"; a migration now gives each place its own `edit` in place of a whole-file `rewrite`
|
|
62
|
+
(`docs/en/releases.md`).
|
|
63
|
+
- **`plitzi doctor` says an import of a path the installed package does not export** (`@plitzi/cli`):
|
|
64
|
+
`import-not-exported`, an error, at the importing file — what Node otherwise reports at start as an
|
|
65
|
+
`ERR_MODULE_NOT_FOUND` into the package's `dist`, which reads as a broken install rather than a changed API. For a
|
|
66
|
+
`@plitzi` package the fix names `plitzi upgrade migrations --write`; for any other, its `exports`. Asked only of a
|
|
67
|
+
package that is installed.
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [b3023c9]
|
|
70
|
+
- @plitzi/sdk-shared@0.38.18
|
|
71
|
+
- @plitzi/sdk-style@0.38.18
|
|
72
|
+
|
|
73
|
+
## 0.38.17
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- 4f8dc37: ## Packages
|
|
78
|
+
|
|
79
|
+
- **A library package is imported by its root and its folders, never by a file** (`@plitzi/sdk-shared`, `sdk-schema`,
|
|
80
|
+
`sdk-style`, `sdk-elements`, `sdk-interactions`, `sdk-auth`, `sdk-dev-tools`, `sdk-event-bridge`, `sdk-navigation`,
|
|
81
|
+
`sdk-plugins`, `sdk-variables`): each `exports` is now `"."` and `"./*"`, the latter a folder's `index`.
|
|
82
|
+
`@plitzi/sdk-shared/helpers/isRecord` becomes `import { isRecord } from '@plitzi/sdk-shared/helpers'`, and a default
|
|
83
|
+
export by the name its folder gives it — almost always its file's (`import usePlitzi from '…/hooks/usePlitzi'` →
|
|
84
|
+
`import { usePlitzi } from '@plitzi/sdk-shared/hooks'`). A file-level specifier now fails with `ERR_MODULE_NOT_FOUND`.
|
|
85
|
+
New entries where a folder barrel would have brought more than was asked for: `@plitzi/sdk-shared/project` and
|
|
86
|
+
`@plitzi/sdk-shared/plugins/bundle` (Node only), `@plitzi/sdk-interactions/declarations` (the global callbacks and
|
|
87
|
+
utility specs, without React), and `@plitzi/sdk-elements/elements/declarations`, which now also carries the
|
|
88
|
+
declarations' attribute types and the constants they are checked with. `RuleGroup` is exported by `@plitzi/sdk-shared`
|
|
89
|
+
with the document types that use it. `plitzi upgrade migrations` names every such import in a project, with the folder to
|
|
90
|
+
import it from instead.
|
|
91
|
+
- **`@plitzi/sdk-shared`'s root exports the document types, and only them** (`@plitzi/sdk-shared`): what the package
|
|
92
|
+
does is imported from its folder — `formatDate` from `@plitzi/sdk-shared/helpers`, `ThemeProvider` from
|
|
93
|
+
`@plitzi/sdk-shared/theme`, a GraphQL operation's types from `@plitzi/sdk-shared/network/graphql` — so a module that
|
|
94
|
+
imports a type from the root no longer loads every area of the package.
|
|
95
|
+
- **What one package alone used lives in that package** (`@plitzi/sdk-shared`, `@plitzi/sdk-elements`): the data
|
|
96
|
+
source hooks moved from `@plitzi/sdk-shared/dataSource/hooks` to `@plitzi/sdk-elements/dataSource`
|
|
97
|
+
(`useRegisterSource`, `useResolvedVariables`), and the Apollo links the builder's client is built with into the
|
|
98
|
+
builder.
|
|
99
|
+
- **The builder's panels are an entry of their own** (`@plitzi/sdk-style`, `@plitzi/sdk-variables`,
|
|
100
|
+
`@plitzi/sdk-elements`): the style inspector, the advanced style editor and `BuilderStyleContextProvider` are imported
|
|
101
|
+
from `@plitzi/sdk-style/builder`; the variables' lists and forms from `@plitzi/sdk-variables/builder`; the elements'
|
|
102
|
+
settings panels (`defaultElementsSettings`) from `@plitzi/sdk-elements/builder`. Each package's root keeps what a page
|
|
103
|
+
and a server use — `generateCache` no longer loads the inspector, on a server 227 modules down to 21.
|
|
104
|
+
|
|
105
|
+
## CLI
|
|
106
|
+
- **`plitzi upgrade`'s `renames` part is now `migrations`** (`@plitzi/cli`): what a version changed that a project's
|
|
107
|
+
own source must follow, one file per change in the CLI's `src/migrations/changes/` with the version it shipped in —
|
|
108
|
+
rewritten with `--write` when it has one right answer, said otherwise. The `--json` report carries `migrations` (each
|
|
109
|
+
with its `migration`, `since`, `file`, `line`, `what` and whether it was `written`) in place of `renames` and
|
|
110
|
+
`changes`. The changes of 0.38.0 (`canTemplate` → `canSnippet`, the `*Template` authoring names), 0.38.9 (a
|
|
111
|
+
`formControl` without `required` is optional) and 0.38.12 (`usePlitziServiceContext` → `usePlitzi`) are no longer
|
|
112
|
+
looked for: a project still on one of those versions makes them by hand.
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [4f8dc37]
|
|
115
|
+
- @plitzi/sdk-shared@0.38.17
|
|
116
|
+
- @plitzi/sdk-style@0.38.17
|
|
117
|
+
|
|
3
118
|
## 0.38.16
|
|
4
119
|
|
|
5
120
|
### Patch Changes
|
package/dist/SchemaReducer.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Element, PageFolder,
|
|
1
|
+
import { Element, PageFolder, Schema, SnippetStyle, SchemaFlag, SchemaVariable, DropPosition, SpaceComponent, SpaceComponentDeclaration } from '@plitzi/sdk-shared';
|
|
2
|
+
import { ReducerActionOrigin } from '@plitzi/sdk-shared/helpers';
|
|
2
3
|
export declare const SchemaActions: {
|
|
3
4
|
readonly SCHEMA_UPDATE: "SCHEMA_UPDATE";
|
|
4
5
|
readonly SCHEMA_ADD_PAGE: "SCHEMA_ADD_PAGE";
|
package/dist/helpers/FlatMap.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { elementIdConflict as e, elementIdsFree as t, randomElementId as n, repointIds as r, takenIds as i, uniqueElementId as a } from "./elementId.mjs";
|
|
2
2
|
import { descendants as o, parentChain as s } from "./elementTree.mjs";
|
|
3
|
-
import { VARIABLE_REGEX as c } from "@plitzi/sdk-shared/schema
|
|
4
|
-
import { EMPTY_STYLE_SCHEMA as l } from "@plitzi/sdk-shared/style
|
|
5
|
-
import u from "@plitzi/sdk-style/helpers
|
|
3
|
+
import { VARIABLE_REGEX as c } from "@plitzi/sdk-shared/schema";
|
|
4
|
+
import { EMPTY_STYLE_SCHEMA as l } from "@plitzi/sdk-shared/style";
|
|
5
|
+
import { calculateInheriting as u } from "@plitzi/sdk-style/helpers";
|
|
6
6
|
//#region src/helpers/FlatMap.ts
|
|
7
7
|
var d = class {
|
|
8
8
|
flat;
|
|
@@ -50,20 +50,14 @@ var e = /^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9_])?$/, t = (t) => e.test(t), n = (
|
|
|
50
50
|
if (typeof r == "string") {
|
|
51
51
|
let a = h(r, t);
|
|
52
52
|
a !== r && (e[i] = a, n = !0);
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
n = g(r, t) || n;
|
|
53
|
+
} else n = g(r, t) || n;
|
|
56
54
|
}), n;
|
|
57
55
|
if (!e || typeof e != "object") return !1;
|
|
58
56
|
let r = e;
|
|
59
|
-
for (let [e, i] of Object.entries(r)) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
n = g(i, t) || n;
|
|
66
|
-
}
|
|
57
|
+
for (let [e, i] of Object.entries(r)) if (typeof i == "string") {
|
|
58
|
+
let a = h(i, t);
|
|
59
|
+
a !== i && (r[e] = a, n = !0);
|
|
60
|
+
} else n = g(i, t) || n;
|
|
67
61
|
return n;
|
|
68
62
|
}, _ = (e, t, n) => {
|
|
69
63
|
let r = Object.entries(t).filter(([e, t]) => e !== t);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { remapCollidingIds as e } from "./elementId.mjs";
|
|
2
2
|
import { documentIds as t } from "./components.mjs";
|
|
3
|
-
import { isDisplayMode as n } from "@plitzi/sdk-shared/style
|
|
4
|
-
import {
|
|
5
|
-
import a from "@plitzi/sdk-style/helpers/processSelector";
|
|
3
|
+
import { isDisplayMode as n, sameSelector as r, selectorsOf as i } from "@plitzi/sdk-shared/style";
|
|
4
|
+
import { processSelector as a } from "@plitzi/sdk-style/helpers";
|
|
6
5
|
//#region src/helpers/fitSnippet.ts
|
|
7
6
|
var o = (e, t) => {
|
|
8
7
|
let n = 2;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isValidElementId as e } from "./elementId.mjs";
|
|
2
2
|
import { isInstance as t, propNameProblem as n } from "./components.mjs";
|
|
3
|
-
import { findLayoutCycle as r } from "@plitzi/sdk-shared/schema
|
|
3
|
+
import { findLayoutCycle as r } from "@plitzi/sdk-shared/schema";
|
|
4
4
|
//#region src/helpers/schemaValidator.ts
|
|
5
5
|
var i = /* @__PURE__ */ new Set([
|
|
6
6
|
"UNRESOLVED_BINDING_SOURCE",
|
|
@@ -165,15 +165,7 @@ var i = /* @__PURE__ */ new Set([
|
|
|
165
165
|
elementId: n
|
|
166
166
|
}), e.add(n);
|
|
167
167
|
let i = g(n);
|
|
168
|
-
|
|
169
|
-
s.push({
|
|
170
|
-
code: "INVALID_PAGE_REFERENCE",
|
|
171
|
-
message: `Page ID "${n}" in pages array doesn't exist in flat`,
|
|
172
|
-
elementId: n
|
|
173
|
-
});
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
i.definition.type !== "page" && s.push({
|
|
168
|
+
i ? (i.definition.type !== "page" && s.push({
|
|
177
169
|
code: "INVALID_PAGE_TYPE",
|
|
178
170
|
message: `Element "${n}" in pages array has type "${i.definition.type}" instead of "page"`,
|
|
179
171
|
elementId: n
|
|
@@ -181,7 +173,11 @@ var i = /* @__PURE__ */ new Set([
|
|
|
181
173
|
code: "PAGE_ROOT_ID_MISMATCH",
|
|
182
174
|
message: `Page "${n}" has rootId "${i.definition.rootId}" instead of its own ID`,
|
|
183
175
|
elementId: n
|
|
184
|
-
}), i.attributes?.default && t
|
|
176
|
+
}), i.attributes?.default && t++) : s.push({
|
|
177
|
+
code: "INVALID_PAGE_REFERENCE",
|
|
178
|
+
message: `Page ID "${n}" in pages array doesn't exist in flat`,
|
|
179
|
+
elementId: n
|
|
180
|
+
});
|
|
185
181
|
}), t === 0 && u.length > 0 ? c.push({
|
|
186
182
|
code: "NO_DEFAULT_PAGE",
|
|
187
183
|
message: "No default page found in schema"
|
|
@@ -210,14 +206,7 @@ var i = /* @__PURE__ */ new Set([
|
|
|
210
206
|
}, T = () => {
|
|
211
207
|
let e = /* @__PURE__ */ new Set();
|
|
212
208
|
d.forEach((t, n) => {
|
|
213
|
-
|
|
214
|
-
s.push({
|
|
215
|
-
code: "INVALID_FOLDER",
|
|
216
|
-
message: `Page folder at index ${n} has no id`
|
|
217
|
-
});
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
e.has(t.id) && s.push({
|
|
209
|
+
t.id ? (e.has(t.id) && s.push({
|
|
221
210
|
code: "DUPLICATE_FOLDER",
|
|
222
211
|
message: `Duplicate folder ID "${t.id}"`,
|
|
223
212
|
elementId: t.id
|
|
@@ -226,7 +215,10 @@ var i = /* @__PURE__ */ new Set([
|
|
|
226
215
|
message: `Folder "${t.id}" has non-existent parent "${t.parentId}"`,
|
|
227
216
|
elementId: t.id,
|
|
228
217
|
details: { parentId: t.parentId }
|
|
229
|
-
}))
|
|
218
|
+
}))) : s.push({
|
|
219
|
+
code: "INVALID_FOLDER",
|
|
220
|
+
message: `Page folder at index ${n} has no id`
|
|
221
|
+
});
|
|
230
222
|
});
|
|
231
223
|
}, E = () => {
|
|
232
224
|
let e = /* @__PURE__ */ new Set();
|
|
@@ -264,14 +256,7 @@ var i = /* @__PURE__ */ new Set([
|
|
|
264
256
|
}, O = () => {
|
|
265
257
|
let e = /* @__PURE__ */ new Set();
|
|
266
258
|
f.forEach((t, n) => {
|
|
267
|
-
|
|
268
|
-
s.push({
|
|
269
|
-
code: "INVALID_VARIABLE",
|
|
270
|
-
message: `Variable at index ${n} has no name`
|
|
271
|
-
});
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
e.has(t.name) && s.push({
|
|
259
|
+
t.name ? (e.has(t.name) && s.push({
|
|
275
260
|
code: "DUPLICATE_VARIABLE",
|
|
276
261
|
message: `Duplicate variable name "${t.name}"`,
|
|
277
262
|
details: { variableName: t.name }
|
|
@@ -279,6 +264,9 @@ var i = /* @__PURE__ */ new Set([
|
|
|
279
264
|
code: "MISSING_VARIABLE_TYPE",
|
|
280
265
|
message: `Variable "${t.name}" has no type`,
|
|
281
266
|
details: { variableName: t.name }
|
|
267
|
+
})) : s.push({
|
|
268
|
+
code: "INVALID_VARIABLE",
|
|
269
|
+
message: `Variable at index ${n} has no name`
|
|
282
270
|
});
|
|
283
271
|
});
|
|
284
272
|
}, k = () => {
|
|
@@ -376,20 +364,16 @@ var i = /* @__PURE__ */ new Set([
|
|
|
376
364
|
let t = /* @__PURE__ */ new Set();
|
|
377
365
|
Object.entries(e.definition.bindings).forEach(([n, r]) => {
|
|
378
366
|
(r ?? []).forEach((r) => {
|
|
379
|
-
|
|
380
|
-
s.push({
|
|
381
|
-
code: "MISSING_BINDING_ID",
|
|
382
|
-
message: `Element "${e.id}" has a ${n} binding to "${r.to}" with no id`,
|
|
383
|
-
elementId: e.id
|
|
384
|
-
});
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
t.has(r.id) && s.push({
|
|
367
|
+
r.id ? (t.has(r.id) && s.push({
|
|
388
368
|
code: "DUPLICATE_BINDING_ID",
|
|
389
369
|
message: `Element "${e.id}" has two bindings called "${r.id}"`,
|
|
390
370
|
elementId: e.id,
|
|
391
371
|
details: { bindingId: r.id }
|
|
392
|
-
}), t.add(r.id)
|
|
372
|
+
}), t.add(r.id)) : s.push({
|
|
373
|
+
code: "MISSING_BINDING_ID",
|
|
374
|
+
message: `Element "${e.id}" has a ${n} binding to "${r.to}" with no id`,
|
|
375
|
+
elementId: e.id
|
|
376
|
+
});
|
|
393
377
|
});
|
|
394
378
|
});
|
|
395
379
|
});
|
|
@@ -465,16 +449,12 @@ var i = /* @__PURE__ */ new Set([
|
|
|
465
449
|
Object.values(n).forEach((r) => {
|
|
466
450
|
if (!r || !t(r)) return;
|
|
467
451
|
let i = r.attributes.referenceId, a = typeof i == "string" ? p[i] : void 0;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
});
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
e && d.set(e, (d.get(e) ?? /* @__PURE__ */ new Set()).add(i)), (r.definition.items ?? []).forEach((t) => {
|
|
452
|
+
!a || typeof i != "string" ? s.push({
|
|
453
|
+
code: "UNRESOLVED_COMPONENT",
|
|
454
|
+
message: `Instance "${r.id}" places component "${String(i)}", which this space does not declare`,
|
|
455
|
+
elementId: r.id,
|
|
456
|
+
...e ? { componentId: e } : {}
|
|
457
|
+
}) : (e && d.set(e, (d.get(e) ?? /* @__PURE__ */ new Set()).add(i)), (r.definition.items ?? []).forEach((t) => {
|
|
478
458
|
let o = n[t]?.attributes.slot ?? a.slots?.[0];
|
|
479
459
|
(typeof o != "string" || !a.slots?.includes(o)) && s.push({
|
|
480
460
|
code: "UNKNOWN_COMPONENT_SLOT",
|
|
@@ -482,7 +462,7 @@ var i = /* @__PURE__ */ new Set([
|
|
|
482
462
|
elementId: t,
|
|
483
463
|
...e ? { componentId: e } : {}
|
|
484
464
|
});
|
|
485
|
-
});
|
|
465
|
+
}));
|
|
486
466
|
});
|
|
487
467
|
});
|
|
488
468
|
let f = /* @__PURE__ */ new Set(), m = (e, t) => {
|
|
@@ -494,9 +474,7 @@ var i = /* @__PURE__ */ new Set([
|
|
|
494
474
|
componentId: e,
|
|
495
475
|
details: { cycle: n }
|
|
496
476
|
}));
|
|
497
|
-
|
|
498
|
-
}
|
|
499
|
-
d.get(e)?.forEach((n) => m(n, [...t, e]));
|
|
477
|
+
} else d.get(e)?.forEach((n) => m(n, [...t, e]));
|
|
500
478
|
};
|
|
501
479
|
Object.keys(p).forEach((e) => m(e, []));
|
|
502
480
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,13 @@ export * from './helpers/components';
|
|
|
6
6
|
export * from './helpers/elementTree';
|
|
7
7
|
export * from './helpers/schemaValidator';
|
|
8
8
|
export { FlatMap, SchemaReducer };
|
|
9
|
+
export { slugifyElementId } from './helpers/elementId';
|
|
10
|
+
export { uniqueElementId } from './helpers/elementId';
|
|
11
|
+
export { isValidElementId } from './helpers/elementId';
|
|
12
|
+
export { positionalElementId } from './helpers/elementId';
|
|
13
|
+
export { elementIdConflict } from './helpers/elementId';
|
|
14
|
+
export { randomElementId } from './helpers/elementId';
|
|
15
|
+
export { default as fitSnippet } from './helpers/fitSnippet';
|
|
16
|
+
export { repointIds } from './helpers/elementId';
|
|
17
|
+
export { styleWithoutTag } from './helpers/styleWithoutTag';
|
|
18
|
+
export { rendersNoTag } from './helpers/styleWithoutTag';
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { elementIdConflict as e, isValidElementId as t, positionalElementId as n, randomElementId as r, repointIds as i, slugifyElementId as a, uniqueElementId as o } from "./helpers/elementId.mjs";
|
|
2
|
+
import { descendants as s, elementsByRoot as c, parentChain as l, renderContext as u, rootName as d } from "./helpers/elementTree.mjs";
|
|
3
|
+
import f from "./helpers/FlatMap.mjs";
|
|
4
|
+
import { RESERVED_PROP_NAMES as p, addComponent as m, componentNamed as h, detachInstance as g, documentIds as _, flatMapOf as v, instancesOf as y, isInstance as b, propNameProblem as x, removeComponent as S, renameElement as C, treeOf as w, treesOf as T, updateComponent as E } from "./helpers/components.mjs";
|
|
5
|
+
import D, { SchemaActions as O } from "./SchemaReducer.mjs";
|
|
6
|
+
import k from "./helpers/fitSnippet.mjs";
|
|
7
|
+
import { REFERENCE_ERROR_CODES as A, assertSchemaValid as j, isIntegrityError as M, isSchemaValid as N, validateSchema as P } from "./helpers/schemaValidator.mjs";
|
|
8
|
+
import { rendersNoTag as F, styleWithoutTag as I } from "./helpers/styleWithoutTag.mjs";
|
|
9
|
+
export { f as FlatMap, A as REFERENCE_ERROR_CODES, p as RESERVED_PROP_NAMES, O as SchemaActions, D as SchemaReducer, m as addComponent, j as assertSchemaValid, h as componentNamed, s as descendants, g as detachInstance, _ as documentIds, e as elementIdConflict, c as elementsByRoot, k as fitSnippet, v as flatMapOf, y as instancesOf, b as isInstance, M as isIntegrityError, N as isSchemaValid, t as isValidElementId, l as parentChain, n as positionalElementId, x as propNameProblem, r as randomElementId, S as removeComponent, C as renameElement, u as renderContext, F as rendersNoTag, i as repointIds, d as rootName, a as slugifyElementId, I as styleWithoutTag, w as treeOf, T as treesOf, o as uniqueElementId, E as updateComponent, P as validateSchema };
|
package/package.json
CHANGED
|
@@ -1,50 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-schema",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.18",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"@plitzi/source": "./src/index.ts",
|
|
10
11
|
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.mjs"
|
|
12
13
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"./helpers/FlatMap": {
|
|
18
|
-
"types": "./dist/helpers/FlatMap.d.ts",
|
|
19
|
-
"import": "./dist/helpers/FlatMap.mjs"
|
|
20
|
-
},
|
|
21
|
-
"./helpers/components": {
|
|
22
|
-
"types": "./dist/helpers/components.d.ts",
|
|
23
|
-
"import": "./dist/helpers/components.mjs"
|
|
24
|
-
},
|
|
25
|
-
"./helpers/elementId": {
|
|
26
|
-
"types": "./dist/helpers/elementId.d.ts",
|
|
27
|
-
"import": "./dist/helpers/elementId.mjs"
|
|
28
|
-
},
|
|
29
|
-
"./helpers/elementTree": {
|
|
30
|
-
"types": "./dist/helpers/elementTree.d.ts",
|
|
31
|
-
"import": "./dist/helpers/elementTree.mjs"
|
|
32
|
-
},
|
|
33
|
-
"./helpers/fitSnippet": {
|
|
34
|
-
"types": "./dist/helpers/fitSnippet.d.ts",
|
|
35
|
-
"import": "./dist/helpers/fitSnippet.mjs"
|
|
36
|
-
},
|
|
37
|
-
"./helpers/schemaValidator": {
|
|
38
|
-
"types": "./dist/helpers/schemaValidator.d.ts",
|
|
39
|
-
"import": "./dist/helpers/schemaValidator.mjs"
|
|
40
|
-
},
|
|
41
|
-
"./helpers/styleWithoutTag": {
|
|
42
|
-
"types": "./dist/helpers/styleWithoutTag.d.ts",
|
|
43
|
-
"import": "./dist/helpers/styleWithoutTag.mjs"
|
|
44
|
-
},
|
|
45
|
-
"./index": {
|
|
46
|
-
"types": "./dist/index.d.ts",
|
|
47
|
-
"import": "./dist/index.mjs"
|
|
14
|
+
"./*": {
|
|
15
|
+
"@plitzi/source": "./src/*/index.ts",
|
|
16
|
+
"types": "./dist/*/index.d.ts",
|
|
17
|
+
"import": "./dist/*/index.mjs"
|
|
48
18
|
}
|
|
49
19
|
},
|
|
50
20
|
"type": "module",
|
|
@@ -55,20 +25,20 @@
|
|
|
55
25
|
"test": "vitest run",
|
|
56
26
|
"test:watch": "vitest",
|
|
57
27
|
"test:ui": "vitest --ui",
|
|
58
|
-
"build:dev": "vite build --mode development --minify false
|
|
28
|
+
"build:dev": "vite build --mode development --minify false",
|
|
59
29
|
"build:dev-watch": "vite build --mode development --watch --minify false",
|
|
60
|
-
"build:prod": "vite build
|
|
30
|
+
"build:prod": "vite build"
|
|
61
31
|
},
|
|
62
32
|
"dependencies": {
|
|
63
33
|
"@plitzi/plitzi-ui": "^1.6.33",
|
|
64
|
-
"@plitzi/sdk-shared": "0.38.
|
|
65
|
-
"@plitzi/sdk-style": "0.38.
|
|
34
|
+
"@plitzi/sdk-shared": "0.38.18",
|
|
35
|
+
"@plitzi/sdk-style": "0.38.18",
|
|
66
36
|
"immer": "^11.1.21"
|
|
67
37
|
},
|
|
68
38
|
"devDependencies": {
|
|
69
39
|
"eslint": "^9.39.5",
|
|
70
40
|
"typescript": "^6.0.3",
|
|
71
|
-
"vite": "^8.3.
|
|
72
|
-
"vitest": "^5.0.
|
|
41
|
+
"vite": "^8.3.4",
|
|
42
|
+
"vitest": "^5.0.5"
|
|
73
43
|
}
|
|
74
44
|
}
|