@atomic-ui/ui-vue 0.1.5 → 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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Vue bindings for `@impkt/ui`.
2
+ * Vue bindings for `@atomic-ui/ui`.
3
3
  *
4
4
  * ## What Vue needs, and what it does not
5
5
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vue bindings for `@impkt/ui`.\n *\n * ## What Vue needs, and what it does not\n *\n * Vue 3 renders unknown tags as custom elements once the compiler is told to\n * leave them alone, and it is better at this than React was: given a render\n * function, the `.` prefix binds a value as a DOM **property** rather than an\n * attribute, so an array of options arrives as an array.\n *\n * So the wrapper is thin on purpose. Its job is to spare every consumer from\n * remembering the `.` and from typing `@impkt-change` by hand, and to give\n * editors real prop types. It is not a reimplementation, and it adds no\n * behaviour — a Vue app that would rather write `<impkt-text-input>` directly\n * can, and only needs the build config below.\n *\n * ## One piece of configuration the wrapper cannot do for you\n *\n * In `vite.config.ts`:\n *\n * ```ts\n * vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('impkt-') } } })\n * ```\n *\n * Without it Vue warns about an unresolved component on every element, and\n * binds everything as attributes — which is the array problem again.\n */\nimport { defineComponent, h, type PropType, type SlotsType, type VNode } from 'vue';\nimport '@impkt/ui';\nimport type { RadioOption, SelectOption, CheckboxOption, SummaryRow, TableColumn, AccordionItem, ProgressStep, HelpKind } from '@impkt/ui';\n\n/** What a control reports when its value changes. */\nexport type ImpktChangeEvent = CustomEvent<{ value: string }>;\n\ntype Props = Record<string, unknown>;\n\n/**\n * Build a Vue component around one element.\n *\n * `domProps` names the props that must be bound as properties rather than\n * attributes — anything that is not a string or a boolean. Everything else\n * goes through as an attribute, which is what a custom element expects and\n * what keeps the rendered markup readable.\n */\nfunction wrap(tag: string, domProps: string[] = [], events: Record<string, string> = {}) {\n return defineComponent({\n name: tag.replace(/(^|-)(\\w)/g, (_, __, c: string) => c.toUpperCase()),\n inheritAttrs: false,\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n setup(_, { attrs, slots, emit }) {\n return () => {\n const bound: Props = {};\n for (const [key, value] of Object.entries(attrs)) {\n bound[domProps.includes(key) ? `.${key}` : key] = value;\n }\n for (const [eventName, vueName] of Object.entries(events)) {\n bound[`on${eventName.replace(/(^|-)(\\w)/g, (_, __, c: string) => c.toUpperCase())}`] =\n (e: Event) => emit(vueName, e);\n }\n return h(tag, bound, slots.default?.());\n };\n },\n emits: Object.values(events),\n });\n}\n\nconst CHANGE = { 'impkt-change': 'change' };\n\nexport const ImpktButton = wrap('impkt-button');\nexport const ImpktLink = wrap('impkt-link');\nexport const ImpktAlert = wrap('impkt-alert');\nexport const ImpktStack = wrap('impkt-stack');\nexport const ImpktCard = wrap('impkt-card');\nexport const ImpktHeading = wrap('impkt-heading');\nexport const ImpktText = wrap('impkt-text');\nexport const ImpktImage = wrap('impkt-image');\nexport const ImpktLogo = wrap('impkt-logo');\nexport const ImpktDocumentLink = wrap('impkt-document-link');\nexport const ImpktPrice = wrap('impkt-price');\nexport const ImpktDialog = wrap('impkt-dialog', [], { 'impkt-close': 'close' });\n\nexport const ImpktTextInput = wrap('impkt-text-input', [], CHANGE);\nexport const ImpktTextarea = wrap('impkt-textarea', [], CHANGE);\nexport const ImpktCheckbox = wrap('impkt-checkbox', [], CHANGE);\nexport const ImpktSelect = wrap('impkt-select', ['options'], CHANGE);\nexport const ImpktRadioGroup = wrap('impkt-radio-group', ['options'], CHANGE);\nexport const ImpktCheckboxGroup = wrap('impkt-checkbox-group', ['options', 'values'], CHANGE);\nexport const ImpktDateInput = wrap('impkt-date-input', [], CHANGE);\n\nexport const ImpktSummaryList = wrap('impkt-summary-list', ['rows']);\nexport const ImpktTable = wrap('impkt-table', ['columns', 'rows']);\nexport const ImpktAccordion = wrap('impkt-accordion', ['items', 'open']);\nexport const ImpktProgress = wrap('impkt-progress', ['steps']);\n\nexport type {\n RadioOption, SelectOption, CheckboxOption, SummaryRow, TableColumn, AccordionItem, ProgressStep, HelpKind,\n PropType,\n};\n\nexport const ImpktGrid = wrap('impkt-grid');\n\n// Every help prop is a string, so none has to be bound as a DOM property. A\n// `kind` of phone or email builds its own link from `detail`, so `href` is\n// only passed for a link (see `HelpKind`).\nexport const ImpktHelp = wrap('impkt-help');\n"],"mappings":";AA2BA,SAAS,iBAAiB,SAAoD;AAC9E,OAAO;AAgBP,SAAS,KAAK,KAAa,WAAqB,CAAC,GAAG,SAAiC,CAAC,GAAG;AACvF,SAAO,gBAAgB;AAAA,IACrB,MAAM,IAAI,QAAQ,cAAc,CAAC,GAAG,IAAI,MAAc,EAAE,YAAY,CAAC;AAAA,IACrE,cAAc;AAAA,IACd,OAAO;AAAA,IACP,MAAM,GAAG,EAAE,OAAO,OAAO,KAAK,GAAG;AAC/B,aAAO,MAAM;AACX,cAAM,QAAe,CAAC;AACtB,mBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,gBAAM,SAAS,SAAS,GAAG,IAAI,IAAI,GAAG,KAAK,GAAG,IAAI;AAAA,QACpD;AACA,mBAAW,CAAC,WAAW,OAAO,KAAK,OAAO,QAAQ,MAAM,GAAG;AACzD,gBAAM,KAAK,UAAU,QAAQ,cAAc,CAACA,IAAG,IAAI,MAAc,EAAE,YAAY,CAAC,CAAC,EAAE,IACjF,CAAC,MAAa,KAAK,SAAS,CAAC;AAAA,QACjC;AACA,eAAO,EAAE,KAAK,OAAO,MAAM,UAAU,CAAC;AAAA,MACxC;AAAA,IACF;AAAA,IACA,OAAO,OAAO,OAAO,MAAM;AAAA,EAC7B,CAAC;AACH;AAEA,IAAM,SAAS,EAAE,gBAAgB,SAAS;AAEnC,IAAM,cAAc,KAAK,cAAc;AACvC,IAAM,YAAY,KAAK,YAAY;AACnC,IAAM,aAAa,KAAK,aAAa;AACrC,IAAM,aAAa,KAAK,aAAa;AACrC,IAAM,YAAY,KAAK,YAAY;AACnC,IAAM,eAAe,KAAK,eAAe;AACzC,IAAM,YAAY,KAAK,YAAY;AACnC,IAAM,aAAa,KAAK,aAAa;AACrC,IAAM,YAAY,KAAK,YAAY;AACnC,IAAM,oBAAoB,KAAK,qBAAqB;AACpD,IAAM,aAAa,KAAK,aAAa;AACrC,IAAM,cAAc,KAAK,gBAAgB,CAAC,GAAG,EAAE,eAAe,QAAQ,CAAC;AAEvE,IAAM,iBAAiB,KAAK,oBAAoB,CAAC,GAAG,MAAM;AAC1D,IAAM,gBAAgB,KAAK,kBAAkB,CAAC,GAAG,MAAM;AACvD,IAAM,gBAAgB,KAAK,kBAAkB,CAAC,GAAG,MAAM;AACvD,IAAM,cAAc,KAAK,gBAAgB,CAAC,SAAS,GAAG,MAAM;AAC5D,IAAM,kBAAkB,KAAK,qBAAqB,CAAC,SAAS,GAAG,MAAM;AACrE,IAAM,qBAAqB,KAAK,wBAAwB,CAAC,WAAW,QAAQ,GAAG,MAAM;AACrF,IAAM,iBAAiB,KAAK,oBAAoB,CAAC,GAAG,MAAM;AAE1D,IAAM,mBAAmB,KAAK,sBAAsB,CAAC,MAAM,CAAC;AAC5D,IAAM,aAAa,KAAK,eAAe,CAAC,WAAW,MAAM,CAAC;AAC1D,IAAM,iBAAiB,KAAK,mBAAmB,CAAC,SAAS,MAAM,CAAC;AAChE,IAAM,gBAAgB,KAAK,kBAAkB,CAAC,OAAO,CAAC;AAOtD,IAAM,YAAY,KAAK,YAAY;AAKnC,IAAM,YAAY,KAAK,YAAY;","names":["_"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Vue bindings for `@atomic-ui/ui`.\n *\n * ## What Vue needs, and what it does not\n *\n * Vue 3 renders unknown tags as custom elements once the compiler is told to\n * leave them alone, and it is better at this than React was: given a render\n * function, the `.` prefix binds a value as a DOM **property** rather than an\n * attribute, so an array of options arrives as an array.\n *\n * So the wrapper is thin on purpose. Its job is to spare every consumer from\n * remembering the `.` and from typing `@impkt-change` by hand, and to give\n * editors real prop types. It is not a reimplementation, and it adds no\n * behaviour — a Vue app that would rather write `<impkt-text-input>` directly\n * can, and only needs the build config below.\n *\n * ## One piece of configuration the wrapper cannot do for you\n *\n * In `vite.config.ts`:\n *\n * ```ts\n * vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith('impkt-') } } })\n * ```\n *\n * Without it Vue warns about an unresolved component on every element, and\n * binds everything as attributes — which is the array problem again.\n */\nimport { defineComponent, h, type PropType, type SlotsType, type VNode } from 'vue';\nimport '@atomic-ui/ui';\nimport type { RadioOption, SelectOption, CheckboxOption, SummaryRow, TableColumn, AccordionItem, ProgressStep, HelpKind } from '@atomic-ui/ui';\n\n/** What a control reports when its value changes. */\nexport type ImpktChangeEvent = CustomEvent<{ value: string }>;\n\ntype Props = Record<string, unknown>;\n\n/**\n * Build a Vue component around one element.\n *\n * `domProps` names the props that must be bound as properties rather than\n * attributes — anything that is not a string or a boolean. Everything else\n * goes through as an attribute, which is what a custom element expects and\n * what keeps the rendered markup readable.\n */\nfunction wrap(tag: string, domProps: string[] = [], events: Record<string, string> = {}) {\n return defineComponent({\n name: tag.replace(/(^|-)(\\w)/g, (_, __, c: string) => c.toUpperCase()),\n inheritAttrs: false,\n slots: Object as SlotsType<{ default?: () => VNode[] }>,\n setup(_, { attrs, slots, emit }) {\n return () => {\n const bound: Props = {};\n for (const [key, value] of Object.entries(attrs)) {\n bound[domProps.includes(key) ? `.${key}` : key] = value;\n }\n for (const [eventName, vueName] of Object.entries(events)) {\n bound[`on${eventName.replace(/(^|-)(\\w)/g, (_, __, c: string) => c.toUpperCase())}`] =\n (e: Event) => emit(vueName, e);\n }\n return h(tag, bound, slots.default?.());\n };\n },\n emits: Object.values(events),\n });\n}\n\nconst CHANGE = { 'impkt-change': 'change' };\n\nexport const ImpktButton = wrap('impkt-button');\nexport const ImpktLink = wrap('impkt-link');\nexport const ImpktAlert = wrap('impkt-alert');\nexport const ImpktStack = wrap('impkt-stack');\nexport const ImpktCard = wrap('impkt-card');\nexport const ImpktHeading = wrap('impkt-heading');\nexport const ImpktText = wrap('impkt-text');\nexport const ImpktImage = wrap('impkt-image');\nexport const ImpktLogo = wrap('impkt-logo');\nexport const ImpktDocumentLink = wrap('impkt-document-link');\nexport const ImpktPrice = wrap('impkt-price');\nexport const ImpktDialog = wrap('impkt-dialog', [], { 'impkt-close': 'close' });\n\nexport const ImpktTextInput = wrap('impkt-text-input', [], CHANGE);\nexport const ImpktTextarea = wrap('impkt-textarea', [], CHANGE);\nexport const ImpktCheckbox = wrap('impkt-checkbox', [], CHANGE);\nexport const ImpktSelect = wrap('impkt-select', ['options'], CHANGE);\nexport const ImpktRadioGroup = wrap('impkt-radio-group', ['options'], CHANGE);\nexport const ImpktCheckboxGroup = wrap('impkt-checkbox-group', ['options', 'values'], CHANGE);\nexport const ImpktDateInput = wrap('impkt-date-input', [], CHANGE);\n\nexport const ImpktSummaryList = wrap('impkt-summary-list', ['rows']);\nexport const ImpktTable = wrap('impkt-table', ['columns', 'rows']);\nexport const ImpktAccordion = wrap('impkt-accordion', ['items', 'open']);\nexport const ImpktProgress = wrap('impkt-progress', ['steps']);\n\nexport type {\n RadioOption, SelectOption, CheckboxOption, SummaryRow, TableColumn, AccordionItem, ProgressStep, HelpKind,\n PropType,\n};\n\nexport const ImpktGrid = wrap('impkt-grid');\n\n// Every help prop is a string, so none has to be bound as a DOM property. A\n// `kind` of phone or email builds its own link from `detail`, so `href` is\n// only passed for a link (see `HelpKind`).\nexport const ImpktHelp = wrap('impkt-help');\n"],"mappings":";AA2BA,SAAS,iBAAiB,SAAoD;AAC9E,OAAO;AAgBP,SAAS,KAAK,KAAa,WAAqB,CAAC,GAAG,SAAiC,CAAC,GAAG;AACvF,SAAO,gBAAgB;AAAA,IACrB,MAAM,IAAI,QAAQ,cAAc,CAAC,GAAG,IAAI,MAAc,EAAE,YAAY,CAAC;AAAA,I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B,CAAC,SAAS,GAAG,MAAM;AAC5D,IAAM,kBAAkB,KAAK,qBAAqB,CAAC,SAAS,GAAG,MAAM;AACrE,IAAM,qBAAqB,KAAK,wBAAwB,CAAC,WAAW,QAAQ,GAAG,MAAM;AACrF,IAAM,iBAAiB,KAAK,oBAAoB,CAAC,GAAG,MAAM;AAE1D,IAAM,mBAAmB,KAAK,sBAAsB,CAAC,MAAM,CAAC;AAC5D,IAAM,aAAa,KAAK,eAAe,CAAC,WAAW,MAAM,CAAC;AAC1D,IAAM,iBAAiB,KAAK,mBAAmB,CAAC,SAAS,MAAM,CAAC;AAChE,IAAM,gBAAgB,KAAK,kBAAkB,CAAC,OAAO,CAAC;AAOtD,IAAM,YAAY,KAAK,YAAY;AAKnC,IAAM,YAAY,KAAK,YAAY;","names":["_"]}
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@atomic-ui/ui-vue",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "Vue bindings for @atomic-ui/ui: typed props bound as DOM properties, and typed custom events.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/matthill8286/impkt-design-system.git",
8
+ "directory": "packages/ui-vue"
9
+ },
5
10
  "type": "module",
6
11
  "main": "./dist/index.js",
7
12
  "types": "./dist/index.d.ts",
@@ -12,7 +17,7 @@
12
17
  }
13
18
  },
14
19
  "dependencies": {
15
- "@atomic-ui/ui": "0.1.5"
20
+ "@atomic-ui/ui": "^0.2.0"
16
21
  },
17
22
  "peerDependencies": {
18
23
  "vue": "^3.4.0"
@@ -26,11 +31,12 @@
26
31
  "README.md"
27
32
  ],
28
33
  "publishConfig": {
34
+ "registry": "https://registry.npmjs.org",
29
35
  "access": "public"
30
36
  },
31
37
  "scripts": {
32
38
  "build": "tsc -p tsconfig.json",
33
39
  "typecheck": "tsc -p tsconfig.json",
34
- "test": "echo \"(behaviour is covered by @impkt/ui; these are binding shims)\""
40
+ "test": "echo \"(behaviour is covered by @atomic-ui/ui; these are binding shims)\""
35
41
  }
36
- }
42
+ }