soma-core 1.3.5 → 1.4.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/README.md +20 -7
- package/app/SomaPageClient.tsx +4 -4
- package/app/components/SomaHostPage.tsx +5 -5
- package/app/components/SomaHydrationShell.tsx +4 -7
- package/app/globals.css +126 -3
- package/core/build/{v2 → blocks}/block-compile.ts +17 -17
- package/core/build/{v2/soma-file-loader.ts → blocks/block-container.ts} +28 -28
- package/core/build/{v2 → blocks}/block-loader.ts +1 -1
- package/core/build/{v2 → blocks}/html-index.ts +1 -1
- package/core/build/{v2/migrate-v1.ts → blocks/migrate-flat.ts} +27 -27
- package/core/build/compiler/host-config-sync.cjs +2 -9
- package/core/build/compiler/page-declaration-compiler.ts +2 -2
- package/core/build/compiler/soma-manifest-webpack-plugin.js +1 -1
- package/core/build/compiler/soma-precompile.js +17 -17
- package/core/build/compiler/soma-precompile.ts +2 -2
- package/core/client/component/ai-catalog.ts +4 -4
- package/core/client/component/contract-compat.ts +32 -3
- package/core/client/component/{example-v2.ts → example-blocks.ts} +19 -19
- package/core/client/engine/soma-bootstrap.ts +21 -2
- package/core/client/engine/style-binder.ts +1 -1
- package/core/client/infra/notify/DomNotifyService.ts +2 -1
- package/core/client/infra/notify/INotifyTheme.ts +1 -1
- package/core/client/parser/{v2 → blocks}/namespace.ts +1 -1
- package/core/client/parser/{v2 → blocks}/page-parser.ts +16 -16
- package/core/client/parser/{v2 → blocks}/use-parser.ts +20 -14
- package/core/client/parser/style-config-parser.ts +7 -7
- package/core/client/parser/value-lang.ts +1 -1
- package/core/client/registry/index.ts +8 -0
- package/core/client/theme/theme-engine.ts +42 -14
- package/core/client/typography/typography-base.ts +1 -1
- package/core/index.ts +25 -13
- package/core/server/host/csp-nonce-metadata.ts +1 -1
- package/core/server/host/published-page-assets.ts +3 -8
- package/core/server/host/soma-page-compile.ts +1 -1
- package/core/server/index.ts +2 -2
- package/core/shared/published-page-route.ts +61 -0
- package/core/shared/types/adaptive.types.ts +1 -1
- package/core/shared/types/data-config.types.ts +30 -2
- package/core/shared/types/scope-manifest.types.ts +11 -15
- package/core/shared/types/style-config.types.ts +4 -4
- package/dist/cli/soma.js +15 -2
- package/dist/core/index.cjs +165 -76
- package/dist/types/build/{v2 → blocks}/block-compile.d.ts +7 -7
- package/dist/types/build/{v2/soma-file-loader.d.ts → blocks/block-container.d.ts} +6 -6
- package/dist/types/build/{v2/migrate-v1.d.ts → blocks/migrate-flat.d.ts} +6 -6
- package/dist/types/client/component/contract-compat.d.ts +2 -2
- package/dist/types/client/component/example-blocks.d.ts +9 -0
- package/dist/types/client/infra/notify/DomNotifyService.d.ts +2 -1
- package/dist/types/client/infra/notify/INotifyTheme.d.ts +1 -1
- package/dist/types/client/parser/{v2 → blocks}/page-parser.d.ts +2 -2
- package/dist/types/client/parser/{v2 → blocks}/use-parser.d.ts +1 -1
- package/dist/types/client/parser/style-config-parser.d.ts +1 -1
- package/dist/types/client/registry/index.d.ts +1 -0
- package/dist/types/client/theme/theme-engine.d.ts +11 -0
- package/dist/types/index.d.ts +8 -7
- package/dist/types/server/host/published-page-assets.d.ts +3 -2
- package/dist/types/server/index.d.ts +1 -1
- package/dist/types/shared/published-page-route.d.ts +21 -0
- package/dist/types/shared/types/data-config.types.d.ts +18 -2
- package/dist/types/shared/types/scope-manifest.types.d.ts +11 -11
- package/dist/types/shared/types/style-config.types.d.ts +4 -4
- package/package.json +1 -6
- package/dist/types/client/component/example-v2.d.ts +0 -9
- package/postcss.config.js +0 -6
- package/tailwind.config.ts +0 -43
- /package/dist/types/build/{v2 → blocks}/block-loader.d.ts +0 -0
- /package/dist/types/build/{v2 → blocks}/html-index.d.ts +0 -0
- /package/dist/types/client/parser/{v2 → blocks}/namespace.d.ts +0 -0
package/dist/core/index.cjs
CHANGED
|
@@ -36,17 +36,22 @@ __export(index_exports, {
|
|
|
36
36
|
MiniProgramContainerAdapter: () => MiniProgramContainerAdapter,
|
|
37
37
|
PACK_NAME_PATTERN: () => PACK_NAME_PATTERN,
|
|
38
38
|
PAGE_BLOCK_ID: () => PAGE_BLOCK_ID,
|
|
39
|
+
PUBLISHED_PAGE_SLUG_PATTERN: () => PUBLISHED_PAGE_SLUG_PATTERN,
|
|
39
40
|
Page: () => Page,
|
|
41
|
+
RESERVED_PUBLISHED_PAGE_SLUGS: () => RESERVED_PUBLISHED_PAGE_SLUGS,
|
|
40
42
|
ReactNativeContainerAdapter: () => ReactNativeContainerAdapter,
|
|
41
43
|
SOMA_ADAPTIVE_MAX_LADDER: () => SOMA_ADAPTIVE_MAX_LADDER,
|
|
42
44
|
SOMA_ADAPTIVE_PROFILES: () => SOMA_ADAPTIVE_PROFILES,
|
|
43
45
|
SOMA_ADAPTIVE_PROFILE_ATTR: () => SOMA_ADAPTIVE_PROFILE_ATTR,
|
|
46
|
+
SOMA_DATA_FIELD_TYPES: () => SOMA_DATA_FIELD_TYPES,
|
|
47
|
+
SOMA_DATA_FIELD_TYPE_ALIASES: () => SOMA_DATA_FIELD_TYPE_ALIASES,
|
|
44
48
|
SOMA_DEFAULT_HYSTERESIS: () => SOMA_DEFAULT_HYSTERESIS,
|
|
45
49
|
SOMA_PURIFY_PROFILE: () => SOMA_PURIFY_PROFILE,
|
|
46
50
|
Show: () => Show,
|
|
47
51
|
ShowList: () => ShowList,
|
|
48
52
|
SomaAdaptiveConfigError: () => SomaAdaptiveConfigError,
|
|
49
53
|
SomaApi: () => SomaApi,
|
|
54
|
+
SomaBlockParseError: () => SomaBlockParseError,
|
|
50
55
|
SomaBootstrap: () => SomaBootstrap,
|
|
51
56
|
SomaComponentManager: () => SomaComponentManager,
|
|
52
57
|
SomaComponentRegistry: () => SomaComponentRegistry,
|
|
@@ -67,7 +72,6 @@ __export(index_exports, {
|
|
|
67
72
|
SomaRealtimeService: () => SomaRealtimeService,
|
|
68
73
|
SomaScopeError: () => SomaScopeError,
|
|
69
74
|
SomaTelemetry: () => SomaTelemetry,
|
|
70
|
-
SomaV2ParseError: () => SomaV2ParseError,
|
|
71
75
|
SomaValidator: () => SomaValidator,
|
|
72
76
|
SomaValueLangError: () => SomaValueLangError,
|
|
73
77
|
SseRealtimeTransport: () => SseRealtimeTransport,
|
|
@@ -84,7 +88,7 @@ __export(index_exports, {
|
|
|
84
88
|
checkOverrideCompat: () => checkOverrideCompat,
|
|
85
89
|
compileAdaptive: () => compileAdaptive,
|
|
86
90
|
compilePageAssets: () => compilePageAssets,
|
|
87
|
-
|
|
91
|
+
compileSomaBlocks: () => compileSomaBlocks,
|
|
88
92
|
composeComponentPacks: () => composeComponentPacks,
|
|
89
93
|
contrastRatio: () => contrastRatio,
|
|
90
94
|
createAdaptiveObserverPool: () => createAdaptiveObserverPool,
|
|
@@ -118,6 +122,7 @@ __export(index_exports, {
|
|
|
118
122
|
isBootTimingsEnabled: () => isBootTimingsEnabled,
|
|
119
123
|
isEventHandlerAttribute: () => isEventHandlerAttribute,
|
|
120
124
|
isPlainPath: () => isPlainPath,
|
|
125
|
+
isPublishedPageSlug: () => isPublishedPageSlug,
|
|
121
126
|
isSomaMockEnabled: () => isSomaMockEnabled,
|
|
122
127
|
loadSomaDomainModuleFromRegistry: () => loadSomaDomainModuleFromRegistry,
|
|
123
128
|
loadSomaFile: () => loadSomaFile,
|
|
@@ -125,6 +130,7 @@ __export(index_exports, {
|
|
|
125
130
|
matchGlobPath: () => matchGlobPath,
|
|
126
131
|
maybeStartBootTimings: () => maybeStartBootTimings,
|
|
127
132
|
normalizeDataPipeValue: () => normalizeDataPipeValue,
|
|
133
|
+
normalizePublishedPageSlug: () => normalizePublishedPageSlug,
|
|
128
134
|
parseAdaptiveConfig: () => parseAdaptiveConfig,
|
|
129
135
|
parseDataConfig: () => parseDataConfig,
|
|
130
136
|
parseDataRef: () => parseDataRef,
|
|
@@ -132,6 +138,8 @@ __export(index_exports, {
|
|
|
132
138
|
parsePageBlock: () => parsePageBlock,
|
|
133
139
|
parseUseBlock: () => parseUseBlock,
|
|
134
140
|
parseValueSegment: () => parseValueSegment,
|
|
141
|
+
publishedPagePath: () => publishedPagePath,
|
|
142
|
+
publishedPageSlugFromPath: () => publishedPageSlugFromPath,
|
|
135
143
|
readBootTimings: () => readBootTimings,
|
|
136
144
|
recordMetric: () => recordMetric,
|
|
137
145
|
renderPublishedPage: () => renderPublishedPage,
|
|
@@ -5040,7 +5048,7 @@ function parseBase(raw, path) {
|
|
|
5040
5048
|
validateSomaId(somaId, `${path}.${somaId}`);
|
|
5041
5049
|
if (typeof classes !== "string") {
|
|
5042
5050
|
throw new SomaStyleConfigError(
|
|
5043
|
-
`base \u7684\u503C\u5FC5\u987B\u662F
|
|
5051
|
+
`base \u7684\u503C\u5FC5\u987B\u662F CSS \u7C7B\u540D\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(classes)}`,
|
|
5044
5052
|
`${path}.${somaId}`
|
|
5045
5053
|
);
|
|
5046
5054
|
}
|
|
@@ -5077,7 +5085,7 @@ function parseStateRule(raw, path) {
|
|
|
5077
5085
|
}
|
|
5078
5086
|
if (!obj.apply || typeof obj.apply !== "string") {
|
|
5079
5087
|
throw new SomaStyleConfigError(
|
|
5080
|
-
`apply \u5FC5\u987B\u662F\u975E\u7A7A
|
|
5088
|
+
`apply \u5FC5\u987B\u662F\u975E\u7A7A CSS \u7C7B\u540D\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(obj.apply)}`,
|
|
5081
5089
|
path
|
|
5082
5090
|
);
|
|
5083
5091
|
}
|
|
@@ -5127,7 +5135,7 @@ function parseTransition(raw, somaId, path) {
|
|
|
5127
5135
|
}
|
|
5128
5136
|
if (!obj.apply || typeof obj.apply !== "string") {
|
|
5129
5137
|
throw new SomaStyleConfigError(
|
|
5130
|
-
`apply \u5FC5\u987B\u662F\u975E\u7A7A
|
|
5138
|
+
`apply \u5FC5\u987B\u662F\u975E\u7A7A CSS \u7C7B\u540D\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(obj.apply)}`,
|
|
5131
5139
|
path
|
|
5132
5140
|
);
|
|
5133
5141
|
}
|
|
@@ -5220,7 +5228,7 @@ function parseTheme(raw, themeName, path) {
|
|
|
5220
5228
|
} else {
|
|
5221
5229
|
if (typeof value !== "string") {
|
|
5222
5230
|
throw new SomaStyleConfigError(
|
|
5223
|
-
`\u4E3B\u9898\u57FA\u7840\u8986\u76D6\u7684\u503C\u5FC5\u987B\u662F
|
|
5231
|
+
`\u4E3B\u9898\u57FA\u7840\u8986\u76D6\u7684\u503C\u5FC5\u987B\u662F CSS \u7C7B\u540D\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value)}`,
|
|
5224
5232
|
`${path}.${key}`
|
|
5225
5233
|
);
|
|
5226
5234
|
}
|
|
@@ -12295,17 +12303,20 @@ function deriveTheme(input) {
|
|
|
12295
12303
|
// ── 焦点环(暗色主色,透明度略高以在深底可见)──
|
|
12296
12304
|
"--soma-focus-ring": `0 0 0 3px ${hexWithAlpha(darkPrimary, 0.35)}`
|
|
12297
12305
|
};
|
|
12306
|
+
const darkMerged = input.darkOverrides ? { ...input.overrides, ...input.darkOverrides } : input.overrides;
|
|
12298
12307
|
if (input.overrides) {
|
|
12299
12308
|
Object.assign(cssVars, input.overrides);
|
|
12300
|
-
|
|
12309
|
+
}
|
|
12310
|
+
if (darkMerged) {
|
|
12311
|
+
Object.assign(darkCssVars, darkMerged);
|
|
12301
12312
|
}
|
|
12302
12313
|
syncSoftWithOverrides(cssVars, input.overrides);
|
|
12303
|
-
syncSoftWithOverrides(darkCssVars,
|
|
12314
|
+
syncSoftWithOverrides(darkCssVars, darkMerged);
|
|
12304
12315
|
enforceContrastPairs(cssVars);
|
|
12305
12316
|
enforceContrastPairs(darkCssVars);
|
|
12306
12317
|
deriveOnSoftTokens(cssVars, false);
|
|
12307
12318
|
deriveOnSoftTokens(darkCssVars, true);
|
|
12308
|
-
const
|
|
12319
|
+
const makeRescale = (tokens) => tokens?.["--soma-c-primary"] ? (primaryHex) => {
|
|
12309
12320
|
const p = hexToOklch(primaryHex);
|
|
12310
12321
|
const rebuilt = {};
|
|
12311
12322
|
STEPS.forEach((step, i) => {
|
|
@@ -12317,8 +12328,10 @@ function deriveTheme(input) {
|
|
|
12317
12328
|
});
|
|
12318
12329
|
return rebuilt;
|
|
12319
12330
|
} : null;
|
|
12331
|
+
const rescale = makeRescale(input.overrides);
|
|
12332
|
+
const darkRescale = makeRescale(darkMerged);
|
|
12320
12333
|
Object.assign(cssVars, sceneColorTokens(cssVars, axes, params.fieldAlphas, hexWithAlpha, scale, rescale));
|
|
12321
|
-
Object.assign(darkCssVars, sceneColorTokens(darkCssVars, axes, params.fieldAlphas, hexWithAlpha, scale,
|
|
12334
|
+
Object.assign(darkCssVars, sceneColorTokens(darkCssVars, axes, params.fieldAlphas, hexWithAlpha, scale, darkRescale));
|
|
12322
12335
|
return {
|
|
12323
12336
|
scale,
|
|
12324
12337
|
cssVars,
|
|
@@ -12887,7 +12900,15 @@ var SomaBootstrap = class {
|
|
|
12887
12900
|
setupComponentManager(container, assets, uiConfig) {
|
|
12888
12901
|
this.componentManager?.destroy();
|
|
12889
12902
|
this.componentManager = null;
|
|
12890
|
-
const
|
|
12903
|
+
const pageComponents = assets.components ?? {};
|
|
12904
|
+
const shadowed = Object.keys(pageComponents).filter((name) => Object.hasOwn(this.hostComponents, name));
|
|
12905
|
+
if (shadowed.length > 0) {
|
|
12906
|
+
this.diagnostics.recordValidation(
|
|
12907
|
+
"warning",
|
|
12908
|
+
`[\u7EC4\u4EF6\u8986\u76D6] \u9875\u9762\u7EA7\u8D44\u4EA7\u8986\u76D6\u4E86 Host \u7EA7\u540C\u540D\u7EC4\u4EF6\uFF1A${shadowed.join("\u3001")}\u3002\u9875\u9762\u7EA7\u80DC\u51FA\u662F\u65E2\u5B9A\u884C\u4E3A\uFF0C\u4F46\u8986\u76D6\u4E0D\u5E94\u662F\u610F\u5916\u2014\u2014\u82E5\u975E\u672C\u610F\uFF0C\u8BF7\u6539\u540D\u6216\u5728\u7EC4\u4EF6\u5305\u4FA7\u7528 overrides / allowOverride \u663E\u5F0F\u8868\u8FBE\u88C1\u51B3\u3002`
|
|
12909
|
+
);
|
|
12910
|
+
}
|
|
12911
|
+
const defs = { ...this.hostComponents, ...pageComponents };
|
|
12891
12912
|
if (Object.keys(defs).length === 0) {
|
|
12892
12913
|
return;
|
|
12893
12914
|
}
|
|
@@ -13020,7 +13041,7 @@ var SomaBootstrap = class {
|
|
|
13020
13041
|
}
|
|
13021
13042
|
};
|
|
13022
13043
|
|
|
13023
|
-
// core/client/component/example-
|
|
13044
|
+
// core/client/component/example-blocks.ts
|
|
13024
13045
|
var UI_PREFIX = "ui:";
|
|
13025
13046
|
var EVENT_PREFIX = "event:";
|
|
13026
13047
|
function balancedSlice(text, start) {
|
|
@@ -13039,7 +13060,7 @@ function lineAfter(lines, prefix) {
|
|
|
13039
13060
|
const hit = lines.find((line) => line.trimStart().startsWith(prefix));
|
|
13040
13061
|
return hit ? hit.trimStart().slice(prefix.length).trim() : null;
|
|
13041
13062
|
}
|
|
13042
|
-
function
|
|
13063
|
+
function parseFlatExample(example) {
|
|
13043
13064
|
const lines = example.split("\n");
|
|
13044
13065
|
const ui = lineAfter(lines, UI_PREFIX);
|
|
13045
13066
|
if (!ui) return null;
|
|
@@ -13063,8 +13084,8 @@ function parseV1Example(example) {
|
|
|
13063
13084
|
}
|
|
13064
13085
|
return { anchor, propsBody: propsBody.trim(), emits };
|
|
13065
13086
|
}
|
|
13066
|
-
function
|
|
13067
|
-
const parsed =
|
|
13087
|
+
function deriveBlockExample(componentName, example) {
|
|
13088
|
+
const parsed = parseFlatExample(example);
|
|
13068
13089
|
if (!parsed) return null;
|
|
13069
13090
|
const lines = [
|
|
13070
13091
|
`${parsed.anchor}:`,
|
|
@@ -13228,10 +13249,10 @@ function renderMarkdown(entries, conventions) {
|
|
|
13228
13249
|
lines.push("```");
|
|
13229
13250
|
lines.push(entry.ai.example.trimEnd());
|
|
13230
13251
|
lines.push("```");
|
|
13231
|
-
const v2 =
|
|
13252
|
+
const v2 = deriveBlockExample(entry.name, entry.ai.example);
|
|
13232
13253
|
if (v2) {
|
|
13233
13254
|
lines.push("");
|
|
13234
|
-
lines.push("
|
|
13255
|
+
lines.push("\u5757\u5199\u6CD5\uFF08html \u540C\u4E0A\uFF0C_ui.yaml \u6539\u4E3A\u5757\u58F0\u660E\uFF09\uFF1A");
|
|
13235
13256
|
lines.push("```");
|
|
13236
13257
|
lines.push(v2);
|
|
13237
13258
|
lines.push("```");
|
|
@@ -13249,6 +13270,27 @@ function renderMarkdown(entries, conventions) {
|
|
|
13249
13270
|
return lines.join("\n");
|
|
13250
13271
|
}
|
|
13251
13272
|
|
|
13273
|
+
// core/shared/types/data-config.types.ts
|
|
13274
|
+
var SOMA_DATA_FIELD_TYPE_ALIASES = {
|
|
13275
|
+
number: "float"
|
|
13276
|
+
};
|
|
13277
|
+
var SOMA_DATA_FIELD_TYPES = [
|
|
13278
|
+
"text",
|
|
13279
|
+
"int",
|
|
13280
|
+
"float",
|
|
13281
|
+
"money",
|
|
13282
|
+
"bool",
|
|
13283
|
+
"enum",
|
|
13284
|
+
"date",
|
|
13285
|
+
"datetime",
|
|
13286
|
+
"image",
|
|
13287
|
+
"url",
|
|
13288
|
+
"richtext",
|
|
13289
|
+
"percent",
|
|
13290
|
+
"progress",
|
|
13291
|
+
...Object.keys(SOMA_DATA_FIELD_TYPE_ALIASES)
|
|
13292
|
+
];
|
|
13293
|
+
|
|
13252
13294
|
// core/client/typography/typography-base.ts
|
|
13253
13295
|
var TYPOGRAPHY_BASE_CSS = `[data-soma-host] {
|
|
13254
13296
|
text-autospace: normal;
|
|
@@ -13386,14 +13428,14 @@ function rawTier(value, bounds) {
|
|
|
13386
13428
|
return tier;
|
|
13387
13429
|
}
|
|
13388
13430
|
|
|
13389
|
-
// core/build/
|
|
13390
|
-
var
|
|
13431
|
+
// core/build/blocks/block-container.ts
|
|
13432
|
+
var SomaBlockParseError = class extends Error {
|
|
13391
13433
|
constructor(message, blockId, line) {
|
|
13392
13434
|
const where = blockId ? `\uFF08\u5757: ${blockId}${line ? `\uFF0C\u7B2C ${line} \u884C` : ""}\uFF09` : "";
|
|
13393
13435
|
super(`[soma-core][\u5F15\u64CE] ${message}${where}`);
|
|
13394
13436
|
this.blockId = blockId;
|
|
13395
13437
|
this.line = line;
|
|
13396
|
-
this.name = "
|
|
13438
|
+
this.name = "SomaBlockParseError";
|
|
13397
13439
|
}
|
|
13398
13440
|
};
|
|
13399
13441
|
var PAGE_BLOCK_ID = "page";
|
|
@@ -13404,58 +13446,58 @@ function stripSwitch(uiYamlRaw) {
|
|
|
13404
13446
|
const text = lines[i].trim();
|
|
13405
13447
|
if (text === "" || text.startsWith("#")) continue;
|
|
13406
13448
|
if (text !== "{{") {
|
|
13407
|
-
throw new
|
|
13449
|
+
throw new SomaBlockParseError("\u5757\u58F0\u660E\u5FC5\u987B\u4EE5 `{{` \u5F00\u5173\u884C\u5F00\u5934");
|
|
13408
13450
|
}
|
|
13409
13451
|
openIndex = i;
|
|
13410
13452
|
break;
|
|
13411
13453
|
}
|
|
13412
13454
|
if (openIndex === -1) {
|
|
13413
|
-
throw new
|
|
13455
|
+
throw new SomaBlockParseError("\u6587\u4EF6\u4E3A\u7A7A\u6216\u53EA\u6709\u6CE8\u91CA\uFF0C\u627E\u4E0D\u5230 `{{` \u5F00\u5173\u884C");
|
|
13414
13456
|
}
|
|
13415
13457
|
let closeIndex = -1;
|
|
13416
13458
|
for (let i = lines.length - 1; i > openIndex; i -= 1) {
|
|
13417
13459
|
const text = lines[i].trim();
|
|
13418
13460
|
if (text === "") continue;
|
|
13419
13461
|
if (text !== "}}") {
|
|
13420
|
-
throw new
|
|
13462
|
+
throw new SomaBlockParseError("\u5757\u58F0\u660E\u5FC5\u987B\u4EE5 `}}` \u6536\u53E3\u884C\u7ED3\u5C3E\uFF08\u5F00\u5173\u6210\u5BF9\uFF0C\u6574\u6587\u4EF6\u4E00\u5BF9\uFF09");
|
|
13421
13463
|
}
|
|
13422
13464
|
closeIndex = i;
|
|
13423
13465
|
break;
|
|
13424
13466
|
}
|
|
13425
13467
|
if (closeIndex === -1) {
|
|
13426
|
-
throw new
|
|
13468
|
+
throw new SomaBlockParseError("`{{` \u5F00\u5173\u672A\u95ED\u5408\u2014\u2014\u7F3A\u5C11 `}}` \u6536\u53E3\u884C");
|
|
13427
13469
|
}
|
|
13428
13470
|
return {
|
|
13429
13471
|
inner: lines.slice(openIndex + 1, closeIndex).join("\n"),
|
|
13430
13472
|
offset: openIndex + 1
|
|
13431
13473
|
};
|
|
13432
13474
|
}
|
|
13433
|
-
function
|
|
13475
|
+
function parseSomaBlockContainer(uiYamlRaw) {
|
|
13434
13476
|
const { inner, offset } = stripSwitch(uiYamlRaw);
|
|
13435
13477
|
let doc;
|
|
13436
13478
|
try {
|
|
13437
13479
|
doc = yaml.load(inner);
|
|
13438
13480
|
} catch (error) {
|
|
13439
|
-
throw new
|
|
13481
|
+
throw new SomaBlockParseError(`YAML \u89E3\u6790\u5931\u8D25: ${error.message}`);
|
|
13440
13482
|
}
|
|
13441
13483
|
if (doc === null || doc === void 0) {
|
|
13442
13484
|
return { doc: {}, inner, offset };
|
|
13443
13485
|
}
|
|
13444
13486
|
if (typeof doc !== "object" || Array.isArray(doc)) {
|
|
13445
|
-
throw new
|
|
13487
|
+
throw new SomaBlockParseError("\u5F00\u5173\u5185\u5FC5\u987B\u662F\u5757\u6620\u5C04\uFF08\u9876\u5C42\u952E = \u5757 id\uFF09");
|
|
13446
13488
|
}
|
|
13447
13489
|
for (const [blockId, body] of Object.entries(doc)) {
|
|
13448
13490
|
if (body === null || body === void 0) {
|
|
13449
|
-
throw new
|
|
13491
|
+
throw new SomaBlockParseError("\u5757\u4F53\u4E3A\u7A7A\u2014\u2014\u4E0D\u9700\u8981\u58F0\u660E\u7684\u7EC4\u4EF6\u8BF7\u76F4\u63A5\u5220\u6389\u8FD9\u4E2A\u5757", blockId);
|
|
13450
13492
|
}
|
|
13451
13493
|
if (typeof body !== "object" || Array.isArray(body)) {
|
|
13452
|
-
throw new
|
|
13494
|
+
throw new SomaBlockParseError("\u5757\u4F53\u5FC5\u987B\u662F\u6620\u5C04\uFF08ui/data/event \u4E09\u6BB5\uFF09", blockId);
|
|
13453
13495
|
}
|
|
13454
13496
|
}
|
|
13455
13497
|
return { doc, inner, offset };
|
|
13456
13498
|
}
|
|
13457
13499
|
function loadSomaFile(input) {
|
|
13458
|
-
const { doc, inner, offset } =
|
|
13500
|
+
const { doc, inner, offset } = parseSomaBlockContainer(input.uiYamlRaw);
|
|
13459
13501
|
if (Object.keys(doc).length === 0) return [];
|
|
13460
13502
|
const innerLines = inner.split("\n");
|
|
13461
13503
|
const lineOfKey = (key) => {
|
|
@@ -13468,13 +13510,13 @@ function loadSomaFile(input) {
|
|
|
13468
13510
|
const line = lineOfKey(blockId);
|
|
13469
13511
|
assertBlockId(blockId, input.htmlIndex, line);
|
|
13470
13512
|
if (seen.has(blockId)) {
|
|
13471
|
-
throw new
|
|
13513
|
+
throw new SomaBlockParseError(`\u5757 "${blockId}" \u91CD\u590D\u58F0\u660E`, blockId, line);
|
|
13472
13514
|
}
|
|
13473
13515
|
if (body === null || body === void 0) {
|
|
13474
|
-
throw new
|
|
13516
|
+
throw new SomaBlockParseError("\u5757\u4F53\u4E3A\u7A7A\u2014\u2014\u4E0D\u9700\u8981\u58F0\u660E\u7684\u7EC4\u4EF6\u8BF7\u76F4\u63A5\u5220\u6389\u8FD9\u4E2A\u5757", blockId, line);
|
|
13475
13517
|
}
|
|
13476
13518
|
if (typeof body !== "object" || Array.isArray(body)) {
|
|
13477
|
-
throw new
|
|
13519
|
+
throw new SomaBlockParseError("\u5757\u4F53\u5FC5\u987B\u662F\u6620\u5C04\uFF08ui/data/event \u4E09\u6BB5\uFF09", blockId, line);
|
|
13478
13520
|
}
|
|
13479
13521
|
seen.add(blockId);
|
|
13480
13522
|
blocks.push({ blockId, body, line, source: "inline" });
|
|
@@ -13482,7 +13524,7 @@ function loadSomaFile(input) {
|
|
|
13482
13524
|
for (const [blockId, raw] of input.externalBlocks ?? /* @__PURE__ */ new Map()) {
|
|
13483
13525
|
assertBlockId(blockId, input.htmlIndex, 0);
|
|
13484
13526
|
if (seen.has(blockId)) {
|
|
13485
|
-
throw new
|
|
13527
|
+
throw new SomaBlockParseError(
|
|
13486
13528
|
`\u5757 "${blockId}" \u540C\u65F6\u5B58\u5728\u4E8E _ui.yaml \u4E0E blocks/${blockId}.yaml\u2014\u2014\u4E00\u4E2A\u5B9E\u4F8B\u53EA\u80FD\u6709\u4E00\u4E2A\u58F0\u660E\u5904`,
|
|
13487
13529
|
blockId
|
|
13488
13530
|
);
|
|
@@ -13491,16 +13533,16 @@ function loadSomaFile(input) {
|
|
|
13491
13533
|
try {
|
|
13492
13534
|
body = yaml.load(raw);
|
|
13493
13535
|
} catch (error) {
|
|
13494
|
-
throw new
|
|
13536
|
+
throw new SomaBlockParseError(
|
|
13495
13537
|
`\u5916\u7F6E\u5757 blocks/${blockId}.yaml \u89E3\u6790\u5931\u8D25: ${error.message}`,
|
|
13496
13538
|
blockId
|
|
13497
13539
|
);
|
|
13498
13540
|
}
|
|
13499
13541
|
if (body === null || body === void 0) {
|
|
13500
|
-
throw new
|
|
13542
|
+
throw new SomaBlockParseError(`\u5916\u7F6E\u5757 blocks/${blockId}.yaml \u4E3A\u7A7A`, blockId);
|
|
13501
13543
|
}
|
|
13502
13544
|
if (typeof body !== "object" || Array.isArray(body)) {
|
|
13503
|
-
throw new
|
|
13545
|
+
throw new SomaBlockParseError(`\u5916\u7F6E\u5757 blocks/${blockId}.yaml \u5FC5\u987B\u662F\u6620\u5C04`, blockId);
|
|
13504
13546
|
}
|
|
13505
13547
|
seen.add(blockId);
|
|
13506
13548
|
blocks.push({ blockId, body, line: 1, source: "external" });
|
|
@@ -13511,14 +13553,14 @@ function assertBlockId(blockId, htmlIndex, line) {
|
|
|
13511
13553
|
if (blockId === PAGE_BLOCK_ID) return;
|
|
13512
13554
|
if (htmlIndex.instances.has(blockId)) return;
|
|
13513
13555
|
if (htmlIndex.anchors.has(blockId)) {
|
|
13514
|
-
throw new
|
|
13556
|
+
throw new SomaBlockParseError(
|
|
13515
13557
|
`"${blockId}" \u662F\u666E\u901A\u951A\u70B9\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u7EC4\u4EF6\u5757\u2014\u2014\u7EC4\u4EF6\u5757\u53EA\u80FD\u6302\u5728\u5E26 data-soma-component \u7684\u5B9E\u4F8B\u951A\u70B9\u4E0A\uFF1B\u666E\u901A\u951A\u70B9\u7684\u7ED1\u5B9A\u5199\u5728 page \u5757\u7684 ui: \u6BB5`,
|
|
13516
13558
|
blockId,
|
|
13517
13559
|
line
|
|
13518
13560
|
);
|
|
13519
13561
|
}
|
|
13520
13562
|
const known = [...htmlIndex.instances].slice(0, 8).join("\u3001");
|
|
13521
|
-
throw new
|
|
13563
|
+
throw new SomaBlockParseError(
|
|
13522
13564
|
`HTML \u91CC\u6CA1\u6709\u5B9E\u4F8B\u951A\u70B9 "${blockId}"${known ? `\uFF08\u73B0\u6709\u5B9E\u4F8B\uFF1A${known}\uFF09` : ""}`,
|
|
13523
13565
|
blockId,
|
|
13524
13566
|
line
|
|
@@ -13527,7 +13569,7 @@ function assertBlockId(blockId, htmlIndex, line) {
|
|
|
13527
13569
|
|
|
13528
13570
|
// core/build/compiler/soma-precompile.ts
|
|
13529
13571
|
function precompileUiModule(yamlStr) {
|
|
13530
|
-
|
|
13572
|
+
parseSomaBlockContainer(yamlStr);
|
|
13531
13573
|
return "null";
|
|
13532
13574
|
}
|
|
13533
13575
|
function compileEventConfigFromRaw(raw) {
|
|
@@ -14199,6 +14241,36 @@ function isPublishedPageRecord(value) {
|
|
|
14199
14241
|
return typeof record.name === "string" && typeof record.version === "number" && !!record.declaration && typeof record.declaration === "object" && typeof record.declaration.html === "string" && typeof record.declaration.uiYaml === "string";
|
|
14200
14242
|
}
|
|
14201
14243
|
|
|
14244
|
+
// core/shared/published-page-route.ts
|
|
14245
|
+
var PUBLISHED_PAGE_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
14246
|
+
var RESERVED_PUBLISHED_PAGE_SLUGS = /* @__PURE__ */ new Set([
|
|
14247
|
+
"api",
|
|
14248
|
+
"soma",
|
|
14249
|
+
"pages",
|
|
14250
|
+
"workbench",
|
|
14251
|
+
"_next"
|
|
14252
|
+
]);
|
|
14253
|
+
function isPublishedPageSlug(value) {
|
|
14254
|
+
return typeof value === "string" && PUBLISHED_PAGE_SLUG_PATTERN.test(value) && !RESERVED_PUBLISHED_PAGE_SLUGS.has(value);
|
|
14255
|
+
}
|
|
14256
|
+
function normalizePublishedPageSlug(value) {
|
|
14257
|
+
if (typeof value !== "string") return null;
|
|
14258
|
+
const normalized = value.trim().toLowerCase().replace(/^\/+|\/+$/g, "").replace(/[\s_]+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 64).replace(/-$/g, "");
|
|
14259
|
+
return isPublishedPageSlug(normalized) ? normalized : null;
|
|
14260
|
+
}
|
|
14261
|
+
function publishedPagePath(slug) {
|
|
14262
|
+
if (!isPublishedPageSlug(slug)) {
|
|
14263
|
+
throw new Error(`Invalid published page slug: ${slug}`);
|
|
14264
|
+
}
|
|
14265
|
+
return `/${slug}`;
|
|
14266
|
+
}
|
|
14267
|
+
function publishedPageSlugFromPath(pagePath) {
|
|
14268
|
+
const legacy = pagePath.match(/^\/pages\/([^/]+)$/)?.[1];
|
|
14269
|
+
if (legacy && isPublishedPageSlug(legacy)) return legacy;
|
|
14270
|
+
const root = pagePath.match(/^\/([^/]+)$/)?.[1];
|
|
14271
|
+
return root && isPublishedPageSlug(root) ? root : null;
|
|
14272
|
+
}
|
|
14273
|
+
|
|
14202
14274
|
// core/client/component/pack-styles.ts
|
|
14203
14275
|
var injected2 = /* @__PURE__ */ new Set();
|
|
14204
14276
|
function resetPackStyleInjection() {
|
|
@@ -14297,6 +14369,25 @@ function checkOverrideCompat(winner, base) {
|
|
|
14297
14369
|
});
|
|
14298
14370
|
}
|
|
14299
14371
|
}
|
|
14372
|
+
const winnerSlots = winner.slots ?? {};
|
|
14373
|
+
for (const [name, baseSlot] of Object.entries(base.slots ?? {})) {
|
|
14374
|
+
const winnerSlot = winnerSlots[name];
|
|
14375
|
+
if (!winnerSlot) {
|
|
14376
|
+
issues.push({
|
|
14377
|
+
kind: "slot-missing",
|
|
14378
|
+
member: name,
|
|
14379
|
+
detail: `\u7F3A\u5C11\u63D2\u69FD "${name}"\u2014\u2014\u5B58\u91CF\u9875\u9762\u4ECD\u5728\u5F80\u8FD9\u4E2A\u69FD\u6295\u5F71\u5185\u5BB9\uFF0C\u8986\u76D6\u540E\u4E0D\u662F\u5C11\u4E00\u5757\u5185\u5BB9\uFF0C\u800C\u662F\u6302\u8F7D\u65F6\u76F4\u63A5\u629B SomaComponentExpandError\uFF08\u6574\u9875\u5D29\uFF09`
|
|
14380
|
+
});
|
|
14381
|
+
continue;
|
|
14382
|
+
}
|
|
14383
|
+
if (winnerSlot.required === true && baseSlot.required !== true) {
|
|
14384
|
+
issues.push({
|
|
14385
|
+
kind: "slot-required-tightened",
|
|
14386
|
+
member: name,
|
|
14387
|
+
detail: `\u63D2\u69FD "${name}" \u4ECE\u53EF\u9009\u6536\u7D27\u4E3A\u5FC5\u586B\u2014\u2014\u5B58\u91CF\u9875\u9762\u6CA1\u7ED9\u8FD9\u4E2A\u69FD\u7684\u5730\u65B9\u4F1A\u5728\u6302\u8F7D\u65F6\u629B\u9519`
|
|
14388
|
+
});
|
|
14389
|
+
}
|
|
14390
|
+
}
|
|
14300
14391
|
return issues;
|
|
14301
14392
|
}
|
|
14302
14393
|
function sameDefault(a, b) {
|
|
@@ -14992,7 +15083,7 @@ function describeNode(node) {
|
|
|
14992
15083
|
}
|
|
14993
15084
|
}
|
|
14994
15085
|
|
|
14995
|
-
// core/build/
|
|
15086
|
+
// core/build/blocks/html-index.ts
|
|
14996
15087
|
var ANCHOR_RE = /data-soma-id=["']([^"']+)["']/g;
|
|
14997
15088
|
var COMPONENT_NEAR_RE = /data-soma-component=["']([^"']+)["']/;
|
|
14998
15089
|
var HOST_RE = /data-soma-host=["']([^"']+)["']/;
|
|
@@ -15055,7 +15146,7 @@ function buildHtmlAnchorIndex(html) {
|
|
|
15055
15146
|
};
|
|
15056
15147
|
}
|
|
15057
15148
|
|
|
15058
|
-
// core/client/parser/
|
|
15149
|
+
// core/client/parser/blocks/namespace.ts
|
|
15059
15150
|
var SomaScopeError = class extends Error {
|
|
15060
15151
|
constructor(message, blockId) {
|
|
15061
15152
|
super(`[soma-core][\u5F15\u64CE] ${message}\uFF08\u5757: ${blockId}\uFF09`);
|
|
@@ -15170,7 +15261,7 @@ function expandPath(raw, scope) {
|
|
|
15170
15261
|
return resolved.kind === "literal" ? raw.trim() : resolved.full;
|
|
15171
15262
|
}
|
|
15172
15263
|
|
|
15173
|
-
// core/client/parser/
|
|
15264
|
+
// core/client/parser/blocks/page-parser.ts
|
|
15174
15265
|
var PAGE_KEYS = /* @__PURE__ */ new Set([
|
|
15175
15266
|
"domain",
|
|
15176
15267
|
"locale",
|
|
@@ -15180,19 +15271,19 @@ var PAGE_KEYS = /* @__PURE__ */ new Set([
|
|
|
15180
15271
|
"data",
|
|
15181
15272
|
"adaptive",
|
|
15182
15273
|
"alias",
|
|
15183
|
-
// initProps
|
|
15274
|
+
// initProps:引擎启动前写入的初始值(平铺 UiConfig 同名字段的直通)。
|
|
15184
15275
|
//
|
|
15185
|
-
//
|
|
15186
|
-
//
|
|
15276
|
+
// 块声明是照**手写页面**设计的——那里文案住 HTML、初值住 Domain,声明里不需要它。
|
|
15277
|
+
// 但块声明产的是平铺等价物,而生成链的页面把字面文案内联在 initProps 里
|
|
15187
15278
|
// (模型出的是组织意图,没有 Domain 可写)。少了这个键,AI 产的页面
|
|
15188
|
-
//
|
|
15279
|
+
// 就永远迈不过块声明的门槛——不是"用不上块声明",是"表达不了"。
|
|
15189
15280
|
"initProps"
|
|
15190
15281
|
]);
|
|
15191
15282
|
var SUFFIXES = ["when", "model", "class"];
|
|
15192
15283
|
function parsePageBlock(input) {
|
|
15193
15284
|
const { body } = input;
|
|
15194
15285
|
const fail = (message) => {
|
|
15195
|
-
throw new
|
|
15286
|
+
throw new SomaBlockParseError(message, "page");
|
|
15196
15287
|
};
|
|
15197
15288
|
for (const key of Object.keys(body)) {
|
|
15198
15289
|
if (!PAGE_KEYS.has(key)) {
|
|
@@ -15267,7 +15358,7 @@ function parsePageBlock(input) {
|
|
|
15267
15358
|
}
|
|
15268
15359
|
function parseShowLevel(raw, target, scope, input, where) {
|
|
15269
15360
|
const fail = (message) => {
|
|
15270
|
-
throw new
|
|
15361
|
+
throw new SomaBlockParseError(message, "page");
|
|
15271
15362
|
};
|
|
15272
15363
|
for (const [key, value] of Object.entries(raw)) {
|
|
15273
15364
|
if (key === "each") continue;
|
|
@@ -15316,7 +15407,7 @@ function isEachBlock(value) {
|
|
|
15316
15407
|
}
|
|
15317
15408
|
function parseEachBlock(block, scope, input, anchor) {
|
|
15318
15409
|
const fail = (message) => {
|
|
15319
|
-
throw new
|
|
15410
|
+
throw new SomaBlockParseError(message, "page");
|
|
15320
15411
|
};
|
|
15321
15412
|
const raw = String(block.each);
|
|
15322
15413
|
const match = /^(\S+)\s+as\s+([A-Za-z_][A-Za-z0-9_]*)(?:\s+by\s+(\S+))?(?:\s+key\s+(\S+))?$/.exec(raw.trim());
|
|
@@ -15419,7 +15510,7 @@ function normalizeEventSection(raw, input, fail) {
|
|
|
15419
15510
|
return result;
|
|
15420
15511
|
}
|
|
15421
15512
|
|
|
15422
|
-
// core/client/parser/
|
|
15513
|
+
// core/client/parser/blocks/use-parser.ts
|
|
15423
15514
|
var BLOCK_KEYS = /* @__PURE__ */ new Set(["component", "alias", "when", "data", "ui", "event"]);
|
|
15424
15515
|
var DATA_OBJECT_KEYS = /* @__PURE__ */ new Set(["from", "save", "refresh", "reload_on", "fields"]);
|
|
15425
15516
|
var EVENT_KEYS = /* @__PURE__ */ new Set(["actions", "on"]);
|
|
@@ -15434,22 +15525,11 @@ var ACTION_KEYS = /* @__PURE__ */ new Set([
|
|
|
15434
15525
|
"disabled_reason"
|
|
15435
15526
|
]);
|
|
15436
15527
|
var FIELD_KEYS = /* @__PURE__ */ new Set(["name", "type", "values", "permission", "rules"]);
|
|
15437
|
-
var FIELD_TYPES =
|
|
15438
|
-
"text",
|
|
15439
|
-
"int",
|
|
15440
|
-
"number",
|
|
15441
|
-
"money",
|
|
15442
|
-
"date",
|
|
15443
|
-
"enum",
|
|
15444
|
-
"bool",
|
|
15445
|
-
"percent",
|
|
15446
|
-
// progress 与 percent 同数据两种读法:前者出进度条,后者出文字(见 soma-ui 类型渲染表)
|
|
15447
|
-
"progress"
|
|
15448
|
-
]);
|
|
15528
|
+
var FIELD_TYPES = new Set(SOMA_DATA_FIELD_TYPES);
|
|
15449
15529
|
function parseUseBlock(input) {
|
|
15450
15530
|
const { blockId, body } = input;
|
|
15451
15531
|
const fail = (message) => {
|
|
15452
|
-
throw new
|
|
15532
|
+
throw new SomaBlockParseError(message, blockId);
|
|
15453
15533
|
};
|
|
15454
15534
|
for (const key of Object.keys(body)) {
|
|
15455
15535
|
if (!BLOCK_KEYS.has(key)) {
|
|
@@ -15573,10 +15653,11 @@ function parseField2(objectName, fieldName, raw, fail) {
|
|
|
15573
15653
|
fail(`\u5B57\u6BB5 ${objectName}.${fieldName} \u4E0D\u652F\u6301\u952E "${key}"\uFF08\u53EF\u7528\uFF1A${[...FIELD_KEYS].join("/")}\uFF09`);
|
|
15574
15654
|
}
|
|
15575
15655
|
}
|
|
15576
|
-
const
|
|
15577
|
-
|
|
15656
|
+
const declaredType = String(field.type ?? "");
|
|
15657
|
+
const type2 = SOMA_DATA_FIELD_TYPE_ALIASES[declaredType] ?? declaredType;
|
|
15658
|
+
if (!FIELD_TYPES.has(declaredType)) {
|
|
15578
15659
|
fail(
|
|
15579
|
-
`\u5B57\u6BB5 ${objectName}.${fieldName} \u7684 type "${
|
|
15660
|
+
`\u5B57\u6BB5 ${objectName}.${fieldName} \u7684 type "${declaredType}" \u975E\u6CD5\uFF08\u5C01\u95ED\u96C6\uFF1A${[...FIELD_TYPES].join("/")}\uFF09`
|
|
15580
15661
|
);
|
|
15581
15662
|
}
|
|
15582
15663
|
if (type2 === "enum") {
|
|
@@ -15696,11 +15777,11 @@ function expandUiPaths(value, scope) {
|
|
|
15696
15777
|
return walk(value);
|
|
15697
15778
|
}
|
|
15698
15779
|
|
|
15699
|
-
// core/build/
|
|
15700
|
-
function
|
|
15780
|
+
// core/build/blocks/block-compile.ts
|
|
15781
|
+
function compileSomaBlocks(input) {
|
|
15701
15782
|
const htmlIndex = buildHtmlAnchorIndex(input.html);
|
|
15702
15783
|
if (htmlIndex.duplicates.length > 0) {
|
|
15703
|
-
throw new
|
|
15784
|
+
throw new SomaBlockParseError(
|
|
15704
15785
|
`HTML \u951A\u70B9\u91CD\u590D\uFF1A${htmlIndex.duplicates.join("\u3001")}\u2014\u2014\u9875\u9762\u5185 data-soma-id \u5FC5\u987B\u552F\u4E00`
|
|
15705
15786
|
);
|
|
15706
15787
|
}
|
|
@@ -15711,7 +15792,7 @@ function compileSomaV2(input) {
|
|
|
15711
15792
|
});
|
|
15712
15793
|
const pageRaw = rawBlocks.find((block) => block.blockId === PAGE_BLOCK_ID);
|
|
15713
15794
|
if (!pageRaw) {
|
|
15714
|
-
throw new
|
|
15795
|
+
throw new SomaBlockParseError("\u7F3A\u5C11 page \u5757\uFF08\u9875\u9762\u5FC5\u987B\u58F0\u660E domain\uFF09");
|
|
15715
15796
|
}
|
|
15716
15797
|
const anchors = new Set(htmlIndex.anchors.keys());
|
|
15717
15798
|
const page = parsePageBlock({
|
|
@@ -15782,14 +15863,14 @@ function attachInstance(ui, blockId, ast, htmlIndex) {
|
|
|
15782
15863
|
}
|
|
15783
15864
|
const owner = info.ownerList;
|
|
15784
15865
|
if (!owner) {
|
|
15785
|
-
throw new
|
|
15866
|
+
throw new SomaBlockParseError(
|
|
15786
15867
|
`\u5B9E\u4F8B "${blockId}" \u4F4D\u4E8E\u884C\u6A21\u677F\u5185\uFF0C\u4F46 HTML \u91CC\u627E\u4E0D\u5230\u5B83\u6240\u5C5E\u7684\u5217\u8868\u951A\u70B9`,
|
|
15787
15868
|
blockId
|
|
15788
15869
|
);
|
|
15789
15870
|
}
|
|
15790
15871
|
const target = findListShow(ui.show, owner);
|
|
15791
15872
|
if (!target) {
|
|
15792
|
-
throw new
|
|
15873
|
+
throw new SomaBlockParseError(
|
|
15793
15874
|
`\u5B9E\u4F8B "${blockId}" \u5C5E\u4E8E\u5217\u8868 "${owner}"\uFF0C\u4F46 page \u5757\u6CA1\u6709\u4E3A\u8BE5\u5217\u8868\u58F0\u660E each \u4F5C\u7528\u57DF`,
|
|
15794
15875
|
blockId
|
|
15795
15876
|
);
|
|
@@ -15859,7 +15940,7 @@ function compilePageDeclaration(input) {
|
|
|
15859
15940
|
`[soma-core][SOMA DSL] \u9875\u9762\u4FA7\u8F66\u5DF2\u9000\u5F79\uFF1A${sidecars.join("\u3001")}\u3002\u4E8B\u4EF6\u3001\u6837\u5F0F\u72B6\u6001\u4E0E\u6570\u636E\u5BF9\u8C61\u5FC5\u987B\u5199\u8FDB\u540C\u4E00\u4EFD SOMA DSL \u58F0\u660E\u3002`
|
|
15860
15941
|
);
|
|
15861
15942
|
}
|
|
15862
|
-
const compiled =
|
|
15943
|
+
const compiled = compileSomaBlocks({
|
|
15863
15944
|
html: expandSomaHtmlIncludes(input.html, input.includes),
|
|
15864
15945
|
uiYamlRaw: input.uiYaml,
|
|
15865
15946
|
...input.externalBlocks ? { externalBlocks: input.externalBlocks } : {}
|
|
@@ -15907,17 +15988,22 @@ function compilePageAssets(assets) {
|
|
|
15907
15988
|
MiniProgramContainerAdapter,
|
|
15908
15989
|
PACK_NAME_PATTERN,
|
|
15909
15990
|
PAGE_BLOCK_ID,
|
|
15991
|
+
PUBLISHED_PAGE_SLUG_PATTERN,
|
|
15910
15992
|
Page,
|
|
15993
|
+
RESERVED_PUBLISHED_PAGE_SLUGS,
|
|
15911
15994
|
ReactNativeContainerAdapter,
|
|
15912
15995
|
SOMA_ADAPTIVE_MAX_LADDER,
|
|
15913
15996
|
SOMA_ADAPTIVE_PROFILES,
|
|
15914
15997
|
SOMA_ADAPTIVE_PROFILE_ATTR,
|
|
15998
|
+
SOMA_DATA_FIELD_TYPES,
|
|
15999
|
+
SOMA_DATA_FIELD_TYPE_ALIASES,
|
|
15915
16000
|
SOMA_DEFAULT_HYSTERESIS,
|
|
15916
16001
|
SOMA_PURIFY_PROFILE,
|
|
15917
16002
|
Show,
|
|
15918
16003
|
ShowList,
|
|
15919
16004
|
SomaAdaptiveConfigError,
|
|
15920
16005
|
SomaApi,
|
|
16006
|
+
SomaBlockParseError,
|
|
15921
16007
|
SomaBootstrap,
|
|
15922
16008
|
SomaComponentManager,
|
|
15923
16009
|
SomaComponentRegistry,
|
|
@@ -15938,7 +16024,6 @@ function compilePageAssets(assets) {
|
|
|
15938
16024
|
SomaRealtimeService,
|
|
15939
16025
|
SomaScopeError,
|
|
15940
16026
|
SomaTelemetry,
|
|
15941
|
-
SomaV2ParseError,
|
|
15942
16027
|
SomaValidator,
|
|
15943
16028
|
SomaValueLangError,
|
|
15944
16029
|
SseRealtimeTransport,
|
|
@@ -15955,7 +16040,7 @@ function compilePageAssets(assets) {
|
|
|
15955
16040
|
checkOverrideCompat,
|
|
15956
16041
|
compileAdaptive,
|
|
15957
16042
|
compilePageAssets,
|
|
15958
|
-
|
|
16043
|
+
compileSomaBlocks,
|
|
15959
16044
|
composeComponentPacks,
|
|
15960
16045
|
contrastRatio,
|
|
15961
16046
|
createAdaptiveObserverPool,
|
|
@@ -15989,6 +16074,7 @@ function compilePageAssets(assets) {
|
|
|
15989
16074
|
isBootTimingsEnabled,
|
|
15990
16075
|
isEventHandlerAttribute,
|
|
15991
16076
|
isPlainPath,
|
|
16077
|
+
isPublishedPageSlug,
|
|
15992
16078
|
isSomaMockEnabled,
|
|
15993
16079
|
loadSomaDomainModuleFromRegistry,
|
|
15994
16080
|
loadSomaFile,
|
|
@@ -15996,6 +16082,7 @@ function compilePageAssets(assets) {
|
|
|
15996
16082
|
matchGlobPath,
|
|
15997
16083
|
maybeStartBootTimings,
|
|
15998
16084
|
normalizeDataPipeValue,
|
|
16085
|
+
normalizePublishedPageSlug,
|
|
15999
16086
|
parseAdaptiveConfig,
|
|
16000
16087
|
parseDataConfig,
|
|
16001
16088
|
parseDataRef,
|
|
@@ -16003,6 +16090,8 @@ function compilePageAssets(assets) {
|
|
|
16003
16090
|
parsePageBlock,
|
|
16004
16091
|
parseUseBlock,
|
|
16005
16092
|
parseValueSegment,
|
|
16093
|
+
publishedPagePath,
|
|
16094
|
+
publishedPageSlugFromPath,
|
|
16006
16095
|
readBootTimings,
|
|
16007
16096
|
recordMetric,
|
|
16008
16097
|
renderPublishedPage,
|