Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circle-ihk

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circle-ihk - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

1

dist/hook/useOption.d.ts

@@ -6,2 +6,3 @@ /// <reference types="react" />

disabled?: boolean;
fieldToListen?: string;
}

@@ -8,0 +9,0 @@ export default function useOption(props: IProps): {

22

dist/hook/useOption.js

@@ -5,3 +5,3 @@ import useApp from './useApp';

export default function useOption(props) {
const { id, disabled, defaultValue } = props;
const { id, disabled, defaultValue, fieldToListen } = props;
const { app, me, container } = useApp();

@@ -44,11 +44,19 @@ const [value, setValue] = useState(defaultValue);

refetch();
let fieldToListen = `${id}_option`;
if (!id || id === 'option') {
fieldToListen = `${me.id}_option`;
let fieldToListenValue = '';
if (fieldToListen) {
fieldToListenValue = fieldToListen;
}
else if (id === 'display') {
fieldToListen = `${me.id}_display_${app.colorScheme.value ? app.colorScheme.value + '_' : ''}option`;
else {
if (!id || id === 'option') {
fieldToListenValue = `${me.id}_option`;
}
else if (id === 'display') {
fieldToListenValue = `${me.id}_display_${app.colorScheme.value ? app.colorScheme.value + '_' : ''}option`;
}
else {
fieldToListenValue = `${id}_option`;
}
}
const hooks = [];
hooks.push(app.on(fieldToListen, refetch));
hooks.push(app.on(fieldToListenValue, refetch));
hooks.push(app.on('color_scheme', refetch));

@@ -55,0 +63,0 @@ return () => {

import { App } from '../interface';
export default function pageInfo(app: App): {
url: any;
domain: any;
lang: any;
title: any;
export default function pageInfo(app: App, exportFromDOMOrString?: string | HTMLElement): {
url: string;
content: HTMLElement;
domain: string;
title: string | undefined;
lang: string;
};
import url from './url';
import { isElement } from './is';
import nodeText from './node-text';
export default function pageInfo(app) {
const data = app.field('node');
if (Array.isArray(data) && data.length > 0) {
const item = data[0];
return {
url: item.url,
domain: item.domain,
lang: item.lang || 'zh-Hans',
title: isElement(item.title) ? nodeText(item.title) : item.title,
};
}
return {
import { isElement, isString } from './is';
export default function pageInfo(app, exportFromDOMOrString) {
const returnValue = {
url: url(),
content: document.body,
domain: location.hostname,

@@ -21,2 +12,45 @@ title: document.title.split(' - ').shift(),

};
const data = app.field('node');
if (Array.isArray(data) && data.length > 0) {
const item = data[0];
if (item.url) {
returnValue.url = item.url;
}
if (item.domain) {
returnValue.domain = item.domain;
}
if (item.lang) {
returnValue.lang = item.lang;
}
if (item.url) {
returnValue.url = item.url;
}
if (item.title) {
returnValue.title = isElement(item.title)
? nodeText(item.title)
: item.title;
}
}
const container = app.field('container');
if (isElement(container)) {
returnValue.content = container;
const title = container.querySelector('.page .title');
if (isElement(title)) {
returnValue.title = nodeText(title);
}
}
if (exportFromDOMOrString) {
// @ts-ignore
if (isString(exportFromDOMOrString) && exportFromDOMOrString.length > 0) {
const tmp = document.createElement('div');
// @ts-ignore
tmp.innerHTML = exportFromDOMOrString;
returnValue.content = tmp;
}
else if (isElement(exportFromDOMOrString)) {
// @ts-ignore
returnValue.content = exportFromDOMOrString;
}
}
return returnValue;
}
{
"name": "circle-ihk",
"version": "1.0.8",
"version": "1.0.9",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Circle Reader Component Library",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc