article-content-renderer-vue2 0.1.0 → 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.
@@ -1,22 +1,18 @@
1
1
  import Vue from 'vue';
2
- import type { AdSlot } from '../protocols/types.js';
3
- import type { AdConfig, PubId, RenderIssue, ResolveArticleButtonLink, ValidationResult } from '../types.js';
2
+ import type { ResolvedCustomSlot } from '../protocols/types.js';
3
+ import type { CustomSlot, RenderIssue, ResolveArticleButtonLink, ValidationResult } from '../types.js';
4
4
  declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>, {
5
5
  reportedRuntimeIssues: Set<string>;
6
- reportedAdConfigIssue: string | null;
7
6
  }, {
7
+ resolveCustomSlots(): ResolvedCustomSlot[];
8
8
  reportRuntimeIssue(issue: RenderIssue): void;
9
9
  }, {
10
10
  validation: ValidationResult;
11
- adConfigIssue: RenderIssue | null;
12
- adSlots: readonly AdSlot[];
13
11
  }, {
14
12
  document: unknown;
15
13
  protocolVersion: number;
16
14
  strict: boolean;
17
- adConf: AdConfig;
18
- pubid: PubId;
19
- adTitle: string;
15
+ customSlots: CustomSlot[];
20
16
  imageBaseUrl: string;
21
17
  resolveArticleButtonLink: ResolveArticleButtonLink;
22
18
  }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
@@ -5,4 +5,4 @@ export default ArticleContentRenderer;
5
5
  export declare const ArticleContentRendererPlugin: PluginObject<never>;
6
6
  export { CURRENT_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, validateArticleDocument, } from './protocols/registry.js';
7
7
  export { ARTICLE_CONTENT_PROTOCOL_V1 } from './protocols/v1/metadata.js';
8
- export type { AdConfig, ArticleButtonAttrs, ArticleButtonClickPayload, ArticleButtonLink, ArticleButtonLinkDescriptor, ArticleButtonNode, ArticleButtonStyle, ArticleContentNode, ArticleDocument, ArticleMark, BlockNode, BlockquoteNode, BoldMark, BulletListNode, CodeBlockNode, CodeBlockTextNode, CodeMark, HeadingNode, HorizontalRuleNode, ImageAlign, ImageNode, ItalicMark, LinkMark, LinkTarget, ListItemNode, OrderedListNode, ParagraphNode, ProtocolVersion, PubId, RenderIssue, RenderIssueCode, ResolveArticleButtonLink, StrikeMark, TableCellNode, TableNode, TableRowNode, TextAlign, TextNode, UnderlineMark, ValidationResult, } from './types.js';
8
+ export type { ArticleButtonAttrs, ArticleButtonClickPayload, ArticleButtonLink, ArticleButtonLinkDescriptor, ArticleButtonNode, ArticleButtonStyle, ArticleContentNode, ArticleDocument, ArticleMark, BlockNode, BlockquoteNode, BoldMark, BulletListNode, CodeBlockNode, CodeBlockTextNode, CodeMark, CustomSlot, HeadingNode, HorizontalRuleNode, ImageAlign, ImageNode, ItalicMark, LinkMark, LinkTarget, ListItemNode, OrderedListNode, ParagraphNode, ProtocolVersion, RenderIssue, RenderIssueCode, ResolveArticleButtonLink, StrikeMark, TableCellNode, TableNode, TableRowNode, TextAlign, TextNode, UnderlineMark, ValidationResult, } from './types.js';
@@ -2,20 +2,16 @@ import type { CreateElement, VNode } from 'vue';
2
2
  import type { ArticleButtonClickPayload, RenderIssue, ResolveArticleButtonLink, ValidationResult } from '../types.js';
3
3
  export interface RenderContext {
4
4
  createElement: CreateElement;
5
- adSlots: readonly AdSlot[];
6
- admPublisherId: string;
7
- adsPublisherId: string;
8
- adTitle: string;
5
+ customSlots: readonly ResolvedCustomSlot[];
9
6
  imageBaseUrl: string;
10
7
  resolveArticleButtonLink?: ResolveArticleButtonLink;
11
8
  emitArticleButtonClick: (payload: ArticleButtonClickPayload) => void;
12
9
  reportIssue: (issue: RenderIssue) => void;
13
10
  }
14
- export interface AdSlot {
15
- index: number;
11
+ export interface ResolvedCustomSlot {
12
+ id: string;
16
13
  location: number;
17
- adm: unknown;
18
- ads: unknown;
14
+ content: readonly VNode[];
19
15
  }
20
16
  export interface ProtocolAdapter {
21
17
  version: number;
@@ -3,14 +3,9 @@ export type TextAlign = 'left' | 'center' | 'right' | 'justify';
3
3
  export type ImageAlign = 'left' | 'center' | 'right';
4
4
  export type ArticleButtonStyle = 'text' | 'button';
5
5
  export type LinkTarget = '_blank' | '_self';
6
- export interface AdConfig {
7
- adm?: readonly unknown[];
8
- ads?: readonly unknown[];
9
- loc: readonly number[];
10
- }
11
- export interface PubId {
12
- adm: string;
13
- ads: string;
6
+ export interface CustomSlot {
7
+ id: string;
8
+ location: number;
14
9
  }
15
10
  export interface BoldMark {
16
11
  type: 'bold';
@@ -134,7 +129,7 @@ export interface ArticleButtonLinkDescriptor {
134
129
  }
135
130
  export type ArticleButtonLink = string | ArticleButtonLinkDescriptor | null;
136
131
  export type ResolveArticleButtonLink = (attrs: Readonly<ArticleButtonAttrs>, node: Readonly<ArticleButtonNode>) => ArticleButtonLink;
137
- export type RenderIssueCode = 'INVALID_ROOT' | 'INVALID_TYPE' | 'INVALID_CONTENT' | 'INVALID_VALUE' | 'MISSING_PROPERTY' | 'UNKNOWN_PROPERTY' | 'UNKNOWN_NODE' | 'UNKNOWN_MARK' | 'TABLE_COLUMN_MISMATCH' | 'UNSAFE_URL' | 'LINK_RESOLUTION_FAILED' | 'UNSUPPORTED_PROTOCOL' | 'AD_CONFIG_LENGTH_MISMATCH';
132
+ export type RenderIssueCode = 'INVALID_ROOT' | 'INVALID_TYPE' | 'INVALID_CONTENT' | 'INVALID_VALUE' | 'MISSING_PROPERTY' | 'UNKNOWN_PROPERTY' | 'UNKNOWN_NODE' | 'UNKNOWN_MARK' | 'TABLE_COLUMN_MISMATCH' | 'UNSAFE_URL' | 'LINK_RESOLUTION_FAILED' | 'UNSUPPORTED_PROTOCOL';
138
133
  export interface RenderIssue {
139
134
  code: RenderIssueCode;
140
135
  path: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "article-content-renderer-vue2",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A safe Vue 2.7 renderer for the Article Content Protocol ProseMirror JSON format.",
5
5
  "author": "NovaVoyager",
6
6
  "license": "MIT",
@@ -1,39 +0,0 @@
1
- import Vue from 'vue';
2
- interface GoogleTagSlot {
3
- addService: (service: GoogleTagPubAdsService) => GoogleTagSlot;
4
- }
5
- interface GoogleTagSlotRenderEndedEvent {
6
- slot: GoogleTagSlot;
7
- isEmpty: boolean;
8
- }
9
- interface GoogleTagPubAdsService {
10
- addEventListener: (eventName: 'slotRenderEnded', listener: (event: GoogleTagSlotRenderEndedEvent) => void) => void;
11
- removeEventListener?: (eventName: 'slotRenderEnded', listener: (event: GoogleTagSlotRenderEndedEvent) => void) => void;
12
- }
13
- export declare const AdManagerAd: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>, {
14
- observer: IntersectionObserver | null;
15
- definedSlot: GoogleTagSlot | null;
16
- pubAdsService: GoogleTagPubAdsService | null;
17
- slotRenderEnded: ((event: GoogleTagSlotRenderEndedEvent) => void) | null;
18
- emptyAdmKey: string | null;
19
- cancelled: boolean;
20
- }, {
21
- restartAdManager(): void;
22
- startObserver(): void;
23
- requestAd(): void;
24
- cleanupAdManager(): void;
25
- }, {
26
- admSlotId: string;
27
- adsSlotId: string;
28
- adUnitPath: string;
29
- fallbackKey: string;
30
- hasAdSenseFallback: boolean;
31
- shouldUseAdSense: boolean;
32
- }, {
33
- publisherId: string;
34
- slotId: string | number;
35
- title: string;
36
- fallbackPublisherId: string;
37
- fallbackSlotId: string | number;
38
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
39
- export default AdManagerAd;
@@ -1,18 +0,0 @@
1
- import Vue from 'vue';
2
- export declare const AdSenseAd: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>, {
3
- observer: IntersectionObserver | null;
4
- requestedKey: string | null;
5
- }, {
6
- requestAd(): void;
7
- startObserver(): void;
8
- stopObserver(): void;
9
- }, {
10
- adClient: string;
11
- adSlot: string;
12
- requestKey: string;
13
- }, {
14
- publisherId: string;
15
- slotId: string | number;
16
- title: string;
17
- }, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
18
- export default AdSenseAd;