@base-screen/vue 0.1.1 → 0.2.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/dist/components.d.ts +1 -1
- package/dist/components.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ScreenDiagnostic } from 'base-screen/contracts';
|
|
2
1
|
import { type BaseScreenDesignerElement, type BaseScreenDesignerMountOptions, type BaseScreenMountControllerReady, type BaseScreenMountDiagnosticContext, type BaseScreenMountDiagnosticsCallback, type BaseScreenRuntime, type BaseScreenViewerElement, type BaseScreenViewerMountOptions, type BaseScreenViewerRuntime, type ScreenProjectState } from 'base-screen';
|
|
2
|
+
import type { ScreenDiagnostic } from 'base-screen/contracts';
|
|
3
3
|
import { type SlotsType } from 'vue';
|
|
4
4
|
export interface BaseScreenDesignerProps {
|
|
5
5
|
/** `null` 表示尚未就绪:不挂载、不保留诊断,等它变为非空后再挂载。 */
|
package/dist/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EAEnC,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,kCAAkC,EAEvC,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAG5B,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAQL,KAAK,SAAS,EAGf,MAAM,KAAK,CAAC;AAEb,MAAM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ensureInteractiveStyleSheet","#mountApp"],"sources":["../src/global-styles.ts","../src/components.ts","../src/index.ts"],"sourcesContent":["// 桥接层全局样式传播:第三方 Vue 组件库(如 vue-echarts/VChart)通常把组件样式\n// 注入 document.adoptedStyleSheets 或全局 <style>,但 Base Screen 的 designer/viewer\n// 把物料挂载在 shadow root 内,全局样式无法穿透,组件会塌陷为 0×0 或丢失布局。\n// 本模块负责收集文档样式源中的全部可读规则文本,供桥接层注入宿主 shadow root,\n// 使组件库样式与宿主应用样式(含 scoped 样式)在 shadow DOM 环境下同样生效。\n\nexport interface ReadableStyleRule {\n readonly selectorText?: string;\n readonly cssText?: string;\n readonly cssRules?: readonly ReadableStyleRule[];\n}\n\nexport interface ReadableStyleSheet {\n readonly cssRules?: readonly ReadableStyleRule[];\n}\n\nexport function collectGlobalRules(\n styleSheets: ReadonlyArray<ReadableStyleSheet>,\n): readonly string[] {\n const collected = new Set<string>();\n const visited = new Set<ReadableStyleSheet>();\n const visitSheet = (sheet: ReadableStyleSheet): void => {\n if (visited.has(sheet)) return;\n visited.add(sheet);\n for (const rule of sheet.cssRules ?? []) visitRule(rule);\n };\n const visitRule = (rule: ReadableStyleRule): void => {\n if (rule.cssText !== undefined) {\n collected.add(rule.cssText);\n }\n for (const nested of rule.cssRules ?? []) visitRule(nested);\n };\n for (const sheet of styleSheets) visitSheet(sheet);\n return [...collected];\n}\n","import type { ScreenDiagnostic } from 'base-screen/contracts';\nimport {\n type BaseScreenDesignerElement,\n type BaseScreenDesignerMountOptions,\n type BaseScreenMountController,\n type BaseScreenMountControllerReady,\n type BaseScreenMountDiagnosticContext,\n type BaseScreenMountDiagnosticsCallback,\n type BaseScreenMountElement,\n type BaseScreenRuntime,\n type BaseScreenViewerElement,\n type BaseScreenViewerMountOptions,\n type BaseScreenViewerRuntime,\n createBaseScreenDesignerMountController,\n createBaseScreenViewerMountController,\n type ScreenProjectState,\n} from 'base-screen';\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted as onVueMounted,\n type PropType,\n type Ref,\n ref,\n type SlotsType,\n type VNode,\n watch,\n} from 'vue';\n\nexport interface BaseScreenDesignerProps {\n /** `null` 表示尚未就绪:不挂载、不保留诊断,等它变为非空后再挂载。 */\n readonly runtime: BaseScreenRuntime | null;\n /** 初始化快照;`null` 表示尚未就绪。文档/项目身份变化重挂载,catalog 新引用热刷新。 */\n readonly mountOptions: BaseScreenDesignerMountOptions | null;\n /** 强制重挂载;catalog 新引用热刷新,其余非身份配置只保存为后续挂载的初始化快照。 */\n readonly remountKey?: string | number;\n readonly onMounted?: BaseScreenMountControllerReady<BaseScreenDesignerElement>;\n readonly onProjectState?: (state: ScreenProjectState) => void;\n readonly onDiagnostics?: BaseScreenMountDiagnosticsCallback;\n}\n\nexport interface BaseScreenViewerProps {\n /** `null` 表示尚未就绪:不挂载、不保留诊断,等它变为非空后再挂载。 */\n readonly runtime: BaseScreenViewerRuntime | null;\n /** 初始化快照;`null` 表示尚未就绪。文档/项目身份变化重挂载,catalog 新引用热刷新。 */\n readonly mountOptions: BaseScreenViewerMountOptions | null;\n readonly remountKey?: string | number;\n readonly onMounted?: BaseScreenMountControllerReady<BaseScreenViewerElement>;\n readonly onDiagnostics?: BaseScreenMountDiagnosticsCallback;\n}\n\ninterface CreateControllerInput<\n TElement extends BaseScreenMountElement,\n TOptions,\n TRuntime extends BaseScreenViewerRuntime,\n> {\n readonly runtime: TRuntime;\n readonly options: TOptions;\n readonly onMounted: BaseScreenMountControllerReady<TElement>;\n readonly onDiagnostics: BaseScreenMountDiagnosticsCallback;\n readonly onProjectState: ((state: ScreenProjectState) => void) | undefined;\n}\n\ninterface UseBaseScreenMountOptions<\n TElement extends BaseScreenMountElement,\n TOptions,\n TRuntime extends BaseScreenViewerRuntime,\n> {\n readonly runtime: () => TRuntime | null;\n readonly mountOptions: () => TOptions | null;\n readonly remountKey: () => string | number | undefined;\n readonly identity: readonly (() => unknown)[];\n readonly onMounted: () => BaseScreenMountControllerReady<TElement> | undefined;\n readonly onDiagnostics: () => BaseScreenMountDiagnosticsCallback | undefined;\n readonly onProjectState?: () => ((state: ScreenProjectState) => void) | undefined;\n readonly createController: (\n input: CreateControllerInput<TElement, TOptions, TRuntime>,\n ) => BaseScreenMountController<TElement, TOptions>;\n}\n\n/** 未就绪不是错误:诊断清空,回调不会被调用。 */\nconst EMPTY_DIAGNOSTICS: readonly ScreenDiagnostic[] = Object.freeze([]);\n\ninterface BaseScreenMountState {\n readonly containerRef: Ref<HTMLElement | null>;\n readonly diagnostics: Ref<readonly ScreenDiagnostic[]>;\n readonly diagnosticContext: Ref<BaseScreenMountDiagnosticContext | undefined>;\n}\n\nfunction useBaseScreenMount<\n TElement extends BaseScreenMountElement,\n TOptions extends { readonly catalog?: unknown },\n TRuntime extends BaseScreenViewerRuntime,\n>(options: UseBaseScreenMountOptions<TElement, TOptions, TRuntime>): BaseScreenMountState {\n const containerRef = ref<HTMLElement | null>(null);\n const diagnostics = ref<readonly ScreenDiagnostic[]>([]);\n const diagnosticContext = ref<BaseScreenMountDiagnosticContext | undefined>();\n let controller: BaseScreenMountController<TElement, TOptions> | undefined;\n let generation = 0;\n let disposed = false;\n let detaching: Promise<unknown> = Promise.resolve();\n\n const publishDiagnostics: BaseScreenMountDiagnosticsCallback = (next, context) => {\n if (disposed) return;\n diagnostics.value = next;\n diagnosticContext.value = context;\n options.onDiagnostics()?.(next, context);\n };\n const detachCurrent = (): void => {\n const active = controller;\n controller = undefined;\n if (active !== undefined) detaching = Promise.all([detaching, active.detach()]);\n };\n const attach = async (token: number): Promise<void> => {\n await detaching;\n if (token !== generation || disposed) return;\n const container = containerRef.value;\n const runtime = options.runtime();\n const mountOptions = options.mountOptions();\n if (container === null) return;\n // 还没就绪(宿主仍在准备 runtime / 端口):不建控制器,上一轮诊断也作废。\n if (runtime === null || mountOptions === null) {\n diagnostics.value = EMPTY_DIAGNOSTICS;\n diagnosticContext.value = undefined;\n return;\n }\n const current = options.createController({\n runtime,\n options: mountOptions,\n onMounted: (handle) => {\n if (token === generation && !disposed) return options.onMounted()?.(handle);\n },\n onProjectState:\n options.onProjectState?.() === undefined\n ? undefined\n : (state) => {\n if (token === generation && !disposed) options.onProjectState?.()?.(state);\n },\n onDiagnostics: (next, context) => {\n if (token === generation) publishDiagnostics(next, context);\n },\n });\n controller = current;\n await current.attach(container);\n if (token !== generation && controller === current) {\n controller = undefined;\n await current.detach();\n }\n };\n const scheduleAttach = (): void => {\n const token = ++generation;\n queueMicrotask(() => void attach(token));\n };\n\n onVueMounted(scheduleAttach);\n watch(\n [\n options.runtime,\n options.remountKey,\n () => options.mountOptions() !== null,\n ...options.identity,\n ],\n () => {\n generation += 1;\n detachCurrent();\n diagnostics.value = EMPTY_DIAGNOSTICS;\n diagnosticContext.value = undefined;\n scheduleAttach();\n },\n { flush: 'post' },\n );\n watch(\n [options.mountOptions, () => options.mountOptions()?.catalog],\n () => {\n const mountOptions = options.mountOptions();\n if (mountOptions === null) return;\n controller?.updateOptions(mountOptions);\n },\n { flush: 'post' },\n );\n onBeforeUnmount(() => {\n disposed = true;\n generation += 1;\n detachCurrent();\n });\n\n return {\n containerRef,\n diagnostics,\n diagnosticContext,\n };\n}\n\nfunction renderDiagnostics(\n diagnostics: readonly ScreenDiagnostic[],\n fallback: () => VNode[] | undefined,\n): VNode[] {\n if (diagnostics.length === 0) return [];\n const rendered = fallback();\n if (rendered !== undefined) return rendered;\n return [h('div', { role: 'alert' }, diagnostics.map((item) => item.message).join('; '))];\n}\n\nconst remountKeyProp = {\n type: [String, Number] as unknown as PropType<string | number>,\n default: undefined,\n};\n\n// setup-function 重载的公共声明在 Vue 3.5 的最低 peer 版本中同样有效,\n// 避免暴露随 Vue patch 增加泛型参数的 options-object 推断结果。\nconst BaseScreenDesignerComponent = /*#__PURE__*/ defineComponent<\n BaseScreenDesignerProps,\n {},\n string,\n SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>\n>(\n (props, { slots }) => {\n const mounted = useBaseScreenMount({\n runtime: () => props.runtime,\n mountOptions: () => props.mountOptions,\n remountKey: () => props.remountKey,\n onMounted: () => props.onMounted,\n onDiagnostics: () => props.onDiagnostics,\n identity: [\n () => props.mountOptions?.projectId,\n () => props.mountOptions?.document,\n () => props.mountOptions?.element,\n ],\n onProjectState: () => props.onProjectState,\n createController: (input) =>\n createBaseScreenDesignerMountController({\n runtime: input.runtime,\n options: input.options,\n onMounted: input.onMounted,\n ...(input.onProjectState === undefined ? {} : { onProjectState: input.onProjectState }),\n onDiagnostics: input.onDiagnostics,\n }),\n });\n return () => {\n return h(\n 'div',\n { ref: mounted.containerRef },\n renderDiagnostics(mounted.diagnostics.value, () =>\n slots.fallback?.({\n diagnostics: mounted.diagnostics.value,\n context: mounted.diagnosticContext.value,\n }),\n ),\n );\n };\n },\n {\n name: 'BaseScreenDesigner',\n slots: Object as SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>,\n props: {\n // `null` 列入 type 数组:required 的 prop 也会跑类型断言,只有显式列出才接受「未就绪」。\n runtime: {\n type: [Object, null] as unknown as PropType<BaseScreenRuntime | null>,\n required: true,\n },\n mountOptions: {\n type: [Object, null] as unknown as PropType<BaseScreenDesignerMountOptions | null>,\n required: true,\n },\n remountKey: remountKeyProp,\n onMounted: {\n type: Function as PropType<BaseScreenMountControllerReady<BaseScreenDesignerElement>>,\n default: undefined,\n },\n onProjectState: {\n type: Function as PropType<(state: ScreenProjectState) => void>,\n default: undefined,\n },\n onDiagnostics: {\n type: Function as PropType<BaseScreenMountDiagnosticsCallback>,\n default: undefined,\n },\n },\n },\n);\n\nexport const BaseScreenDesigner = BaseScreenDesignerComponent;\n\nconst BaseScreenViewerComponent = /*#__PURE__*/ defineComponent<\n BaseScreenViewerProps,\n {},\n string,\n SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>\n>(\n (props, { slots }) => {\n const mounted = useBaseScreenMount({\n runtime: () => props.runtime,\n mountOptions: () => props.mountOptions,\n remountKey: () => props.remountKey,\n onMounted: () => props.onMounted,\n onDiagnostics: () => props.onDiagnostics,\n identity: [\n () => props.mountOptions?.projectId,\n () => props.mountOptions?.document,\n () => props.mountOptions?.documentRevision,\n () => props.mountOptions?.element,\n ],\n createController: (input) =>\n createBaseScreenViewerMountController({\n runtime: input.runtime,\n options: input.options,\n onMounted: input.onMounted,\n ...(input.onProjectState === undefined ? {} : { onProjectState: input.onProjectState }),\n onDiagnostics: input.onDiagnostics,\n }),\n });\n return () => {\n return h(\n 'div',\n { ref: mounted.containerRef },\n renderDiagnostics(mounted.diagnostics.value, () =>\n slots.fallback?.({\n diagnostics: mounted.diagnostics.value,\n context: mounted.diagnosticContext.value,\n }),\n ),\n );\n };\n },\n {\n name: 'BaseScreenViewer',\n slots: Object as SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>,\n props: {\n // `null` 列入 type 数组:required 的 prop 也会跑类型断言,只有显式列出才接受「未就绪」。\n runtime: {\n type: [Object, null] as unknown as PropType<BaseScreenViewerRuntime | null>,\n required: true,\n },\n mountOptions: {\n type: [Object, null] as unknown as PropType<BaseScreenViewerMountOptions | null>,\n required: true,\n },\n remountKey: remountKeyProp,\n onMounted: {\n type: Function as PropType<BaseScreenMountControllerReady<BaseScreenViewerElement>>,\n default: undefined,\n },\n onDiagnostics: {\n type: Function as PropType<BaseScreenMountDiagnosticsCallback>,\n default: undefined,\n },\n },\n },\n);\n\nexport const BaseScreenViewer = BaseScreenViewerComponent;\n","import {\n parseScreenJsonValue,\n type ScreenJsonValue,\n type ScreenParseResult,\n} from 'base-screen/contracts';\nimport type {\n BaseScreenMaterialCatalogEntry,\n BaseScreenMaterialConstructor,\n BaseScreenMaterialManifest,\n BaseScreenMaterialModel,\n} from 'base-screen/plugin-core';\nimport { createMaterialDefinition } from 'base-screen/plugin-sdk';\nimport { type App, type Component, createApp, h, type ShallowRef, shallowRef } from 'vue';\nimport {\n collectGlobalRules,\n type ReadableStyleRule,\n type ReadableStyleSheet,\n} from './global-styles.js';\n\nexport * from './components.js';\n\nexport interface CreateVueMaterialDefinitionOptions<Props extends object> {\n readonly manifest: BaseScreenMaterialManifest;\n readonly component: Component;\n readonly mapModel?: (model: BaseScreenMaterialModel) => Props;\n readonly eventProps?: Readonly<Record<string, string>>;\n /** 每次创建 app 后、mount 前调用,用于安装宿主插件与 provide。 */\n readonly configureApp?: (app: App) => void;\n}\n\n// 原生 CSS 交互门控(ADR-0036):与 React 桥接一致,非交互模式下桥接渲染的原生控件\n// (button 等)不接收指针事件,hover/active/focus 原生样式静默;指针事件落到物料元素自身,\n// 设计器的选择/拖拽命中测试不受影响。规则按属性作用域匹配、按 shadow root(或 document)幂等注入。\nconst BRIDGE_INTERACTIVE_STYLE_KEY = 'base-screen-bridge-interactive-styles';\nconst BRIDGE_INTERACTIVE_STYLE_TEXT =\n '[data-base-screen-interactive=\"false\"] * { pointer-events: none; }';\n\nexport function createVueMaterialDefinition<Props extends object>(\n options: CreateVueMaterialDefinitionOptions<Props>,\n): ScreenParseResult<BaseScreenMaterialCatalogEntry> {\n const ElementBase =\n (globalThis as { readonly HTMLElement?: typeof HTMLElement }).HTMLElement ??\n (class {} as unknown as typeof HTMLElement);\n const eventProps = options.eventProps ?? {};\n\n class VueMaterialElement extends ElementBase {\n static readonly manifest = options.manifest;\n\n #model: BaseScreenMaterialModel | undefined;\n #modelRef: ShallowRef<BaseScreenMaterialModel | undefined> | undefined;\n #app: App | undefined;\n #disconnectScheduled = false;\n\n get model(): BaseScreenMaterialModel {\n if (this.#model === undefined) {\n throw new Error('Material model has not been set.');\n }\n return this.#model;\n }\n\n set model(value: BaseScreenMaterialModel) {\n this.#model = value;\n this.dataset.baseScreenInteractive = String(value.interactive);\n if (this.#modelRef !== undefined) {\n this.#modelRef.value = value;\n }\n }\n\n connectedCallback(): void {\n this.#disconnectScheduled = false;\n if (this.#app === undefined) {\n // 组件库(如 vue-echarts)和宿主项目样式依赖注入到 document 的全局样式,\n // 但物料被挂载在宿主页的 shadow root 内,全局样式无法穿透。桥接层在挂载\n // 组件之前把文档中的全部可读全局规则传播进宿主 shadow root,使组件库\n // 首次初始化就能拿到正确尺寸,嵌套组件树(含 scoped 样式)也能正常布局。\n this.#propagateGlobalStyles();\n this.#ensureInteractiveStyleSheet();\n this.#mountApp();\n }\n }\n\n #ensureInteractiveStyleSheet(): void {\n const root = this.getRootNode();\n if (root instanceof ShadowRoot) {\n if (\n root.querySelector(`style[data-bridge-style-key=\"${BRIDGE_INTERACTIVE_STYLE_KEY}\"]`) !==\n null\n ) {\n return;\n }\n const style = this.ownerDocument.createElement('style');\n style.dataset.bridgeStyleKey = BRIDGE_INTERACTIVE_STYLE_KEY;\n style.textContent = BRIDGE_INTERACTIVE_STYLE_TEXT;\n root.appendChild(style);\n return;\n }\n if (root instanceof Document && root.getElementById(BRIDGE_INTERACTIVE_STYLE_KEY) === null) {\n const style = this.ownerDocument.createElement('style');\n style.id = BRIDGE_INTERACTIVE_STYLE_KEY;\n style.textContent = BRIDGE_INTERACTIVE_STYLE_TEXT;\n root.head.appendChild(style);\n }\n }\n\n #mountApp(): void {\n const modelRef = shallowRef(this.#model);\n const app = createApp({\n render: () => {\n const model = modelRef.value;\n if (model === undefined) {\n return null;\n }\n const props = {\n ...(options.mapModel === undefined ? (model.props as Props) : options.mapModel(model)),\n ...this.createEventProps(),\n } as Props;\n return h(options.component, props);\n },\n });\n let mountStarted = false;\n try {\n options.configureApp?.(app);\n mountStarted = true;\n app.mount(this);\n this.#modelRef = modelRef;\n this.#app = app;\n } catch (error) {\n if (mountStarted) app.unmount();\n throw error;\n }\n }\n\n disconnectedCallback(): void {\n if (this.#disconnectScheduled) {\n return;\n }\n this.#disconnectScheduled = true;\n queueMicrotask(() => {\n this.#disconnectScheduled = false;\n if (!this.isConnected && this.#app !== undefined) {\n this.#app.unmount();\n this.#app = undefined;\n this.#modelRef = undefined;\n }\n });\n }\n\n #propagateGlobalStyles(): void {\n const root = this.getRootNode();\n if (!(root instanceof ShadowRoot)) {\n return;\n }\n // 宿主 shadow root 只注入一次(同一 designer/viewer 内的多个物料共享同一 shadow root)。\n const key = 'base-screen-global-styles';\n if (root.querySelector(`style[data-bridge-style-key=\"${key}\"]`) !== null) {\n return;\n }\n const rules = collectGlobalRules(readDocumentStyleSheets(this.ownerDocument));\n if (rules.length === 0) {\n return;\n }\n const style = this.ownerDocument.createElement('style');\n style.dataset.bridgeStyleKey = key;\n style.textContent = rules.join('\\n');\n root.appendChild(style);\n }\n\n private createEventProps(): Record<string, (payload: unknown) => void> {\n const bindings: Record<string, (payload: unknown) => void> = {};\n for (const [eventName, propName] of Object.entries(eventProps)) {\n bindings[propName] = (payload: unknown) => this.dispatchMaterialEvent(eventName, payload);\n }\n return bindings;\n }\n\n private dispatchMaterialEvent(name: string, payload: unknown): void {\n if (this.#model?.interactive !== true || !options.manifest.events.includes(name)) {\n return;\n }\n const parsed = parseEventPayload(payload);\n if (parsed === undefined) {\n return;\n }\n this.dispatchEvent(\n new CustomEvent('base-screen-material-event', {\n bubbles: true,\n composed: true,\n detail: { name, payload: parsed },\n }),\n );\n }\n }\n\n const definition = createMaterialDefinition({\n manifest: options.manifest,\n element: VueMaterialElement as BaseScreenMaterialConstructor,\n });\n return definition.ok\n ? {\n ok: true,\n value: { manifest: definition.value.manifest, constructor: definition.value.element },\n diagnostics: [],\n }\n : definition;\n}\n\nfunction readDocumentStyleSheets(document: Document): readonly ReadableStyleSheet[] {\n const sheets: ReadableStyleSheet[] = [];\n for (const sheet of document.styleSheets) {\n try {\n sheets.push({ cssRules: [...sheet.cssRules] as ReadableStyleRule[] });\n } catch {\n // 跨域样式表不可读,跳过。\n }\n }\n const adopted = document.adoptedStyleSheets;\n if (adopted !== undefined) {\n for (const sheet of adopted) {\n try {\n sheets.push({ cssRules: [...sheet.cssRules] as ReadableStyleRule[] });\n } catch {\n // 跨域样式表不可读,跳过。\n }\n }\n }\n return sheets;\n}\n\nfunction parseEventPayload(value: unknown): ScreenJsonValue | undefined {\n const parsed = parseScreenJsonValue(value, { maxBytes: 64 * 1024 });\n return parsed.ok ? parsed.value : undefined;\n}\n"],"mappings":";;;;;AAgBA,SAAgB,EACd,GACmB;CACnB,IAAM,oBAAY,IAAI,IAAY,GAC5B,oBAAU,IAAI,IAAwB,GACtC,KAAc,MAAoC;EAClD,OAAQ,IAAI,CAAK,GACrB;KAAQ,IAAI,CAAK;GACjB,KAAK,IAAM,KAAQ,EAAM,YAAY,CAAC,GAAG,EAAU,CAAI;EADtC;CAEnB,GACM,KAAa,MAAkC;EACnD,AAAI,EAAK,YAAY,KAAA,KACnB,EAAU,IAAI,EAAK,OAAO;EAE5B,KAAK,IAAM,KAAU,EAAK,YAAY,CAAC,GAAG,EAAU,CAAM;CAC5D;CACA,KAAK,IAAM,KAAS,GAAa,EAAW,CAAK;CACjD,OAAO,CAAC,GAAG,CAAS;AACtB;;;ACgDA,IAAM,IAAiD,OAAO,OAAO,CAAC,CAAC;AAQvE,SAAS,EAIP,GAAwF;CACxF,IAAM,IAAe,EAAwB,IAAI,GAC3C,IAAc,EAAiC,CAAC,CAAC,GACjD,IAAoB,EAAkD,GACxE,GACA,IAAa,GACb,IAAW,IACX,IAA8B,QAAQ,QAAQ,GAE5C,KAA0D,GAAM,MAAY;EAC5E,MACJ,EAAY,QAAQ,GACpB,EAAkB,QAAQ,GAC1B,EAAQ,cAAc,CAAC,GAAG,GAAM,CAAO;CACzC,GACM,UAA4B;EAChC,IAAM,IAAS;EAEf,AADA,IAAa,KAAA,GACT,MAAW,KAAA,MAAW,IAAY,QAAQ,IAAI,CAAC,GAAW,EAAO,OAAO,CAAC,CAAC;CAChF,GACM,IAAS,OAAO,MAAiC;EAErD,IADA,MAAM,GACF,MAAU,KAAc,GAAU;EACtC,IAAM,IAAY,EAAa,OACzB,IA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OAAO;GAAE,UAAU,EAAW,MAAM;GAAU,aAAa,EAAW,MAAM;EAAQ;EACpF,aAAa,CAAC;CAChB,IACA;AACN;AAEA,SAAS,EAAwB,GAAmD;CAClF,IAAM,IAA+B,CAAC;CACtC,KAAK,IAAM,KAAS,EAAS,aAC3B,IAAI;EACF,EAAO,KAAK,EAAE,UAAU,CAAC,GAAG,EAAM,QAAQ,EAAyB,CAAC;CACtE,QAAQ,CAER;CAEF,IAAM,IAAU,EAAS;CACzB,IAAI,MAAY,KAAA,GACd,KAAK,IAAM,KAAS,GAClB,IAAI;EACF,EAAO,KAAK,EAAE,UAAU,CAAC,GAAG,EAAM,QAAQ,EAAyB,CAAC;CACtE,QAAQ,CAER;CAGJ,OAAO;AACT;AAEA,SAAS,EAAkB,GAA6C;CACtE,IAAM,IAAS,EAAqB,GAAO,EAAE,UAAU,MAAU,CAAC;CAClE,OAAO,EAAO,KAAK,EAAO,QAAQ,KAAA;AACpC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["#model","#modelRef","#disconnectScheduled","#app","#propagateGlobalStyles","#ensureInteractiveStyleSheet","#mountApp"],"sources":["../src/global-styles.ts","../src/components.ts","../src/index.ts"],"sourcesContent":["// 桥接层全局样式传播:第三方 Vue 组件库(如 vue-echarts/VChart)通常把组件样式\n// 注入 document.adoptedStyleSheets 或全局 <style>,但 Base Screen 的 designer/viewer\n// 把物料挂载在 shadow root 内,全局样式无法穿透,组件会塌陷为 0×0 或丢失布局。\n// 本模块负责收集文档样式源中的全部可读规则文本,供桥接层注入宿主 shadow root,\n// 使组件库样式与宿主应用样式(含 scoped 样式)在 shadow DOM 环境下同样生效。\n\nexport interface ReadableStyleRule {\n readonly selectorText?: string;\n readonly cssText?: string;\n readonly cssRules?: readonly ReadableStyleRule[];\n}\n\nexport interface ReadableStyleSheet {\n readonly cssRules?: readonly ReadableStyleRule[];\n}\n\nexport function collectGlobalRules(\n styleSheets: ReadonlyArray<ReadableStyleSheet>,\n): readonly string[] {\n const collected = new Set<string>();\n const visited = new Set<ReadableStyleSheet>();\n const visitSheet = (sheet: ReadableStyleSheet): void => {\n if (visited.has(sheet)) return;\n visited.add(sheet);\n for (const rule of sheet.cssRules ?? []) visitRule(rule);\n };\n const visitRule = (rule: ReadableStyleRule): void => {\n if (rule.cssText !== undefined) {\n collected.add(rule.cssText);\n }\n for (const nested of rule.cssRules ?? []) visitRule(nested);\n };\n for (const sheet of styleSheets) visitSheet(sheet);\n return [...collected];\n}\n","import {\n type BaseScreenDesignerElement,\n type BaseScreenDesignerMountOptions,\n type BaseScreenMountController,\n type BaseScreenMountControllerReady,\n type BaseScreenMountDiagnosticContext,\n type BaseScreenMountDiagnosticsCallback,\n type BaseScreenMountElement,\n type BaseScreenRuntime,\n type BaseScreenViewerElement,\n type BaseScreenViewerMountOptions,\n type BaseScreenViewerRuntime,\n createBaseScreenDesignerMountController,\n createBaseScreenViewerMountController,\n type ScreenProjectState,\n} from 'base-screen';\nimport type { ScreenDiagnostic } from 'base-screen/contracts';\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted as onVueMounted,\n type PropType,\n type Ref,\n ref,\n type SlotsType,\n type VNode,\n watch,\n} from 'vue';\n\nexport interface BaseScreenDesignerProps {\n /** `null` 表示尚未就绪:不挂载、不保留诊断,等它变为非空后再挂载。 */\n readonly runtime: BaseScreenRuntime | null;\n /** 初始化快照;`null` 表示尚未就绪。文档/项目身份变化重挂载,catalog 新引用热刷新。 */\n readonly mountOptions: BaseScreenDesignerMountOptions | null;\n /** 强制重挂载;catalog 新引用热刷新,其余非身份配置只保存为后续挂载的初始化快照。 */\n readonly remountKey?: string | number;\n readonly onMounted?: BaseScreenMountControllerReady<BaseScreenDesignerElement>;\n readonly onProjectState?: (state: ScreenProjectState) => void;\n readonly onDiagnostics?: BaseScreenMountDiagnosticsCallback;\n}\n\nexport interface BaseScreenViewerProps {\n /** `null` 表示尚未就绪:不挂载、不保留诊断,等它变为非空后再挂载。 */\n readonly runtime: BaseScreenViewerRuntime | null;\n /** 初始化快照;`null` 表示尚未就绪。文档/项目身份变化重挂载,catalog 新引用热刷新。 */\n readonly mountOptions: BaseScreenViewerMountOptions | null;\n readonly remountKey?: string | number;\n readonly onMounted?: BaseScreenMountControllerReady<BaseScreenViewerElement>;\n readonly onDiagnostics?: BaseScreenMountDiagnosticsCallback;\n}\n\ninterface CreateControllerInput<\n TElement extends BaseScreenMountElement,\n TOptions,\n TRuntime extends BaseScreenViewerRuntime,\n> {\n readonly runtime: TRuntime;\n readonly options: TOptions;\n readonly onMounted: BaseScreenMountControllerReady<TElement>;\n readonly onDiagnostics: BaseScreenMountDiagnosticsCallback;\n readonly onProjectState: ((state: ScreenProjectState) => void) | undefined;\n}\n\ninterface UseBaseScreenMountOptions<\n TElement extends BaseScreenMountElement,\n TOptions,\n TRuntime extends BaseScreenViewerRuntime,\n> {\n readonly runtime: () => TRuntime | null;\n readonly mountOptions: () => TOptions | null;\n readonly remountKey: () => string | number | undefined;\n readonly identity: readonly (() => unknown)[];\n readonly onMounted: () => BaseScreenMountControllerReady<TElement> | undefined;\n readonly onDiagnostics: () => BaseScreenMountDiagnosticsCallback | undefined;\n readonly onProjectState?: () => ((state: ScreenProjectState) => void) | undefined;\n readonly createController: (\n input: CreateControllerInput<TElement, TOptions, TRuntime>,\n ) => BaseScreenMountController<TElement, TOptions>;\n}\n\n/** 未就绪不是错误:诊断清空,回调不会被调用。 */\nconst EMPTY_DIAGNOSTICS: readonly ScreenDiagnostic[] = Object.freeze([]);\n\ninterface BaseScreenMountState {\n readonly containerRef: Ref<HTMLElement | null>;\n readonly diagnostics: Ref<readonly ScreenDiagnostic[]>;\n readonly diagnosticContext: Ref<BaseScreenMountDiagnosticContext | undefined>;\n}\n\nfunction useBaseScreenMount<\n TElement extends BaseScreenMountElement,\n TOptions extends { readonly catalog?: unknown },\n TRuntime extends BaseScreenViewerRuntime,\n>(options: UseBaseScreenMountOptions<TElement, TOptions, TRuntime>): BaseScreenMountState {\n const containerRef = ref<HTMLElement | null>(null);\n const diagnostics = ref<readonly ScreenDiagnostic[]>([]);\n const diagnosticContext = ref<BaseScreenMountDiagnosticContext | undefined>();\n let controller: BaseScreenMountController<TElement, TOptions> | undefined;\n let generation = 0;\n let disposed = false;\n let detaching: Promise<unknown> = Promise.resolve();\n\n const publishDiagnostics: BaseScreenMountDiagnosticsCallback = (next, context) => {\n if (disposed) return;\n diagnostics.value = next;\n diagnosticContext.value = context;\n options.onDiagnostics()?.(next, context);\n };\n const detachCurrent = (): void => {\n const active = controller;\n controller = undefined;\n if (active !== undefined) detaching = Promise.all([detaching, active.detach()]);\n };\n const attach = async (token: number): Promise<void> => {\n await detaching;\n if (token !== generation || disposed) return;\n const container = containerRef.value;\n const runtime = options.runtime();\n const mountOptions = options.mountOptions();\n if (container === null) return;\n // 还没就绪(宿主仍在准备 runtime / 端口):不建控制器,上一轮诊断也作废。\n if (runtime === null || mountOptions === null) {\n diagnostics.value = EMPTY_DIAGNOSTICS;\n diagnosticContext.value = undefined;\n return;\n }\n const current = options.createController({\n runtime,\n options: mountOptions,\n onMounted: (handle) => {\n if (token === generation && !disposed) return options.onMounted()?.(handle);\n },\n onProjectState:\n options.onProjectState?.() === undefined\n ? undefined\n : (state) => {\n if (token === generation && !disposed) options.onProjectState?.()?.(state);\n },\n onDiagnostics: (next, context) => {\n if (token === generation) publishDiagnostics(next, context);\n },\n });\n controller = current;\n await current.attach(container);\n if (token !== generation && controller === current) {\n controller = undefined;\n await current.detach();\n }\n };\n const scheduleAttach = (): void => {\n const token = ++generation;\n queueMicrotask(() => void attach(token));\n };\n\n onVueMounted(scheduleAttach);\n watch(\n [\n options.runtime,\n options.remountKey,\n () => options.mountOptions() !== null,\n ...options.identity,\n ],\n () => {\n generation += 1;\n detachCurrent();\n diagnostics.value = EMPTY_DIAGNOSTICS;\n diagnosticContext.value = undefined;\n scheduleAttach();\n },\n { flush: 'post' },\n );\n watch(\n [options.mountOptions, () => options.mountOptions()?.catalog],\n () => {\n const mountOptions = options.mountOptions();\n if (mountOptions === null) return;\n controller?.updateOptions(mountOptions);\n },\n { flush: 'post' },\n );\n onBeforeUnmount(() => {\n disposed = true;\n generation += 1;\n detachCurrent();\n });\n\n return {\n containerRef,\n diagnostics,\n diagnosticContext,\n };\n}\n\nfunction renderDiagnostics(\n diagnostics: readonly ScreenDiagnostic[],\n fallback: () => VNode[] | undefined,\n): VNode[] {\n if (diagnostics.length === 0) return [];\n const rendered = fallback();\n if (rendered !== undefined) return rendered;\n return [h('div', { role: 'alert' }, diagnostics.map((item) => item.message).join('; '))];\n}\n\nconst remountKeyProp = {\n type: [String, Number] as unknown as PropType<string | number>,\n default: undefined,\n};\n\n// setup-function 重载的公共声明在 Vue 3.5 的最低 peer 版本中同样有效,\n// 避免暴露随 Vue patch 增加泛型参数的 options-object 推断结果。\nconst BaseScreenDesignerComponent = /*#__PURE__*/ defineComponent<\n BaseScreenDesignerProps,\n {},\n string,\n SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>\n>(\n (props, { slots }) => {\n const mounted = useBaseScreenMount({\n runtime: () => props.runtime,\n mountOptions: () => props.mountOptions,\n remountKey: () => props.remountKey,\n onMounted: () => props.onMounted,\n onDiagnostics: () => props.onDiagnostics,\n identity: [\n () => props.mountOptions?.projectId,\n () => props.mountOptions?.document,\n () => props.mountOptions?.element,\n ],\n onProjectState: () => props.onProjectState,\n createController: (input) =>\n createBaseScreenDesignerMountController({\n runtime: input.runtime,\n options: input.options,\n onMounted: input.onMounted,\n ...(input.onProjectState === undefined ? {} : { onProjectState: input.onProjectState }),\n onDiagnostics: input.onDiagnostics,\n }),\n });\n return () => {\n return h(\n 'div',\n { ref: mounted.containerRef },\n renderDiagnostics(mounted.diagnostics.value, () =>\n slots.fallback?.({\n diagnostics: mounted.diagnostics.value,\n context: mounted.diagnosticContext.value,\n }),\n ),\n );\n };\n },\n {\n name: 'BaseScreenDesigner',\n slots: Object as SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>,\n props: {\n // `null` 列入 type 数组:required 的 prop 也会跑类型断言,只有显式列出才接受「未就绪」。\n runtime: {\n type: [Object, null] as unknown as PropType<BaseScreenRuntime | null>,\n required: true,\n },\n mountOptions: {\n type: [Object, null] as unknown as PropType<BaseScreenDesignerMountOptions | null>,\n required: true,\n },\n remountKey: remountKeyProp,\n onMounted: {\n type: Function as PropType<BaseScreenMountControllerReady<BaseScreenDesignerElement>>,\n default: undefined,\n },\n onProjectState: {\n type: Function as PropType<(state: ScreenProjectState) => void>,\n default: undefined,\n },\n onDiagnostics: {\n type: Function as PropType<BaseScreenMountDiagnosticsCallback>,\n default: undefined,\n },\n },\n },\n);\n\nexport const BaseScreenDesigner = BaseScreenDesignerComponent;\n\nconst BaseScreenViewerComponent = /*#__PURE__*/ defineComponent<\n BaseScreenViewerProps,\n {},\n string,\n SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>\n>(\n (props, { slots }) => {\n const mounted = useBaseScreenMount({\n runtime: () => props.runtime,\n mountOptions: () => props.mountOptions,\n remountKey: () => props.remountKey,\n onMounted: () => props.onMounted,\n onDiagnostics: () => props.onDiagnostics,\n identity: [\n () => props.mountOptions?.projectId,\n () => props.mountOptions?.document,\n () => props.mountOptions?.documentRevision,\n () => props.mountOptions?.element,\n ],\n createController: (input) =>\n createBaseScreenViewerMountController({\n runtime: input.runtime,\n options: input.options,\n onMounted: input.onMounted,\n ...(input.onProjectState === undefined ? {} : { onProjectState: input.onProjectState }),\n onDiagnostics: input.onDiagnostics,\n }),\n });\n return () => {\n return h(\n 'div',\n { ref: mounted.containerRef },\n renderDiagnostics(mounted.diagnostics.value, () =>\n slots.fallback?.({\n diagnostics: mounted.diagnostics.value,\n context: mounted.diagnosticContext.value,\n }),\n ),\n );\n };\n },\n {\n name: 'BaseScreenViewer',\n slots: Object as SlotsType<{\n fallback: {\n diagnostics: readonly ScreenDiagnostic[];\n context: BaseScreenMountDiagnosticContext | undefined;\n };\n }>,\n props: {\n // `null` 列入 type 数组:required 的 prop 也会跑类型断言,只有显式列出才接受「未就绪」。\n runtime: {\n type: [Object, null] as unknown as PropType<BaseScreenViewerRuntime | null>,\n required: true,\n },\n mountOptions: {\n type: [Object, null] as unknown as PropType<BaseScreenViewerMountOptions | null>,\n required: true,\n },\n remountKey: remountKeyProp,\n onMounted: {\n type: Function as PropType<BaseScreenMountControllerReady<BaseScreenViewerElement>>,\n default: undefined,\n },\n onDiagnostics: {\n type: Function as PropType<BaseScreenMountDiagnosticsCallback>,\n default: undefined,\n },\n },\n },\n);\n\nexport const BaseScreenViewer = BaseScreenViewerComponent;\n","import {\n parseScreenJsonValue,\n type ScreenJsonValue,\n type ScreenParseResult,\n} from 'base-screen/contracts';\nimport type {\n BaseScreenMaterialCatalogEntry,\n BaseScreenMaterialConstructor,\n BaseScreenMaterialManifest,\n BaseScreenMaterialModel,\n} from 'base-screen/plugin-core';\nimport { createMaterialDefinition } from 'base-screen/plugin-sdk';\nimport { type App, type Component, createApp, h, type ShallowRef, shallowRef } from 'vue';\nimport {\n collectGlobalRules,\n type ReadableStyleRule,\n type ReadableStyleSheet,\n} from './global-styles.js';\n\nexport * from './components.js';\n\nexport interface CreateVueMaterialDefinitionOptions<Props extends object> {\n readonly manifest: BaseScreenMaterialManifest;\n readonly component: Component;\n readonly mapModel?: (model: BaseScreenMaterialModel) => Props;\n readonly eventProps?: Readonly<Record<string, string>>;\n /** 每次创建 app 后、mount 前调用,用于安装宿主插件与 provide。 */\n readonly configureApp?: (app: App) => void;\n}\n\n// 原生 CSS 交互门控(ADR-0036):与 React 桥接一致,非交互模式下桥接渲染的原生控件\n// (button 等)不接收指针事件,hover/active/focus 原生样式静默;指针事件落到物料元素自身,\n// 设计器的选择/拖拽命中测试不受影响。规则按属性作用域匹配、按 shadow root(或 document)幂等注入。\nconst BRIDGE_INTERACTIVE_STYLE_KEY = 'base-screen-bridge-interactive-styles';\nconst BRIDGE_INTERACTIVE_STYLE_TEXT =\n '[data-base-screen-interactive=\"false\"] * { pointer-events: none; }';\n\nexport function createVueMaterialDefinition<Props extends object>(\n options: CreateVueMaterialDefinitionOptions<Props>,\n): ScreenParseResult<BaseScreenMaterialCatalogEntry> {\n const ElementBase =\n (globalThis as { readonly HTMLElement?: typeof HTMLElement }).HTMLElement ??\n (class {} as unknown as typeof HTMLElement);\n const eventProps = options.eventProps ?? {};\n\n class VueMaterialElement extends ElementBase {\n static readonly manifest = options.manifest;\n\n #model: BaseScreenMaterialModel | undefined;\n #modelRef: ShallowRef<BaseScreenMaterialModel | undefined> | undefined;\n #app: App | undefined;\n #disconnectScheduled = false;\n\n get model(): BaseScreenMaterialModel {\n if (this.#model === undefined) {\n throw new Error('Material model has not been set.');\n }\n return this.#model;\n }\n\n set model(value: BaseScreenMaterialModel) {\n this.#model = value;\n this.dataset.baseScreenInteractive = String(value.interactive);\n if (this.#modelRef !== undefined) {\n this.#modelRef.value = value;\n }\n }\n\n connectedCallback(): void {\n this.#disconnectScheduled = false;\n if (this.#app === undefined) {\n // 组件库(如 vue-echarts)和宿主项目样式依赖注入到 document 的全局样式,\n // 但物料被挂载在宿主页的 shadow root 内,全局样式无法穿透。桥接层在挂载\n // 组件之前把文档中的全部可读全局规则传播进宿主 shadow root,使组件库\n // 首次初始化就能拿到正确尺寸,嵌套组件树(含 scoped 样式)也能正常布局。\n this.#propagateGlobalStyles();\n this.#ensureInteractiveStyleSheet();\n this.#mountApp();\n }\n }\n\n #ensureInteractiveStyleSheet(): void {\n const root = this.getRootNode();\n if (root instanceof ShadowRoot) {\n if (\n root.querySelector(`style[data-bridge-style-key=\"${BRIDGE_INTERACTIVE_STYLE_KEY}\"]`) !==\n null\n ) {\n return;\n }\n const style = this.ownerDocument.createElement('style');\n style.dataset.bridgeStyleKey = BRIDGE_INTERACTIVE_STYLE_KEY;\n style.textContent = BRIDGE_INTERACTIVE_STYLE_TEXT;\n root.appendChild(style);\n return;\n }\n if (root instanceof Document && root.getElementById(BRIDGE_INTERACTIVE_STYLE_KEY) === null) {\n const style = this.ownerDocument.createElement('style');\n style.id = BRIDGE_INTERACTIVE_STYLE_KEY;\n style.textContent = BRIDGE_INTERACTIVE_STYLE_TEXT;\n root.head.appendChild(style);\n }\n }\n\n #mountApp(): void {\n const modelRef = shallowRef(this.#model);\n const app = createApp({\n render: () => {\n const model = modelRef.value;\n if (model === undefined) {\n return null;\n }\n const props = {\n ...(options.mapModel === undefined ? (model.props as Props) : options.mapModel(model)),\n ...this.createEventProps(),\n } as Props;\n return h(options.component, props);\n },\n });\n let mountStarted = false;\n try {\n options.configureApp?.(app);\n mountStarted = true;\n app.mount(this);\n this.#modelRef = modelRef;\n this.#app = app;\n } catch (error) {\n if (mountStarted) app.unmount();\n throw error;\n }\n }\n\n disconnectedCallback(): void {\n if (this.#disconnectScheduled) {\n return;\n }\n this.#disconnectScheduled = true;\n queueMicrotask(() => {\n this.#disconnectScheduled = false;\n if (!this.isConnected && this.#app !== undefined) {\n this.#app.unmount();\n this.#app = undefined;\n this.#modelRef = undefined;\n }\n });\n }\n\n #propagateGlobalStyles(): void {\n const root = this.getRootNode();\n if (!(root instanceof ShadowRoot)) {\n return;\n }\n // 宿主 shadow root 只注入一次(同一 designer/viewer 内的多个物料共享同一 shadow root)。\n const key = 'base-screen-global-styles';\n if (root.querySelector(`style[data-bridge-style-key=\"${key}\"]`) !== null) {\n return;\n }\n const rules = collectGlobalRules(readDocumentStyleSheets(this.ownerDocument));\n if (rules.length === 0) {\n return;\n }\n const style = this.ownerDocument.createElement('style');\n style.dataset.bridgeStyleKey = key;\n style.textContent = rules.join('\\n');\n root.appendChild(style);\n }\n\n private createEventProps(): Record<string, (payload: unknown) => void> {\n const bindings: Record<string, (payload: unknown) => void> = {};\n for (const [eventName, propName] of Object.entries(eventProps)) {\n bindings[propName] = (payload: unknown) => this.dispatchMaterialEvent(eventName, payload);\n }\n return bindings;\n }\n\n private dispatchMaterialEvent(name: string, payload: unknown): void {\n if (this.#model?.interactive !== true || !options.manifest.events.includes(name)) {\n return;\n }\n const parsed = parseEventPayload(payload);\n if (parsed === undefined) {\n return;\n }\n this.dispatchEvent(\n new CustomEvent('base-screen-material-event', {\n bubbles: true,\n composed: true,\n detail: { name, payload: parsed },\n }),\n );\n }\n }\n\n const definition = createMaterialDefinition({\n manifest: options.manifest,\n element: VueMaterialElement as BaseScreenMaterialConstructor,\n });\n return definition.ok\n ? {\n ok: true,\n value: { manifest: definition.value.manifest, constructor: definition.value.element },\n diagnostics: [],\n }\n : definition;\n}\n\nfunction readDocumentStyleSheets(document: Document): readonly ReadableStyleSheet[] {\n const sheets: ReadableStyleSheet[] = [];\n for (const sheet of document.styleSheets) {\n try {\n sheets.push({ cssRules: [...sheet.cssRules] as ReadableStyleRule[] });\n } catch {\n // 跨域样式表不可读,跳过。\n }\n }\n const adopted = document.adoptedStyleSheets;\n if (adopted !== undefined) {\n for (const sheet of adopted) {\n try {\n sheets.push({ cssRules: [...sheet.cssRules] as ReadableStyleRule[] });\n } catch {\n // 跨域样式表不可读,跳过。\n }\n }\n }\n return sheets;\n}\n\nfunction parseEventPayload(value: unknown): ScreenJsonValue | undefined {\n const parsed = parseScreenJsonValue(value, { maxBytes: 64 * 1024 });\n return parsed.ok ? parsed.value : undefined;\n}\n"],"mappings":";;;;;AAgBA,SAAgB,EACd,GACmB;CACnB,IAAM,oBAAY,IAAI,IAAY,GAC5B,oBAAU,IAAI,IAAwB,GACtC,KAAc,MAAoC;EAClD,OAAQ,IAAI,CAAK,GACrB;KAAQ,IAAI,CAAK;GACjB,KAAK,IAAM,KAAQ,EAAM,YAAY,CAAC,GAAG,EAAU,CAAI;EADtC;CAEnB,GACM,KAAa,MAAkC;EACnD,AAAI,EAAK,YAAY,KAAA,KACnB,EAAU,IAAI,EAAK,OAAO;EAE5B,KAAK,IAAM,KAAU,EAAK,YAAY,CAAC,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,KAAK,EAAO,QAAQ,KAAA;AACpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base-screen/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "将 Vue 组件桥接为 Base Screen 物料",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"base-screen": "^0.
|
|
23
|
+
"base-screen": "^0.2.0"
|
|
24
24
|
},
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|