@soonspacejs/plugin-poi-renderer 2.8.14

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 ADDED
@@ -0,0 +1,5 @@
1
+ # @soonspacejs/plugin-poi-renderer
2
+
3
+ > Poi-renderer plugin for SoonSpace.js
4
+
5
+ Document: [http://www.xwbuilders.com:8800/plugin/poi-renderer.html](http://www.xwbuilders.com:8800/plugin/poi-renderer.html)
@@ -0,0 +1,23 @@
1
+ import SoonSpace from 'soonspacejs';
2
+ import type { PoiNodeInfo } from 'soonspacejs/types/Library';
3
+ import * as CSS from 'csstype';
4
+ export interface PoiCustomOptions extends PoiNodeInfo {
5
+ tagName: keyof HTMLElementTagNameMap;
6
+ style?: CSS.Properties;
7
+ innerHTML?: string;
8
+ }
9
+ export interface PoiVideoOptions extends PoiNodeInfo {
10
+ src: string;
11
+ style?: CSS.Properties;
12
+ }
13
+ export type PoiImageOptions = PoiVideoOptions;
14
+ export declare const DefaultStyle: CSS.Properties;
15
+ export default class PatrolControlsPlugin {
16
+ readonly ssp: SoonSpace;
17
+ constructor(ssp: SoonSpace);
18
+ private resetStyleName;
19
+ private mergeElementStyle;
20
+ renderCustom(options: PoiCustomOptions): void;
21
+ renderVideo(options: PoiVideoOptions): void;
22
+ renderImage(options: PoiVideoOptions): void;
23
+ }
@@ -0,0 +1 @@
1
+ const e={width:"400px",height:"300px",backgroundColor:"black"};class t{constructor(e){this.ssp=e}resetStyleName(e){const t=[...e];for(const e in t)t[e]!==t[e].toLowerCase()&&(t[e]=`-${t[e].toLowerCase()}`);return t.join("")}mergeElementStyle(e,t){let s="";for(const e in t)s+=`${this.resetStyleName(e)}: ${t[e]};`;console.log("cssText",s),e.style.cssText=s}renderCustom(t){const{tagName:s,style:n=e,innerHTML:o}=t,r=document.createElement(s);this.mergeElementStyle(r,n),o&&(r.innerHTML=o),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:r}))}renderVideo(t){const{src:s,style:n=e}=t,o=document.createElement("video");o.controls=!0,o.src=s,this.mergeElementStyle(o,n),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:o}))}renderImage(t){const{src:s,style:n=e}=t,o=document.createElement("img");o.src=s,this.mergeElementStyle(o,n),this.ssp.createPoiNode(Object.assign(Object.assign({},t),{element:o}))}}export{e as DefaultStyle,t as default};
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@soonspacejs/plugin-poi-renderer",
3
+ "pluginName": "PoiRendererPlugin",
4
+ "version": "2.8.14",
5
+ "description": "Poi-renderer plugin for SoonSpace.js",
6
+ "main": "dist/index.esm.js",
7
+ "module": "dist/index.esm.js",
8
+ "unpkg": "dist/index.esm.js",
9
+ "typings": "dist/index.d.ts",
10
+ "keywords": [
11
+ "soonspacejs",
12
+ "poi-renderer"
13
+ ],
14
+ "author": "xunwei",
15
+ "license": "UNLICENSED",
16
+ "gitHead": "f950063ce74806ab4d808100b6c1a3e927943d97",
17
+ "peerDependencies": {
18
+ "soonspacejs": "2.8.15"
19
+ },
20
+ "dependencies": {
21
+ "csstype": "^3.1.2"
22
+ }
23
+ }