@codesuma/baseline 1.0.5 → 1.0.7

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/index.ts CHANGED
@@ -30,7 +30,7 @@ export { default as state } from './lib/state'
30
30
 
31
31
  // Utilities
32
32
  export { createEmitter, emitter, IEmitter } from './utils/emitter'
33
- export { createStyler, injectCSS, IStyler } from './utils/styler'
33
+ export { createStyler, injectCSS, IStyler, CS } from './utils/styler'
34
34
  export { waitFor } from './utils/wait'
35
35
  export { withRipple } from './utils/ripple'
36
36
  export { nextId, shortUUID, uuidv4 } from './utils/id'
package/lib/idb.ts CHANGED
@@ -132,8 +132,27 @@ async function find<T>(dbName: string, store: string, options: {
132
132
  })
133
133
  }
134
134
 
135
+ // Add this factory function at the end, before export default
136
+
137
+ function createDatabase(dbName: string) {
138
+ return {
139
+ info: () => info(dbName),
140
+ createStore: (name: string, version: number, options?: StoreOptions) =>
141
+ createStore(dbName, name, version, options),
142
+ save: <T>(store: string, data: T | T[]) => save<T>(dbName, store, data),
143
+ get: <T>(store: string, id: any) => get<T>(dbName, store, id),
144
+ all: <T>(store: string) => all<T>(dbName, store),
145
+ update: <T>(store: string, data: T) => update<T>(dbName, store, data),
146
+ delete: (store: string, id: any) => del(dbName, store, id),
147
+ clear: (store: string) => clear(dbName, store),
148
+ count: (store: string) => count(dbName, store),
149
+ find: <T>(store: string, options?: Parameters<typeof find>[2]) =>
150
+ find<T>(dbName, store, options),
151
+ }
152
+ }
135
153
 
136
- export default {
154
+ // Make the export callable AND have the raw methods
155
+ const idb = Object.assign(createDatabase, {
137
156
  info,
138
157
  createStore,
139
158
  save,
@@ -144,4 +163,6 @@ export default {
144
163
  clear,
145
164
  count,
146
165
  find
147
- }
166
+ })
167
+
168
+ export default idb
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesuma/baseline",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "A minimal, imperative UI framework for building fast web apps. No virtual DOM, no magic, no dependencies.",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",
@@ -25,7 +25,7 @@
25
25
  "license": "MIT",
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "https://github.com/ardeshirvalipoor/base-ui.git"
28
+ "url": "https://gith ub.com/ardeshirvalipoor/base-ui.git"
29
29
  },
30
30
  "peerDependencies": {},
31
31
  "publishConfig": {
package/utils/styler.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { IBaseComponent, IBaseSVGComponent } from '../components/base'
2
2
 
3
3
  type Component = IBaseComponent<any> | IBaseSVGComponent<any>
4
- type StyleObj = Partial<CSSStyleDeclaration> & Record<string, any>
4
+ export type CS = Partial<CSSStyleDeclaration> & Record<string, any>
5
5
 
6
6
  export function createStyler(base: Component): IStyler {
7
7
  return {
8
- style(s: StyleObj, delay?: number) {
8
+ style(s: CS, delay?: number) {
9
9
  const apply = () => {
10
10
  const keys = Object.keys(s)
11
11
  for (let i = 0; i < keys.length; i++) {
@@ -47,10 +47,11 @@ export function injectCSS(id: string, css: string) {
47
47
  }
48
48
 
49
49
  export interface IStyler {
50
- style(s: StyleObj, delay?: number): Component
50
+ style(s: CS, delay?: number): Component
51
51
  addClass(...classes: string[]): Component
52
52
  removeClass(...classes: string[]): Component
53
53
  toggleClass(cls: string, force?: boolean): Component
54
54
  }
55
55
 
56
+
56
57
  export default createStyler