lupine.components 1.1.0 → 1.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lupine.components",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "license": "MIT",
5
5
  "author": "uuware.com",
6
6
  "homepage": "https://github.com/uuware/lupine.js",
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps, getRenderPageProps, RefProps } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps, getRenderPageProps, RefProps } from 'lupine.web';
2
2
  import { stopPropagation } from '../lib';
3
3
  import { MediaQueryMaxWidth } from '../styles';
4
4
  import { NestMenuItemProps } from './menu-item-props';
@@ -283,7 +283,7 @@ export const MenuSidebar = ({
283
283
  };
284
284
 
285
285
  // if this component is used twice, then the Global styles is only set at the first time
286
- bindGlobalStyles('menu-sidebar-box', css);
286
+ bindGlobalStyle('menu-sidebar-box', css);
287
287
 
288
288
  // show the menu on both mobile and desktop
289
289
  const newCss: CssProps =
@@ -1,4 +1,4 @@
1
- import { CssProps, bindGlobalStyles } from 'lupine.web';
1
+ import { CssProps, bindGlobalStyle } from 'lupine.web';
2
2
  /**
3
3
  How to use:
4
4
  Notification.sendMessage(message);
@@ -71,7 +71,7 @@ export class NotificationMessage {
71
71
  color: 'black',
72
72
  },
73
73
  };
74
- bindGlobalStyles('lj_notification', css);
74
+ bindGlobalStyle('lj_notification', css);
75
75
 
76
76
  let container = document.querySelector('.lj_notification');
77
77
  if (!container) {
@@ -1,4 +1,4 @@
1
- import { CssProps, RefProps, bindGlobalStyles, getRenderPageProps } from 'lupine.web';
1
+ import { CssProps, RefProps, bindGlobalStyle, getRenderPageProps } from 'lupine.web';
2
2
 
3
3
  let _DEFAULT_PAGE_LIMIT = 10;
4
4
  export const getDefaultPageLimit = () => {
@@ -70,7 +70,7 @@ export const PagingLink = ({
70
70
  },
71
71
  };
72
72
 
73
- bindGlobalStyles('paging-link-box', css);
73
+ bindGlobalStyle('paging-link-box', css);
74
74
  pageIndex = pageIndex ?? (Number.parseInt(getRenderPageProps().query['pg_i'] || '') || 0);
75
75
  pageLimit = pageLimit || _DEFAULT_PAGE_LIMIT;
76
76
  let maxPages = Math.floor(itemsCount / pageLimit);
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps } from 'lupine.web';
2
2
  import { stopPropagation } from '../lib';
3
3
  /**
4
4
  How to use:
@@ -63,7 +63,7 @@ export class ResizableSplitter {
63
63
  backgroundColor: '#ccc',
64
64
  },
65
65
  };
66
- bindGlobalStyles('resizable-splitter', css);
66
+ bindGlobalStyle('resizable-splitter', css);
67
67
 
68
68
  window.addEventListener('mousemove', ResizableSplitter.onMousemove.bind(ResizableSplitter), false);
69
69
  document.documentElement.addEventListener('mouseup', ResizableSplitter.onMouseup.bind(ResizableSplitter), false);
@@ -1,4 +1,12 @@
1
- import { CssProps, RefProps, VNode, bindGlobalStyles, mountInnerComponent } from 'lupine.web';
1
+ import {
2
+ CssProps,
3
+ RefProps,
4
+ VNode,
5
+ bindGlobalStyle,
6
+ domUniqueId,
7
+ getGlobalStylesId,
8
+ mountInnerComponent,
9
+ } from 'lupine.web';
2
10
  import { stopPropagation } from '../lib';
3
11
 
4
12
  export type TabsHookProps = {
@@ -24,7 +32,6 @@ export type TabsProps = {
24
32
  };
25
33
  // For CSS or query selectors, please pay attention to that Tabs can be nested
26
34
  export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: refUpdate }: TabsProps) => {
27
- const ref: RefProps = {};
28
35
  let newIndex = typeof defaultIndex === 'number' ? defaultIndex : 0;
29
36
  const clearIndex = () => {
30
37
  const header = ref.$(`.&tabs > div > .tab.active`);
@@ -158,7 +165,7 @@ export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: ref
158
165
  // hide tabs when there is no tabs (not need to show borders)
159
166
  display: 'none',
160
167
  },
161
- '> .tabs': {
168
+ '> .&tabs': {
162
169
  display: 'flex',
163
170
  height: 'auto',
164
171
  'border-bottom': '1px solid grey',
@@ -212,7 +219,7 @@ export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: ref
212
219
  color: '#ff0000',
213
220
  },
214
221
  },
215
- '> .pages': {
222
+ '> .&pages': {
216
223
  display: 'flex',
217
224
  flex: '1',
218
225
  position: 'relative',
@@ -233,7 +240,12 @@ export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: ref
233
240
  },
234
241
  };
235
242
  // we want to put all common styles in the header
236
- bindGlobalStyles('s-tabs-box', css);
243
+ const tabGlobalCssId = getGlobalStylesId(css);
244
+ bindGlobalStyle(tabGlobalCssId, css);
245
+
246
+ const ref: RefProps = {
247
+ globalCssId: tabGlobalCssId,
248
+ };
237
249
 
238
250
  // but we also want to create unique id for the current tab
239
251
  const cssTab: CssProps = {
@@ -245,7 +257,7 @@ export const Tabs = ({ pages, defaultIndex, topClassName, pagePadding, hook: ref
245
257
  },
246
258
  };
247
259
  return (
248
- <div ref={ref} css={cssTab} class={'s-tabs-box' + (topClassName ? ' ' + topClassName : '')}>
260
+ <div ref={ref} css={cssTab} class={topClassName ? ' ' + topClassName : ''}>
249
261
  <div class='&tabs tabs'>
250
262
  {pages.map((i, index) => {
251
263
  const className = index === newIndex ? ' active' : '';
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps } from 'lupine.web';
2
2
 
3
3
  export type TextGlowProps = {
4
4
  text: string;
@@ -28,7 +28,7 @@ export const TextGlow = (props: TextGlowProps) => {
28
28
  },
29
29
  },
30
30
  };
31
- bindGlobalStyles('text-glow-top', css);
31
+ bindGlobalStyle('text-glow-top', css);
32
32
  return (
33
33
  <div class='text-glow-top'>
34
34
  <div class='text-glow'>{props.text}</div>
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps } from 'lupine.web';
2
2
 
3
3
  export type TextScaleProps = {
4
4
  text: string;
@@ -33,7 +33,7 @@ export const TextScale = (props: TextScaleProps) => {
33
33
  },
34
34
  },
35
35
  };
36
- bindGlobalStyles('text-scale-top', css);
36
+ bindGlobalStyle('text-scale-top', css);
37
37
  return (
38
38
  <div class='text-scale-top'>
39
39
  <div class='text-scale'>{props.text}</div>
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps } from "lupine.web";
1
+ import { bindGlobalStyle, CssProps } from "lupine.web";
2
2
 
3
3
  export type TextLoadingProps = {
4
4
  text: string;
@@ -42,7 +42,7 @@ export const TextWave = (props: TextLoadingProps) => {
42
42
  },
43
43
  },
44
44
  };
45
- bindGlobalStyles('text-wave-top', css);
45
+ bindGlobalStyle('text-wave-top', css);
46
46
  return (
47
47
  <div class='text-wave-top'>
48
48
  <div class='text-wave wave-animetion'>
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps, RefProps, VNode } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps, RefProps, VNode } from 'lupine.web';
2
2
 
3
3
  export const TogglePlayButtonSize = {
4
4
  Small: { w: 50, h: 50 },
@@ -45,7 +45,7 @@ export const TogglePlayButton = (props: TogglePlayButtonProps) => {
45
45
  backgroundColor: '#5d578b',
46
46
  },
47
47
  };
48
- bindGlobalStyles('toggle-play-button-component', css);
48
+ bindGlobalStyle('toggle-play-button-component', css);
49
49
  return (
50
50
  <ToggleBase {...props}>
51
51
  <ToggleWaveFrame>
@@ -153,7 +153,7 @@ export const ToggleWaveFrame = (props: ToggleWaveFrameProps) => {
153
153
  backgroundColor: '#5d578b',
154
154
  },
155
155
  };
156
- bindGlobalStyles('toggle-waves-box', css);
156
+ bindGlobalStyle('toggle-waves-box', css);
157
157
  return (
158
158
  <div class='toggle-waves-box toggle-placeholder'>
159
159
  <div class='toggle-waves toggle-waves-1'></div>
@@ -244,7 +244,7 @@ export const ToggleBase = (props: ToggleBaseProps) => {
244
244
  pointerEvents: 'none',
245
245
  },
246
246
  };
247
- bindGlobalStyles('toggle-base-component', css);
247
+ bindGlobalStyle('toggle-base-component', css);
248
248
  return (
249
249
  <div
250
250
  ref={ref}
@@ -1,4 +1,4 @@
1
- import { bindGlobalStyles, CssProps } from 'lupine.web';
1
+ import { bindGlobalStyle, CssProps } from 'lupine.web';
2
2
  import { ToggleBase, ToggleBaseHookProps } from './toggle-base';
3
3
 
4
4
  export enum ToggleSwitchSize {
@@ -132,8 +132,8 @@ export const ToggleSwitch = (props: ToggleSwitchProps) => {
132
132
  },
133
133
  };
134
134
 
135
- bindGlobalStyles('toggle-switch-theme', cssTheme, false, true);
136
- bindGlobalStyles('toggle-switch-component', css);
135
+ bindGlobalStyle('toggle-switch-theme', cssTheme, false, true);
136
+ bindGlobalStyle('toggle-switch-component', css);
137
137
 
138
138
  const cssSize: CssProps = {
139
139
  '& .ts-on-text, & .ts-off-text': {